An open source design system that's fully customizable and agent ready
TypeScript
fix(core): migrate physical left/right CSS properties to logical equivalents for RTL (#4434)
nynexman4464d6002023088a
diff --git a/.changeset/rtl-logical-props.md b/.changeset/rtl-logical-props.mdnew file mode 100644index 0000000000..7e6b1f2458--- /dev/null+++ b/.changeset/rtl-logical-props.md@@ -0,0 +1,14 @@+---+'@astryxdesign/core': patch+---++[fix] RTL: migrate physical `left`/`right` CSS properties to their logical equivalents so components mirror correctly under `dir="rtl"`. This is the Phase 2 mechanical, one-to-one follow-up to the RTL direction API — a no-op in the default LTR direction with no visual change.++- `textAlign: 'left' | 'right'` → `'start' | 'end'` (Selector, Typeahead, Chat trigger menu, DropdownMenu, CommandPalette, NavMenu items).+- `borderLeft*`/`borderRight*` → `borderInlineStart*`/`borderInlineEnd*`, kept as separate start/end declarations (Banner, Table cell/header dividers, DateRangeInput preset sidebar).+- Static `left`/`right` positioning → `insetInlineStart`/`insetInlineEnd` for full-bleed overlays and single-side offsets (Button spinner overlay, Chat dock/blur/placeholder, Field sr-only label, Lightbox close/nav/counter buttons, TabList indicators, Thumbnail remove slot, CodeBlock copy button).+- Inline `marginLeft` indentation → `marginInlineStart` (TreeList rows).++Behavioral/computed positioning (Slider, Resizable, floating layers, anchor-positioned popovers, transform-based centering) and directional radii are intentionally left for later phases.++@nynexman4464diff --git a/packages/core/src/Banner/Banner.tsx b/packages/core/src/Banner/Banner.tsxindex f125076da9..4978e1c506 100644--- a/packages/core/src/Banner/Banner.tsx+++ b/packages/core/src/Banner/Banner.tsx@@ -294,14 +294,14 @@ const styles = stylex.create({backgroundColor: colorVars['--color-background-card'],paddingBlock: spacingVars['--spacing-3'],paddingInline: spacingVars['--spacing-4'],- borderLeftWidth: borderVars['--border-width'],- borderRightWidth: borderVars['--border-width'],+ borderInlineStartWidth: borderVars['--border-width'],+ borderInlineEndWidth: borderVars['--border-width'],borderBottomWidth: borderVars['--border-width'],- borderLeftStyle: 'solid',- borderRightStyle: 'solid',+ borderInlineStartStyle: 'solid',+ borderInlineEndStyle: 'solid',borderBottomStyle: 'solid',- borderLeftColor: colorVars['--color-border'],- borderRightColor: colorVars['--color-border'],+ borderInlineStartColor: colorVars['--color-border'],+ borderInlineEndColor: colorVars['--color-border'],borderBottomColor: colorVars['--color-border'],},contentAreaCard: {diff --git a/packages/core/src/Button/Button.tsx b/packages/core/src/Button/Button.tsxindex 624ee30f18..a8d185c1e8 100644--- a/packages/core/src/Button/Button.tsx+++ b/packages/core/src/Button/Button.tsx@@ -449,8 +449,8 @@ const loadingStyles = stylex.create({spinnerOverlay: {position: 'absolute',top: 0,- left: 0,- right: 0,+ insetInlineStart: 0,+ insetInlineEnd: 0,bottom: 0,display: 'grid',placeItems: 'center',diff --git a/packages/core/src/Chat/ChatComposerInput.tsx b/packages/core/src/Chat/ChatComposerInput.tsxindex 008d77d34a..9c8bbe8321 100644--- a/packages/core/src/Chat/ChatComposerInput.tsx+++ b/packages/core/src/Chat/ChatComposerInput.tsx@@ -238,8 +238,8 @@ const styles = stylex.create({placeholder: {position: 'absolute',top: 0,- left: 0,- right: 0,+ insetInlineStart: 0,+ insetInlineEnd: 0,pointerEvents: 'none',color: colorVars['--color-text-secondary'],fontSize: {diff --git a/packages/core/src/Chat/ChatLayout.tsx b/packages/core/src/Chat/ChatLayout.tsxindex ec06d49f3a..50e2e844b1 100644--- a/packages/core/src/Chat/ChatLayout.tsx+++ b/packages/core/src/Chat/ChatLayout.tsx@@ -134,8 +134,8 @@ const styles = stylex.create({// --- Dock container ---dockContainer: {bottom: 0,- left: 0,- right: 0,+ insetInlineStart: 0,+ insetInlineEnd: 0,zIndex: 0,isolation: 'isolate',pointerEvents: 'none',@@ -150,8 +150,8 @@ const styles = stylex.create({blurLayer: {position: 'absolute',bottom: 0,- left: 0,- right: 0,+ insetInlineStart: 0,+ insetInlineEnd: 0,pointerEvents: 'none',backdropFilter: 'blur(12px)',WebkitBackdropFilter: 'blur(12px)',diff --git a/packages/core/src/Chat/useTriggerMenu.tsx b/packages/core/src/Chat/useTriggerMenu.tsxindex 77aa5b678f..d72de2b7c6 100644--- a/packages/core/src/Chat/useTriggerMenu.tsx+++ b/packages/core/src/Chat/useTriggerMenu.tsx@@ -125,7 +125,7 @@ const styles = stylex.create({outline: 'none',backgroundColor: 'transparent',border: 'none',- textAlign: 'left' as const,+ textAlign: 'start' as const,fontFamily: typographyVars['--font-family-body'],fontSize: typeScaleVars['--text-body-size'],lineHeight: typeScaleVars['--text-body-leading'],diff --git a/packages/core/src/CodeBlock/CodeBlock.tsx b/packages/core/src/CodeBlock/CodeBlock.tsxindex 71d24bd80a..f80d0b59d0 100644--- a/packages/core/src/CodeBlock/CodeBlock.tsx+++ b/packages/core/src/CodeBlock/CodeBlock.tsx@@ -296,7 +296,7 @@ const styles = stylex.create({copyButtonAbsolute: {position: 'absolute',top: spacingVars['--spacing-2'],- right: spacingVars['--spacing-2'],+ insetInlineEnd: spacingVars['--spacing-2'],},});diff --git a/packages/core/src/CommandPalette/CommandPaletteItem.tsx b/packages/core/src/CommandPalette/CommandPaletteItem.tsxindex 393e6a1d0e..554682d6c4 100644--- a/packages/core/src/CommandPalette/CommandPaletteItem.tsx+++ b/packages/core/src/CommandPalette/CommandPaletteItem.tsx@@ -43,7 +43,7 @@ const styles = stylex.create({backgroundColor: 'transparent',border: 'none',cursor: 'pointer',- textAlign: 'left' as const,+ textAlign: 'start' as const,outline: 'none',userSelect: 'none',},diff --git a/packages/core/src/DateRangeInput/DateRangeInput.tsx b/packages/core/src/DateRangeInput/DateRangeInput.tsxindex ac1abec1f3..4ebf686567 100644--- a/packages/core/src/DateRangeInput/DateRangeInput.tsx+++ b/packages/core/src/DateRangeInput/DateRangeInput.tsx@@ -128,9 +128,9 @@ const styles = stylex.create({flexDirection: 'column',gap: spacingVars['--spacing-1'],padding: spacingVars['--spacing-3'],- borderRightWidth: borderVars['--border-width'],- borderRightStyle: 'solid',- borderRightColor: colorVars['--color-border-emphasized'],+ borderInlineEndWidth: borderVars['--border-width'],+ borderInlineEndStyle: 'solid',+ borderInlineEndColor: colorVars['--color-border-emphasized'],minWidth: 140,},presetButton: {diff --git a/packages/core/src/DropdownMenu/DropdownMenuItem.tsx b/packages/core/src/DropdownMenu/DropdownMenuItem.tsxindex b39162a0b5..720472d0df 100644--- a/packages/core/src/DropdownMenu/DropdownMenuItem.tsx+++ b/packages/core/src/DropdownMenu/DropdownMenuItem.tsx@@ -55,7 +55,7 @@ const menuItemStyles = stylex.create({},border: 'none',cursor: 'pointer',- textAlign: 'left',+ textAlign: 'start',outline: 'none',},disabled: {diff --git a/packages/core/src/Field/FieldLabel.tsx b/packages/core/src/Field/FieldLabel.tsxindex 98603bc5d5..a018566df9 100644--- a/packages/core/src/Field/FieldLabel.tsx+++ b/packages/core/src/Field/FieldLabel.tsx@@ -48,7 +48,7 @@ const styles = stylex.create({borderStyle: 'none',clip: 'rect(0, 0, 0, 0)',height: 1,- left: 0,+ insetInlineStart: 0,margin: -1,overflow: 'hidden',padding: 0,diff --git a/packages/core/src/Lightbox/Lightbox.tsx b/packages/core/src/Lightbox/Lightbox.tsxindex e617a58afc..e006b2257c 100644--- a/packages/core/src/Lightbox/Lightbox.tsx+++ b/packages/core/src/Lightbox/Lightbox.tsx@@ -199,7 +199,7 @@ const styles = stylex.create({closeButton: {position: 'absolute',top: spacingVars['--spacing-3'],- right: spacingVars['--spacing-3'],+ insetInlineEnd: spacingVars['--spacing-3'],zIndex: 1,},navButton: {@@ -209,15 +209,15 @@ const styles = stylex.create({zIndex: 1,},navPrev: {- left: spacingVars['--spacing-3'],+ insetInlineStart: spacingVars['--spacing-3'],},navNext: {- right: spacingVars['--spacing-3'],+ insetInlineEnd: spacingVars['--spacing-3'],},counter: {position: 'absolute',top: spacingVars['--spacing-3'],- left: spacingVars['--spacing-3'],+ insetInlineStart: spacingVars['--spacing-3'],color: colorVars['--color-on-dark'],fontSize: typeScaleVars['--text-body-size'],lineHeight: typeScaleVars['--text-body-leading'],diff --git a/packages/core/src/NavMenu/NavHeadingMenuItem.tsx b/packages/core/src/NavMenu/NavHeadingMenuItem.tsxindex 502cfce3bd..f4e5a36251 100644--- a/packages/core/src/NavMenu/NavHeadingMenuItem.tsx+++ b/packages/core/src/NavMenu/NavHeadingMenuItem.tsx@@ -49,7 +49,7 @@ const styles = stylex.create({},border: 'none',cursor: 'pointer',- textAlign: 'left',+ textAlign: 'start',outline: 'none',textDecoration: 'none',},diff --git a/packages/core/src/Selector/Selector.tsx b/packages/core/src/Selector/Selector.tsxindex 092f3d9512..86693a01bc 100644--- a/packages/core/src/Selector/Selector.tsx+++ b/packages/core/src/Selector/Selector.tsx@@ -254,7 +254,7 @@ const styles = stylex.create({backgroundColor: 'transparent',border: 'none',cursor: 'pointer',- textAlign: 'left',+ textAlign: 'start',outline: 'none',},itemContent: {diff --git a/packages/core/src/TabList/Tab.tsx b/packages/core/src/TabList/Tab.tsxindex 6481f1b78e..8a7639842a 100644--- a/packages/core/src/TabList/Tab.tsx+++ b/packages/core/src/TabList/Tab.tsx@@ -143,8 +143,8 @@ const styles = stylex.create({// with a bottom divider — that ancestor sets `--_tab-indicator-bottom`// to drop the indicator onto the rail beneath the reserved gap.bottom: 'var(--_tab-indicator-bottom, -1px)',- left: spacingVars['--spacing-3'],- right: spacingVars['--spacing-3'],+ insetInlineStart: spacingVars['--spacing-3'],+ insetInlineEnd: spacingVars['--spacing-3'],height: '2px',borderRadius: radiusVars['--radius-full'],pointerEvents: 'none',diff --git a/packages/core/src/TabList/TabMenu.tsx b/packages/core/src/TabList/TabMenu.tsxindex 9cbb0f1685..4373cf3072 100644--- a/packages/core/src/TabList/TabMenu.tsx+++ b/packages/core/src/TabList/TabMenu.tsx@@ -126,8 +126,8 @@ const styles = stylex.create({// drops onto the divider rail when an ancestor (TabList `hasDivider` or a// Toolbar with a bottom divider) sets `--_tab-indicator-bottom`.bottom: 'var(--_tab-indicator-bottom, -1px)',- left: spacingVars['--spacing-3'],- right: spacingVars['--spacing-3'],+ insetInlineStart: spacingVars['--spacing-3'],+ insetInlineEnd: spacingVars['--spacing-3'],height: '2px',borderRadius: radiusVars['--radius-full'],pointerEvents: 'none',diff --git a/packages/core/src/Table/TableCell.tsx b/packages/core/src/Table/TableCell.tsxindex 07cbb8fd8e..cc2e93c803 100644--- a/packages/core/src/Table/TableCell.tsx+++ b/packages/core/src/Table/TableCell.tsx@@ -161,12 +161,12 @@ const dividerRowStyles = stylex.create({const dividerColumnStyles = stylex.create({cell: {- borderRightWidth: {+ borderInlineEndWidth: {default: borderVars['--border-width'],':last-child': '0',},- borderRightStyle: 'solid',- borderRightColor: colorVars['--color-border'],+ borderInlineEndStyle: 'solid',+ borderInlineEndColor: colorVars['--color-border'],},});diff --git a/packages/core/src/Table/TableHeaderCell.tsx b/packages/core/src/Table/TableHeaderCell.tsxindex 3485224cf1..3dbc25257a 100644--- a/packages/core/src/Table/TableHeaderCell.tsx+++ b/packages/core/src/Table/TableHeaderCell.tsx@@ -91,12 +91,12 @@ const headerDividerStyles = stylex.create({const dividerColumnStyles = stylex.create({cell: {- borderRightWidth: {+ borderInlineEndWidth: {default: borderVars['--border-width'],':last-child': '0',},- borderRightStyle: 'solid',- borderRightColor: colorVars['--color-border'],+ borderInlineEndStyle: 'solid',+ borderInlineEndColor: colorVars['--color-border'],},});diff --git a/packages/core/src/Thumbnail/Thumbnail.tsx b/packages/core/src/Thumbnail/Thumbnail.tsxindex 8e35dbab55..70cdc1b7dd 100644--- a/packages/core/src/Thumbnail/Thumbnail.tsx+++ b/packages/core/src/Thumbnail/Thumbnail.tsx@@ -207,7 +207,7 @@ const styles = stylex.create({removeSlot: {position: 'absolute',top: spacingVars['--spacing-1'],- right: spacingVars['--spacing-1'],+ insetInlineEnd: spacingVars['--spacing-1'],zIndex: 1,lineHeight: 0,},diff --git a/packages/core/src/TreeList/TreeList.test.tsx b/packages/core/src/TreeList/TreeList.test.tsxindex b9917c9201..8de0cfe837 100644--- a/packages/core/src/TreeList/TreeList.test.tsx+++ b/packages/core/src/TreeList/TreeList.test.tsx@@ -431,24 +431,24 @@ describe('TreeList', () => {});it("variant='noGuides' preserves per-level indentation on the rows", () => {- // Indentation lives on the row's marginLeft (not the guide element), so- // it must survive when the connectors are suppressed. A deeper row is- // indented more than a shallower one.+ // Indentation lives on the row's margin-inline-start (not the guide+ // element), so it must survive when the connectors are suppressed. A+ // deeper row is indented more than a shallower one.const {container} = render(<TreeList items={deepItems} variant="noGuides" />,);const marginOf = (text: string): string => {const li = screen.getByText(text).closest('li')!;- const styled = li.querySelector('[style*="margin-left"]');+ const styled = li.querySelector('[style*="margin-inline-start"]');return styled?.getAttribute('style') ?? '';};// Guides are gone…expect(container.querySelector('.astryx-tree-list-guide')).toBeNull();- // …but each level still carries an inline margin-left, and the level- // multiplier grows with depth (0, 1, 2).- expect(marginOf('Root')).toContain('margin-left');- expect(marginOf('Mid')).toContain('margin-left');- expect(marginOf('Leaf')).toContain('margin-left');+ // …but each level still carries an inline margin-inline-start, and the+ // level multiplier grows with depth (0, 1, 2).+ expect(marginOf('Root')).toContain('margin-inline-start');+ expect(marginOf('Mid')).toContain('margin-inline-start');+ expect(marginOf('Leaf')).toContain('margin-inline-start');const level = (text: string): number => {const m = /calc\((\d+)/.exec(marginOf(text));return m ? Number(m[1]) : NaN;diff --git a/packages/core/src/TreeList/TreeListItem.tsx b/packages/core/src/TreeList/TreeListItem.tsxindex 8a6945ebd7..1140779cf4 100644--- a/packages/core/src/TreeList/TreeListItem.tsx+++ b/packages/core/src/TreeList/TreeListItem.tsx@@ -527,7 +527,7 @@ export function TreeListItem({isSelected && styles.selected,),)}- style={{marginLeft: computedMarginLeft}}+ style={{marginInlineStart: computedMarginLeft}}onClick={handleClick}>{innerContent}</div>diff --git a/packages/core/src/Typeahead/BaseTypeahead.tsx b/packages/core/src/Typeahead/BaseTypeahead.tsxindex 5598575b14..6f25b1aea3 100644--- a/packages/core/src/Typeahead/BaseTypeahead.tsx+++ b/packages/core/src/Typeahead/BaseTypeahead.tsx@@ -230,7 +230,7 @@ const styles = stylex.create({outline: 'none',backgroundColor: 'transparent',border: 'none',- textAlign: 'left',+ textAlign: 'start',},itemHighlighted: {backgroundColor: colorVars['--color-overlay-hover'],