Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(lint): eliminate all consistent-type-assertions and no-console warnings (#2315)

Andrey Goder716a840adc48
diff --git a/apps/docsite/src/app/(preview)/playground-preview/scope.ts b/apps/docsite/src/app/(preview)/playground-preview/scope.ts
index 843e4d91bd..edcbfc7c57 100644
--- a/apps/docsite/src/app/(preview)/playground-preview/scope.ts
+++ b/apps/docsite/src/app/(preview)/playground-preview/scope.ts
@@ -6,10 +6,27 @@ import React, {useState, useCallback, useMemo, useEffect, useRef} from 'react';
const stylexMock = {
create: <T extends Record<string, unknown>>(styles: T): T => styles,
- props: (..._styles: unknown[]) => ({className: '', style: {} as Record<string, string>}),
+ props: (..._styles: unknown[]) => {
+ const style: Record<string, string> = {};
+ return {className: '', style};
+ },
defineVars: <T extends Record<string, unknown>>(tokens: T): T => tokens,
keyframes: (kf: Record<string, Record<string, string>>) => kf,
- types: {angle: (v: string) => v, color: (v: string) => v, image: (v: string) => v, integer: (v: string) => v, length: (v: string) => v, lengthPercentage: (v: string) => v, number: (v: string) => v, percentage: (v: string) => v, resolution: (v: string) => v, time: (v: string) => v, transformFunction: (v: string) => v, transformList: (v: string) => v, url: (v: string) => v},
+ types: {
+ angle: (v: string) => v,
+ color: (v: string) => v,
+ image: (v: string) => v,
+ integer: (v: string) => v,
+ length: (v: string) => v,
+ lengthPercentage: (v: string) => v,
+ number: (v: string) => v,
+ percentage: (v: string) => v,
+ resolution: (v: string) => v,
+ time: (v: string) => v,
+ transformFunction: (v: string) => v,
+ transformList: (v: string) => v,
+ url: (v: string) => v,
+ },
};
import * as AlertDialog from '@xds/core/AlertDialog';
@@ -116,19 +133,29 @@ const SCOPE_THEMES: Record<string, XDSDefinedTheme> = {
};
const ControlledXDSTheme = (props: ComponentProps<typeof XDSTheme>) => {
- const win = typeof window !== 'undefined'
- ? (window as unknown as Record<string, unknown>)
- : null;
- const mode = (win?.__xds_preview_mode__ as 'light' | 'dark' | 'system') || 'system';
+ const win =
+ typeof window !== 'undefined'
+ ? (window as unknown as Record<string, unknown>)
+ : null;
+ const mode =
+ (win?.__xds_preview_mode__ as 'light' | 'dark' | 'system') || 'system';
const themeName = (win?.__xds_preview_theme__ as string) || 'default';
const theme = SCOPE_THEMES[themeName] ?? defaultTheme;
return createElement(XDSTheme, {...props, theme, mode});
};
export const scope: Record<string, Record<string, unknown>> = {
- 'react': {default: React, ...React, useState, useCallback, useMemo, useEffect, useRef},
+ react: {
+ default: React,
+ ...React,
+ useState,
+ useCallback,
+ useMemo,
+ useEffect,
+ useRef,
+ },
'@stylexjs/stylex': {default: stylexMock, ...stylexMock},
- 'stylex': {default: stylexMock, ...stylexMock},
+ stylex: {default: stylexMock, ...stylexMock},
'@xds/theme-default': {default: defaultTheme, defaultTheme},
'@xds/theme-default/built': {default: defaultTheme, defaultTheme},
'@xds/theme-neutral': {default: neutralTheme, neutralTheme},
@@ -219,10 +246,94 @@ export const scope: Record<string, Record<string, unknown>> = {
'@xds/core/TopNav': TopNav,
'@xds/core/TreeList': TreeList,
'@xds/core/Typeahead': Typeahead,
- '@xds/core': {...AlertDialog, ...AppShell, ...AspectRatio, ...Avatar, ...Badge, ...Banner, ...Breadcrumbs, ...Button, ...Calendar, ...Card, ...Carousel, ...Center, ...Chat, ...CheckboxInput, ...CheckboxList, ...ClickableCard, ...CodeBlock, ...Collapsible, ...CommandPalette, ...DateInput, ...Dialog, ...Divider, ...DropdownMenu, ...EmptyState, ...Field, ...FormLayout, ...Grid, ...HoverCard, ...Icon, ...IconButton, ...Kbd, ...Layer, ...Layout, ...Link, ...List, ...Markdown, ...MetadataList, ...MobileNav, ...MoreMenu, ...MultiSelector, ...NavIcon, ...NavMenu, ...NumberInput, ...OverflowList, ...Overlay, ...Pagination, ...Popover, ...PowerSearch, ...ProgressBar, ...RadioList, ...Resizable, ...Section, ...SegmentedControl, ...SelectableCard, ...Selector, ...SideNav, ...SizeContext, ...Skeleton, ...Slider, ...Spinner, ...Stack, ...StatusDot, ...Switch, ...TabList, ...Table, ...Text, ...TextArea, ...TextInput, ...Thumbnail, ...TimeInput, ...Timestamp, ...Toast, ...ToggleButton, ...Token, ...Tokenizer, ...Toolbar, ...Tooltip, ...TopNav, ...TreeList, ...Typeahead},
+ '@xds/core': {
+ ...AlertDialog,
+ ...AppShell,
+ ...AspectRatio,
+ ...Avatar,
+ ...Badge,
+ ...Banner,
+ ...Breadcrumbs,
+ ...Button,
+ ...Calendar,
+ ...Card,
+ ...Carousel,
+ ...Center,
+ ...Chat,
+ ...CheckboxInput,
+ ...CheckboxList,
+ ...ClickableCard,
+ ...CodeBlock,
+ ...Collapsible,
+ ...CommandPalette,
+ ...DateInput,
+ ...Dialog,
+ ...Divider,
+ ...DropdownMenu,
+ ...EmptyState,
+ ...Field,
+ ...FormLayout,
+ ...Grid,
+ ...HoverCard,
+ ...Icon,
+ ...IconButton,
+ ...Kbd,
+ ...Layer,
+ ...Layout,
+ ...Link,
+ ...List,
+ ...Markdown,
+ ...MetadataList,
+ ...MobileNav,
+ ...MoreMenu,
+ ...MultiSelector,
+ ...NavIcon,
+ ...NavMenu,
+ ...NumberInput,
+ ...OverflowList,
+ ...Overlay,
+ ...Pagination,
+ ...Popover,
+ ...PowerSearch,
+ ...ProgressBar,
+ ...RadioList,
+ ...Resizable,
+ ...Section,
+ ...SegmentedControl,
+ ...SelectableCard,
+ ...Selector,
+ ...SideNav,
+ ...SizeContext,
+ ...Skeleton,
+ ...Slider,
+ ...Spinner,
+ ...Stack,
+ ...StatusDot,
+ ...Switch,
+ ...TabList,
+ ...Table,
+ ...Text,
+ ...TextArea,
+ ...TextInput,
+ ...Thumbnail,
+ ...TimeInput,
+ ...Timestamp,
+ ...Toast,
+ ...ToggleButton,
+ ...Token,
+ ...Tokenizer,
+ ...Toolbar,
+ ...Tooltip,
+ ...TopNav,
+ ...TreeList,
+ ...Typeahead,
+ },
'@heroicons/react/16/solid': Heroicons16Solid,
'@heroicons/react/20/solid': Heroicons20Solid,
'@heroicons/react/24/outline': Heroicons24Outline,
'@heroicons/react/24/solid': Heroicons24Solid,
- 'next/image': {default: (props: Record<string, unknown>) => React.createElement('img', props)},
+ 'next/image': {
+ default: (props: Record<string, unknown>) =>
+ React.createElement('img', props),
+ },
};
diff --git a/apps/docsite/src/components/component-detail/PlaygroundPropsTable.tsx b/apps/docsite/src/components/component-detail/PlaygroundPropsTable.tsx
index 383335e72b..50115b66c7 100644
--- a/apps/docsite/src/components/component-detail/PlaygroundPropsTable.tsx
+++ b/apps/docsite/src/components/component-detail/PlaygroundPropsTable.tsx
@@ -162,10 +162,12 @@ function SlotListControl({
typeof tweaked.children === 'string'
? `${tweaked.children} ${n}`
: tweaked.children;
- const newEl = resolveElementDescriptor({
- ...tweaked,
- children,
- } as import('../../generated/componentRegistry').ElementDescriptor);
+ const descriptor: import('../../generated/componentRegistry').ElementDescriptor =
+ {
+ ...tweaked,
+ children,
+ };
+ const newEl = resolveElementDescriptor(descriptor);
onChange([...items, newEl]);
};
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx
index 96fc884c44..8ca1947654 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx
@@ -463,46 +463,47 @@ export function ChatPanel({
))}
</div>
- <div
- style={
- {
- padding: 12,
- // Override shadow tokens so the composer body inherits none
- '--shadow-low': 'none',
- '--shadow-med': 'none',
- } as React.CSSProperties
- }>
- <XDSChatComposer
- onSubmit={() => {
- if (!prompt.trim()) {
- return;
- }
- setMessages(prev => [
- ...prev,
- {role: 'user', text: prompt.trim()},
- ]);
- onSend?.(prompt);
- setPrompt('');
- }}
- value={prompt}
- onChange={setPrompt}
- placeholder="Ask for changes"
- input={<XDSChatComposerInput placeholder="Ask for changes" />}
- xstyle={composerStyles.border}
- style={
- {
- '--shadow-low': 'none',
- '--shadow-med': 'none',
- '--_chat-composer-radius': 'var(--radius-container)',
- '--_button-radius': 'var(--radius-full)',
- } as React.CSSProperties
- }
- />
- </div>
+ {(() => {
+ const wrapperStyle: React.CSSProperties &
+ Record<`--${string}`, string> = {
+ padding: 12,
+ // Override shadow tokens so the composer body inherits none
+ '--shadow-low': 'none',
+ '--shadow-med': 'none',
+ };
+ const composerStyle: React.CSSProperties &
+ Record<`--${string}`, string> = {
+ '--shadow-low': 'none',
+ '--shadow-med': 'none',
+ '--_chat-composer-radius': 'var(--radius-container)',
+ '--_button-radius': 'var(--radius-full)',
+ };
+ return (
+ <div style={wrapperStyle}>
+ <XDSChatComposer
+ onSubmit={() => {
+ if (!prompt.trim()) {
+ return;
+ }
+ setMessages(prev => [
+ ...prev,
+ {role: 'user', text: prompt.trim()},
+ ]);
+ onSend?.(prompt);
+ setPrompt('');
+ }}
+ value={prompt}
+ onChange={setPrompt}
+ placeholder="Ask for changes"
+ input={<XDSChatComposerInput placeholder="Ask for changes" />}
+ xstyle={composerStyles.border}
+ style={composerStyle}
+ />
+ </div>
+ );
+ })()}
</>
)}
-
- {/* Properties tab */}
{templateName && onTabChange && tab === 'properties' && (
<div
style={{
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ProfileView.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ProfileView.tsx
index 3b263287ad..f3b63c8a26 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ProfileView.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ProfileView.tsx
@@ -477,7 +477,7 @@ function PreviewDialogShell({
overflow: 'visible',
maxWidth: 1600,
'--xds-dialog-padding': '0px',
- } as React.CSSProperties
+ } satisfies React.CSSProperties
}>
{isOpen && (
<>
@@ -1735,7 +1735,7 @@ export function ProfileView({
overflow: 'visible',
maxWidth: 1200,
'--xds-dialog-padding': '0px',
- } as React.CSSProperties
+ } satisfies React.CSSProperties
}>
{componentDrawerKey &&
(() => {
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreviewModal.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreviewModal.tsx
index 14df2b4c75..f5367e5537 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreviewModal.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreviewModal.tsx
@@ -180,7 +180,7 @@ export function TemplatePreviewModal({
overflow: 'visible',
maxWidth: 1600,
'--xds-dialog-padding': '0px',
- } as React.CSSProperties
+ } satisfies React.CSSProperties
}>
<div style={{position: 'absolute', top: 0, right: -40, zIndex: 1}}>
<XDSCard padding={0} style={{borderRadius: '50%'}}>
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ThemeEditorView.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ThemeEditorView.tsx
index c9921a58b4..e215964267 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ThemeEditorView.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ThemeEditorView.tsx
@@ -4967,15 +4967,16 @@ export function ThemeEditorView({
(t: {slug: string; name: string}) =>
t.slug === activePreview.slice(9),
)?.name ?? 'Template')
- : ((
- {
+ : (() => {
+ const previewLabels: Record<string, string> = {
preview: 'Component Preview',
landing: 'Landing Page',
dashboard: 'Dashboard',
tokens: 'Token Preview',
table: 'Table Page',
- } as Record<string, string>
- )[activePreview] ?? activePreview),
+ };
+ return previewLabels[activePreview] ?? activePreview;
+ })(),
variant: 'ghost',
size: 'md',
}}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx
index 962e4599d4..a71337e859 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx
@@ -1217,7 +1217,7 @@ function DocsiteLandingTemplate() {
<XDSAppShell
variant="surface"
height="fill"
- style={{} as React.CSSProperties}
+ style={{} satisfies React.CSSProperties}
topNav={
<AppTopNav
activeView={activeView}
@@ -2347,7 +2347,7 @@ function DocsiteLandingTemplate() {
overflow: 'visible',
maxWidth: 900,
'--xds-dialog-padding': '0px',
- } as React.CSSProperties
+ } satisfies React.CSSProperties
}>
<div
style={{position: 'absolute', top: 0, right: -40, zIndex: 1}}>
diff --git a/apps/sandbox/src/app/(sandbox)/pages/color-studio/page.tsx b/apps/sandbox/src/app/(sandbox)/pages/color-studio/page.tsx
index 95805e273b..6154093741 100644
--- a/apps/sandbox/src/app/(sandbox)/pages/color-studio/page.tsx
+++ b/apps/sandbox/src/app/(sandbox)/pages/color-studio/page.tsx
@@ -43,7 +43,7 @@ const S = {
height: '100vh',
overflow: 'hidden',
backgroundColor: 'var(--color-background-surface, #fff)',
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
sidebar: {
width: 320,
flexShrink: 0,
@@ -51,7 +51,7 @@ const S = {
display: 'flex',
flexDirection: 'column' as const,
overflow: 'hidden',
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
sidebarPanel: {
flex: 1,
backgroundColor: 'var(--color-background-card, #fff)',
@@ -61,37 +61,36 @@ const S = {
display: 'flex',
flexDirection: 'column' as const,
margin: 8,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
sidebarHeader: {
padding: '14px 16px',
borderBottom: '1px solid var(--color-border)',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
sidebarScroll: {
flex: 1,
overflow: 'auto',
padding: 16,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
main: {
flex: 1,
overflowY: 'auto' as const,
height: '100vh',
padding: 24,
- } as React.CSSProperties,
- swatch: (bg: string) =>
- ({
- width: 28,
- height: 28,
- borderRadius: 4,
- background: bg,
- border: '1px solid rgba(0,0,0,0.08)',
- flexShrink: 0,
- position: 'relative' as const,
- overflow: 'hidden',
- cursor: 'pointer',
- }) as React.CSSProperties,
+ } satisfies React.CSSProperties,
+ swatch: (bg: string): React.CSSProperties => ({
+ width: 28,
+ height: 28,
+ borderRadius: 4,
+ background: bg,
+ border: '1px solid rgba(0,0,0,0.08)',
+ flexShrink: 0,
+ position: 'relative' as const,
+ overflow: 'hidden',
+ cursor: 'pointer',
+ }),
colorInput: {
position: 'absolute' as const,
inset: -8,
@@ -100,13 +99,13 @@ const S = {
border: 'none',
cursor: 'pointer',
opacity: 0,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
tonalRow: {
display: 'flex',
alignItems: 'center',
gap: 6,
marginBottom: 3,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
tonalLabel: {
width: 70,
flexShrink: 0,
@@ -116,19 +115,18 @@ const S = {
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap' as const,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
tonalStrip: {
display: 'flex',
flex: 1,
overflow: 'hidden',
border: '1px solid rgba(0,0,0,0.08)',
- } as React.CSSProperties,
- tonalCell: (bg: string) =>
- ({
- flex: 1,
- height: 28,
- background: bg,
- }) as React.CSSProperties,
+ } satisfies React.CSSProperties,
+ tonalCell: (bg: string): React.CSSProperties => ({
+ flex: 1,
+ height: 28,
+ background: bg,
+ }),
tonalHct: {
width: 55,
flexShrink: 0,
@@ -136,7 +134,7 @@ const S = {
fontFamily: MONO,
color: '#52525b',
textAlign: 'right' as const,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
};
// =============================================================================
diff --git a/apps/sandbox/src/app/(sandbox)/pages/doc-preview/content-blocks/CodeBlock.tsx b/apps/sandbox/src/app/(sandbox)/pages/doc-preview/content-blocks/CodeBlock.tsx
index dc83600d86..26a1405924 100644
--- a/apps/sandbox/src/app/(sandbox)/pages/doc-preview/content-blocks/CodeBlock.tsx
+++ b/apps/sandbox/src/app/(sandbox)/pages/doc-preview/content-blocks/CodeBlock.tsx
@@ -35,10 +35,12 @@ export function CodeBlock({
code={code}
language={lang}
hasCopyButton
- style={{
- '--color-syntax-background': 'transparent',
- width: '100%',
- } as React.CSSProperties}
+ style={
+ {
+ '--color-syntax-background': 'transparent',
+ width: '100%',
+ } satisfies React.CSSProperties
+ }
/>
</XDSCard>
</XDSVStack>
diff --git a/apps/sandbox/src/components/ThemePalettePreview.tsx b/apps/sandbox/src/components/ThemePalettePreview.tsx
index 82b12d5b05..261e1cb3e5 100644
--- a/apps/sandbox/src/components/ThemePalettePreview.tsx
+++ b/apps/sandbox/src/components/ThemePalettePreview.tsx
@@ -360,11 +360,11 @@ const S = {
color: 'var(--color-text-primary)',
fontFamily: 'var(--font-family-body)',
padding: '40px 32px',
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
inner: {
maxWidth: 1280,
margin: '0 auto',
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
title: {
fontSize: 32,
fontWeight: 700,
@@ -372,29 +372,28 @@ const S = {
margin: 0,
marginBottom: 8,
fontFamily: 'var(--font-family-heading)',
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
subtitle: {
fontSize: 14,
color: 'var(--color-text-secondary)',
margin: 0,
marginBottom: 32,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
twoCol: {
display: 'grid',
gridTemplateColumns: '1fr 1fr',
gap: 24,
- } as React.CSSProperties,
- modeCol: (bg: string, fg: string) =>
- ({
- background: bg,
- color: fg,
- border: '1px solid var(--color-border)',
- borderRadius: 16,
- padding: 24,
- display: 'flex',
- flexDirection: 'column' as const,
- gap: 28,
- }) as React.CSSProperties,
+ } satisfies React.CSSProperties,
+ modeCol: (bg: string, fg: string): React.CSSProperties => ({
+ background: bg,
+ color: fg,
+ border: '1px solid var(--color-border)',
+ borderRadius: 16,
+ padding: 24,
+ display: 'flex',
+ flexDirection: 'column' as const,
+ gap: 28,
+ }),
modeLabel: {
fontSize: 11,
fontWeight: 600,
@@ -403,93 +402,89 @@ const S = {
margin: 0,
marginBottom: 16,
opacity: 0.6,
- } as React.CSSProperties,
- section: {} as React.CSSProperties,
+ } satisfies React.CSSProperties,
+ section: {} satisfies React.CSSProperties,
sectionTitle: {
fontSize: 13,
fontWeight: 600,
margin: 0,
marginBottom: 12,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
coreRow: {
display: 'grid',
gridTemplateColumns: 'repeat(5, 1fr)',
gap: 10,
- } as React.CSSProperties,
- coreSwatch: (bg: string) =>
- ({
- background: bg,
- borderRadius: 10,
- border: '1px solid light-dark(rgba(0,0,0,0.08), rgba(255,255,255,0.15))',
- height: 88,
- }) as React.CSSProperties,
+ } satisfies React.CSSProperties,
+ coreSwatch: (bg: string): React.CSSProperties => ({
+ background: bg,
+ borderRadius: 10,
+ border: '1px solid light-dark(rgba(0,0,0,0.08), rgba(255,255,255,0.15))',
+ height: 88,
+ }),
coreMeta: {
marginTop: 6,
fontFamily: MONO,
fontSize: 10,
lineHeight: 1.4,
opacity: 0.7,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
surfacesGrid: {
display: 'grid',
gridTemplateColumns: 'repeat(5, 1fr)',
gap: 8,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
surfaceCell: {
display: 'flex',
flexDirection: 'column' as const,
gap: 4,
- } as React.CSSProperties,
- surfaceSwatch: (bg: string, ring: string) =>
- ({
- height: 56,
- background: bg,
- borderRadius: 8,
- border: `1px solid ${ring}`,
- }) as React.CSSProperties,
+ } satisfies React.CSSProperties,
+ surfaceSwatch: (bg: string, ring: string): React.CSSProperties => ({
+ height: 56,
+ background: bg,
+ borderRadius: 8,
+ border: `1px solid ${ring}`,
+ }),
surfaceMeta: {
fontFamily: MONO,
fontSize: 9.5,
lineHeight: 1.3,
opacity: 0.7,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
tonalRow: {
display: 'flex',
alignItems: 'center',
gap: 8,
marginBottom: 4,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
tonalLabel: {
width: 80,
flexShrink: 0,
fontSize: 10,
fontFamily: MONO,
opacity: 0.7,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
tonalStrip: {
display: 'flex',
flex: 1,
borderRadius: 6,
overflow: 'hidden',
border: '1px solid rgba(0,0,0,0.06)',
- } as React.CSSProperties,
- tonalCell: (bg: string) =>
- ({
- flex: 1,
- height: 36,
- background: bg,
- display: 'flex',
- alignItems: 'flex-end',
- justifyContent: 'center',
- paddingBottom: 2,
- }) as React.CSSProperties,
- tonalNum: (tone: number) =>
- ({
- fontSize: 7,
- fontFamily: MONO,
- color: tone >= 50 ? 'rgba(0,0,0,0.4)' : 'rgba(255,255,255,0.5)',
- pointerEvents: 'none' as const,
- }) as React.CSSProperties,
+ } satisfies React.CSSProperties,
+ tonalCell: (bg: string): React.CSSProperties => ({
+ flex: 1,
+ height: 36,
+ background: bg,
+ display: 'flex',
+ alignItems: 'flex-end',
+ justifyContent: 'center',
+ paddingBottom: 2,
+ }),
+ tonalNum: (tone: number): React.CSSProperties => ({
+ fontSize: 7,
+ fontFamily: MONO,
+ color: tone >= 50 ? 'rgba(0,0,0,0.4)' : 'rgba(255,255,255,0.5)',
+ pointerEvents: 'none' as const,
+ }),
tonalHct: {
width: 60,
flexShrink: 0,
@@ -497,34 +492,32 @@ const S = {
fontFamily: MONO,
opacity: 0.5,
textAlign: 'right' as const,
- } as React.CSSProperties,
- markerDot: (tone: number) =>
- ({
- position: 'absolute' as const,
- top: 2,
- left: '50%',
- transform: 'translateX(-50%)',
- minWidth: 8,
- height: 8,
- paddingInline: 2,
- borderRadius: 999,
- border: `1.5px solid ${tone >= 50 ? 'rgba(0,0,0,0.6)' : 'rgba(255,255,255,0.85)'}`,
- background: tone >= 50 ? 'rgba(0,0,0,0.2)' : 'rgba(255,255,255,0.3)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- lineHeight: 1,
- }) as React.CSSProperties,
+ } satisfies React.CSSProperties,
+ markerDot: (tone: number): React.CSSProperties => ({
+ position: 'absolute' as const,
+ top: 2,
+ left: '50%',
+ transform: 'translateX(-50%)',
+ minWidth: 8,
+ height: 8,
+ paddingInline: 2,
+ borderRadius: 999,
+ border: `1.5px solid ${tone >= 50 ? 'rgba(0,0,0,0.6)' : 'rgba(255,255,255,0.85)'}`,
+ background: tone >= 50 ? 'rgba(0,0,0,0.2)' : 'rgba(255,255,255,0.3)',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ lineHeight: 1,
+ }),
// Pill shows the token count when more than one token snaps to the same
// tone step. Stays inside the marker dot so the strip layout is unchanged.
- markerCount: (tone: number) =>
- ({
- fontSize: 7.5,
- fontWeight: 700,
- fontFamily: MONO,
- color: tone >= 50 ? 'rgba(0,0,0,0.85)' : 'rgba(255,255,255,0.95)',
- pointerEvents: 'none' as const,
- }) as React.CSSProperties,
+ markerCount: (tone: number): React.CSSProperties => ({
+ fontSize: 7.5,
+ fontWeight: 700,
+ fontFamily: MONO,
+ color: tone >= 50 ? 'rgba(0,0,0,0.85)' : 'rgba(255,255,255,0.95)',
+ pointerEvents: 'none' as const,
+ }),
};
// =============================================================================
@@ -1260,9 +1253,10 @@ export function ThemePalettePreview({
// so we can also feed it into a CSS-variable injection at the page
// root — that way every component on the page (mode columns + tonal
// strip) re-renders live as you reassign tokens in the drawer.
+ const emptyOverrides = {};
const [overrides, dispatchOverrides] = useReducer(
overridesReducer,
- {} as OverridesMap,
+ emptyOverrides as OverridesMap,
);
// Map of `--token: light-dark(#L, #D)` for every pending override.
diff --git a/apps/sandbox/src/components/themePreview/ThemeAuditDrawer.tsx b/apps/sandbox/src/components/themePreview/ThemeAuditDrawer.tsx
index 36ed2b0f9c..1be97b1ce1 100644
--- a/apps/sandbox/src/components/themePreview/ThemeAuditDrawer.tsx
+++ b/apps/sandbox/src/components/themePreview/ThemeAuditDrawer.tsx
@@ -175,25 +175,25 @@ const S = {
display: 'flex',
flexDirection: 'column' as const,
gap: 6,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
headerTopRow: {
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
gap: 12,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
title: {
margin: 0,
fontSize: 14,
fontWeight: 700,
fontFamily: 'var(--font-family-heading)',
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
subtitle: {
margin: 0,
fontSize: 11,
color: 'var(--color-text-secondary)',
lineHeight: 1.5,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
modeRow: {
display: 'flex',
gap: 4,
@@ -201,7 +201,7 @@ const S = {
borderBottom: '1px solid var(--color-border)',
background: 'var(--color-background-surface)',
alignItems: 'center',
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
modeButton: (active: boolean): React.CSSProperties => ({
appearance: 'none',
border: '1px solid transparent',
@@ -218,7 +218,7 @@ const S = {
flex: 1,
overflowY: 'auto' as const,
padding: '4px 20px 24px',
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
// Category header — small uppercase secondary text, intentionally
// restrained so the rows beneath read as the primary content (matches
// the docsite editor exactly).
@@ -230,7 +230,7 @@ const S = {
color: 'var(--color-text-secondary)',
margin: 0,
padding: '14px 0 4px',
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
// Each row is a 3-column grid: label · status · editor cluster. We use
// a CSS grid (not flex) with `minmax(0, 1fr)` on the label column so
// long token labels truncate cleanly when the drawer is narrow.
@@ -241,13 +241,13 @@ const S = {
alignItems: 'center',
padding: '8px 0',
borderBottom: '1px solid var(--color-border)',
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
labelCell: {
minWidth: 0,
display: 'flex',
flexDirection: 'column' as const,
gap: 2,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
labelText: {
fontSize: 12,
fontWeight: 500,
@@ -255,7 +255,7 @@ const S = {
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap' as const,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
tokenName: {
fontSize: 10,
fontFamily: MONO,
@@ -263,7 +263,7 @@ const S = {
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap' as const,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
// Right-side editor cluster — fixed grid so the original swatch
// column, trigger button, and reset link always land in the same
// horizontal positions across every row regardless of label length
@@ -276,7 +276,7 @@ const S = {
alignItems: 'center',
width: 240,
flexShrink: 0,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
// Combined swatch + value-label button. The swatch sits flush with
// the button's left edge (no inset padding) so it visually aligns
// with the standalone original swatch on its left. Vertical padding
@@ -299,7 +299,7 @@ const S = {
minWidth: 0,
width: '100%',
height: 30,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
triggerButtonEdited: {
appearance: 'none' as const,
display: 'flex',
@@ -317,7 +317,7 @@ const S = {
minWidth: 0,
width: '100%',
height: 30,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
// Inline swatch sits flush against the trigger button's left edge.
// Same 28×28 footprint as the standalone original swatch on the
// outside, with the same radius matched to the button's inner radius
@@ -329,7 +329,7 @@ const S = {
borderBottomLeftRadius: 5,
borderRight: '1px solid var(--color-border)',
flexShrink: 0,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
triggerLabel: {
overflow: 'hidden',
textOverflow: 'ellipsis',
@@ -338,7 +338,7 @@ const S = {
flex: 1,
textAlign: 'left' as const,
paddingLeft: 8,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
// "Original" swatch rendered to the left of the active swatch. Always
// present (even when default === current) so the row geometry is
// consistent and you can sanity-check the original value at a glance.
@@ -373,12 +373,12 @@ const S = {
borderRadius: 4,
cursor: 'pointer',
maxWidth: 90,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
indirectNote: {
fontSize: 9.5,
color: 'var(--color-text-secondary)',
fontStyle: 'italic' as const,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
applyFooter: {
borderTop: '1px solid var(--color-border)',
padding: '12px 20px',
@@ -387,7 +387,7 @@ const S = {
alignItems: 'center',
justifyContent: 'space-between',
gap: 12,
- } as React.CSSProperties,
+ } satisfies React.CSSProperties,
};
// =============================================================================
@@ -426,9 +426,10 @@ export function ThemeAuditDrawer({
const [mode, setMode] = useState<Mode>('light');
// Controlled or uncontrolled: if the parent passed both `overrides` and
// `dispatchOverrides`, use them; otherwise keep our own reducer.
+ const emptyOverrides = {};
const [internalOverrides, dispatchInternal] = useReducer(
overridesReducer,
- {} as OverridesMap,
+ emptyOverrides as OverridesMap,
);
const overrides = overridesProp ?? internalOverrides;
const dispatchOverrides = dispatchProp ?? dispatchInternal;
diff --git a/apps/sandbox/src/components/themePreview/themeAudit.ts b/apps/sandbox/src/components/themePreview/themeAudit.ts
index 9e1b0de573..9327169952 100644
--- a/apps/sandbox/src/components/themePreview/themeAudit.ts
+++ b/apps/sandbox/src/components/themePreview/themeAudit.ts
@@ -172,7 +172,11 @@ export function diffThemeTokens(theme: XDSDefinedTheme): TokenDiff {
new: 0,
removed: 0,
};
- const changedByCategory = {} as Record<TokenCategory, number>;
+ const changedByCategoryInit = {};
+ const changedByCategory = changedByCategoryInit as Record<
+ TokenCategory,
+ number
+ >;
for (const c of CATEGORY_ORDER) {
changedByCategory[c] = 0;
}
diff --git a/apps/sandbox/src/css-custom-properties.d.ts b/apps/sandbox/src/css-custom-properties.d.ts
new file mode 100644
index 0000000000..c3e69ae82e
--- /dev/null
+++ b/apps/sandbox/src/css-custom-properties.d.ts
@@ -0,0 +1,9 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+import 'react';
+
+declare module 'react' {
+ interface CSSProperties {
+ [key: `--${string}`]: string | number | undefined;
+ }
+}
diff --git a/apps/storybook/stories/Item.stories.tsx b/apps/storybook/stories/Item.stories.tsx
index d480f6ebe0..386c12535f 100644
--- a/apps/storybook/stories/Item.stories.tsx
+++ b/apps/storybook/stories/Item.stories.tsx
@@ -151,8 +151,11 @@ export const FileBrowser: Story = {
const toggle = (id: string) =>
setSelected(prev => {
const next = new Set(prev);
- if (next.has(id)) next.delete(id);
- else next.add(id);
+ if (next.has(id)) {
+ next.delete(id);
+ } else {
+ next.add(id);
+ }
return next;
});
diff --git a/eslint.config.js b/eslint.config.js
index 3e0f29b3b0..feebb4327c 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -44,6 +44,7 @@ export default tseslint.config(
"apps/docsite/*.js",
"apps/docsite/scripts/**",
"apps/sandbox/*.js",
+ "apps/sandbox/out/**",
"packages/build/**",
],
},
@@ -182,4 +183,17 @@ export default tseslint.config(
"react-compiler/react-compiler": "off",
},
},
+ // Non-production code — allow console.log for demos, tools, and examples
+ {
+ files: [
+ "apps/storybook/stories/**/*.{ts,tsx}",
+ "apps/sandbox/**/*.{ts,tsx}",
+ "apps/example-*/**/*.{ts,tsx}",
+ "internal/**/*.{ts,tsx}",
+ "packages/cli/templates/**/*.{ts,tsx}",
+ ],
+ rules: {
+ "no-console": "off",
+ },
+ },
);
diff --git a/internal/test-utils/src/setup.ts b/internal/test-utils/src/setup.ts
index 97ed8c4a78..cfcfe9cfde 100644
--- a/internal/test-utils/src/setup.ts
+++ b/internal/test-utils/src/setup.ts
@@ -14,8 +14,8 @@ import '@testing-library/jest-dom/vitest';
// Polyfill for matchMedia (not supported in jsdom)
if (typeof window !== 'undefined' && !window.matchMedia) {
- window.matchMedia = (query: string) =>
- ({
+ window.matchMedia = (query: string) => {
+ const mql: MediaQueryList = {
matches: false,
media: query,
onchange: null,
@@ -24,7 +24,9 @@ if (typeof window !== 'undefined' && !window.matchMedia) {
addEventListener: () => {},
removeEventListener: () => {},
dispatchEvent: () => false,
- }) as MediaQueryList;
+ };
+ return mql;
+ };
}
// Polyfill for Popover API (not supported in jsdom)
diff --git a/internal/vibe-tests/app/src/report/CompareView.tsx b/internal/vibe-tests/app/src/report/CompareView.tsx
index b6e9e86680..7b1bdcf8ae 100644
--- a/internal/vibe-tests/app/src/report/CompareView.tsx
+++ b/internal/vibe-tests/app/src/report/CompareView.tsx
@@ -438,11 +438,13 @@ export function CompareView({comparison}: CompareViewProps) {
const catData: CatRow[] = [...allCategories].map(cat => {
const xdsCat = xds.byCategory[cat] ?? {};
const baseCat = baseline.byCategory[cat] ?? {};
+ const htmlInit = {};
const htmlCat =
- html?.byCategory[cat] ?? ({} as Record<UniversalDimension, number>);
+ html?.byCategory[cat] ?? (htmlInit as Record<UniversalDimension, number>);
+ const twInit = {};
const twCat =
xdsTailwind?.byCategory[cat] ??
- ({} as Record<UniversalDimension, number>);
+ (twInit as Record<UniversalDimension, number>);
const xdsAvg =
CODE_DIMENSIONS.reduce(
(s, d) => s + ((xdsCat[d as UniversalDimension] as number) ?? 0),
diff --git a/internal/vibe-tests/src/universal-aggregate.ts b/internal/vibe-tests/src/universal-aggregate.ts
index de78747162..da801a5af9 100644
--- a/internal/vibe-tests/src/universal-aggregate.ts
+++ b/internal/vibe-tests/src/universal-aggregate.ts
@@ -132,7 +132,11 @@ async function main() {
const category = promptMap.get(promptId) ?? 'unknown';
if (!categoryScores[category]) {
- categoryScores[category] = {} as Record<UniversalDimension, number[]>;
+ const catInit = {};
+ categoryScores[category] = catInit as Record<
+ UniversalDimension,
+ number[]
+ >;
for (const dim of dimensions) {
categoryScores[category][dim] = [];
}
@@ -254,7 +258,8 @@ async function main() {
// Compute averages
const promptCount = Object.keys(byPrompt).length;
- const averages = {} as Record<UniversalDimension, number>;
+ const averagesInit = {};
+ const averages = averagesInit as Record<UniversalDimension, number>;
for (const dim of dimensions) {
const scores = Object.values(byPrompt)
.map(s => s[dim]?.score)
@@ -288,7 +293,8 @@ async function main() {
// Category averages
const byCategory: Record<string, Record<UniversalDimension, number>> = {};
for (const [cat, dimScores] of Object.entries(categoryScores)) {
- byCategory[cat] = {} as Record<UniversalDimension, number>;
+ const byCatInit = {};
+ byCategory[cat] = byCatInit as Record<UniversalDimension, number>;
for (const dim of dimensions) {
const scores = dimScores[dim];
byCategory[cat][dim] = Math.round(
diff --git a/internal/vibe-tests/src/universal-compare.ts b/internal/vibe-tests/src/universal-compare.ts
index 1fbf333df3..4a6c7b6197 100644
--- a/internal/vibe-tests/src/universal-compare.ts
+++ b/internal/vibe-tests/src/universal-compare.ts
@@ -288,7 +288,8 @@ async function main() {
const isFourWay = !!twData;
// Build comparison
- const winners = {} as Record<UniversalDimension, WinnerType>;
+ const winnersInit = {};
+ const winners = winnersInit as Record<UniversalDimension, WinnerType>;
for (const d of dimensions) {
winners[d] = winner(
xds.averages[d],
diff --git a/packages/core/src/utils/mergeProps.ts b/packages/core/src/utils/mergeProps.ts
index 818a6e1489..6160c82135 100644
--- a/packages/core/src/utils/mergeProps.ts
+++ b/packages/core/src/utils/mergeProps.ts
@@ -27,22 +27,25 @@
* )} />
* ```
*/
+
+type StyleObject = React.CSSProperties;
+
export function mergeProps(
- xdsClassOrStylexResult: string | {className?: string; style?: object},
+ xdsClassOrStylexResult: string | {className?: string; style?: StyleObject},
stylexResultOrClassName?:
- | {className?: string; style?: object}
+ | {className?: string; style?: StyleObject}
| string
| undefined,
classNameOrStyle?: string | React.CSSProperties,
style?: React.CSSProperties,
-): {className: string; style?: object} {
+): {className: string; style?: StyleObject} {
// Disambiguate: first arg is string → (xdsClass, stylexResult, className?, style?)
// first arg is object → (stylexResult, overrides?, ...)
if (typeof xdsClassOrStylexResult === 'string') {
const xdsClass = xdsClassOrStylexResult;
const stylexResult = (stylexResultOrClassName as {
className?: string;
- style?: object;
+ style?: StyleObject;
}) ?? {className: ''};
const className = classNameOrStyle as string | undefined;
@@ -63,10 +66,11 @@ export function mergeProps(
// Object form: mergeProps(stylex.props(...), { style, className })
const base = xdsClassOrStylexResult;
- const overrides = (stylexResultOrClassName as {
- className?: string;
- style?: object;
- }) ?? {};
+ const overrides =
+ (stylexResultOrClassName as {
+ className?: string;
+ style?: StyleObject;
+ }) ?? {};
let cls = base.className ?? '';
if (overrides.className) {
diff --git a/packages/lab/src/Chart/XDSChart.tsx b/packages/lab/src/Chart/XDSChart.tsx
index 36ecfc05dc..1b9ca25901 100644
--- a/packages/lab/src/Chart/XDSChart.tsx
+++ b/packages/lab/src/Chart/XDSChart.tsx
@@ -10,6 +10,7 @@
*/
import {
+ type CSSProperties,
type ReactNode,
useMemo,
useRef,
@@ -282,16 +283,14 @@ export function XDSChart({
],
);
+ const containerStyle: CSSProperties = {
+ width: '100%',
+ touchAction: interactive ? 'none' : undefined,
+ userSelect: interactive ? 'none' : undefined,
+ };
+
return (
- <div
- ref={containerRef}
- style={
- {
- width: '100%',
- touchAction: interactive ? 'none' : undefined,
- userSelect: interactive ? 'none' : undefined,
- } as React.CSSProperties
- }>
+ <div ref={containerRef} style={containerStyle}>
{containerWidth > 0 && (
<svg
ref={svgRef}
diff --git a/packages/lab/src/Chart/XDSChartBrush.tsx b/packages/lab/src/Chart/XDSChartBrush.tsx
index 71e4d42471..1928514ff4 100644
--- a/packages/lab/src/Chart/XDSChartBrush.tsx
+++ b/packages/lab/src/Chart/XDSChartBrush.tsx
@@ -197,6 +197,12 @@ export function XDSChartBrush({
const rectW = brush ? brush.x1 - brush.x0 : 0;
const rectH = brush ? brush.y1 - brush.y0 : 0;
+ const brushRectStyle: React.CSSProperties = {
+ cursor: 'crosshair',
+ touchAction: 'none',
+ userSelect: 'none',
+ };
+
return (
<g>
<rect
@@ -205,13 +211,7 @@ export function XDSChartBrush({
width={width}
height={height}
fill="transparent"
- style={
- {
- cursor: 'crosshair',
- touchAction: 'none',
- userSelect: 'none',
- } as React.CSSProperties
- }
+ style={brushRectStyle}
onPointerDown={onPointerDown}
onPointerMove={onPointerMove}
onPointerUp={onPointerUp}
diff --git a/packages/lab/src/Chart/XDSChartZoom.tsx b/packages/lab/src/Chart/XDSChartZoom.tsx
index 17f777dfb7..62cee04d84 100644
--- a/packages/lab/src/Chart/XDSChartZoom.tsx
+++ b/packages/lab/src/Chart/XDSChartZoom.tsx
@@ -10,7 +10,7 @@
* the initial domains captured on mount.
*/
-import {useCallback, useRef, useEffect} from 'react';
+import {type CSSProperties, useCallback, useRef, useEffect} from 'react';
import {createPortal} from 'react-dom';
import {XDSIconButton} from '@xds/core/IconButton';
import {useChart} from './ChartContext';
@@ -323,7 +323,7 @@ export function XDSChartZoom({
const toolbarPositionStyle = (
pos: ZoomToolbarPosition,
): React.CSSProperties => {
- const base: React.CSSProperties = {
+ const base: CSSProperties = {
position: 'absolute',
display: 'flex',
flexDirection: 'column',
@@ -342,6 +342,12 @@ export function XDSChartZoom({
}
};
+ const zoomRectStyle: CSSProperties = {
+ cursor: 'grab',
+ touchAction: 'none',
+ userSelect: 'none',
+ };
+
return (
<>
<g>
@@ -351,13 +357,7 @@ export function XDSChartZoom({
width={width}
height={height}
fill="transparent"
- style={
- {
- cursor: 'grab',
- touchAction: 'none',
- userSelect: 'none',
- } as React.CSSProperties
- }
+ style={zoomRectStyle}
onWheel={handleWheel}
onPointerDown={onPointerDown}
onPointerMove={onPointerMove}
diff --git a/packages/lab/src/SVGIcon/XDSSVGIcon.tsx b/packages/lab/src/SVGIcon/XDSSVGIcon.tsx
index 41810963b5..c8269b391b 100644
--- a/packages/lab/src/SVGIcon/XDSSVGIcon.tsx
+++ b/packages/lab/src/SVGIcon/XDSSVGIcon.tsx
@@ -352,13 +352,13 @@ export function XDSSVGIcon({
'$1',
);
+ const strokeWidthOverride: Record<string, string> = {
+ [strokeWidthProp]: String(strokeWidth),
+ };
+
const overrideStyle: CSSProperties = {
...(style as CSSProperties),
- ...(strokeWidth != null
- ? ({
- [strokeWidthProp]: String(strokeWidth),
- } as Record<string, string>)
- : undefined),
+ ...(strokeWidth != null ? strokeWidthOverride : undefined),
};
return (
diff --git a/packages/lab/src/ThreeD/XDS3DChart.tsx b/packages/lab/src/ThreeD/XDS3DChart.tsx
index 6498e31f5f..c8f27886e1 100644
--- a/packages/lab/src/ThreeD/XDS3DChart.tsx
+++ b/packages/lab/src/ThreeD/XDS3DChart.tsx
@@ -7,6 +7,7 @@
*/
import {
+ type CSSProperties,
type ReactNode,
useMemo,
useRef,
@@ -219,16 +220,14 @@ export function XDS3DChart({
],
);
+ const containerStyle: CSSProperties = {
+ width: '100%',
+ touchAction: interactive ? 'none' : undefined,
+ userSelect: interactive ? 'none' : undefined,
+ };
+
return (
- <div
- ref={containerRef}
- style={
- {
- width: '100%',
- touchAction: interactive ? 'none' : undefined,
- userSelect: interactive ? 'none' : undefined,
- } as React.CSSProperties
- }>
+ <div ref={containerRef} style={containerStyle}>
{containerWidth > 0 && (
<svg
width={containerWidth}