Skip to content

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

TypeScript

fix(theming): TreeList item xdsClassName + Typeahead shadow token (#789)

Cindy Zhang94b5c0c71d45
diff --git a/packages/core/src/TreeList/TreeList.doc.mjs b/packages/core/src/TreeList/TreeList.doc.mjs
index 879c4b353b..52436c0464 100644
--- a/packages/core/src/TreeList/TreeList.doc.mjs
+++ b/packages/core/src/TreeList/TreeList.doc.mjs
@@ -62,6 +62,7 @@ export const docs = {
theming: {
targets: [
{className: 'xds-tree-list', visualProps: ['density']},
+ {className: 'xds-tree-list-item', states: ['selected', 'disabled']},
],
},
notes: [
@@ -187,6 +188,7 @@ export const docsZh = {
theming: {
targets: [
{className: 'xds-tree-list', visualProps: ['density']},
+ {className: 'xds-tree-list-item', states: ['selected', 'disabled']},
],
},
notes: [
diff --git a/packages/core/src/TreeList/XDSTreeListItem.tsx b/packages/core/src/TreeList/XDSTreeListItem.tsx
index 628dcef660..e3a011a3a3 100644
--- a/packages/core/src/TreeList/XDSTreeListItem.tsx
+++ b/packages/core/src/TreeList/XDSTreeListItem.tsx
@@ -23,6 +23,7 @@ import {
typeScaleVars,
} from '../theme/tokens.stylex';
import {getIcon} from '../Icon/globalIconRegistry';
+import {xdsClassName, mergeProps} from '../utils';
import {
XDSTreeListBranches,
XDSTreeListHorizontalConnector,
@@ -416,15 +417,21 @@ export function XDSTreeListItem({
nestedLevel={nestedLevel}
/>
<div
- {...stylex.props(
- styles.contentWrapper,
- densityStyles[density],
- (isInteractive || (hasChildren && onClick == null)) &&
- styles.interactive,
- (isInteractive || (hasChildren && onClick == null)) &&
- styles.focusWithinOutline,
- isDisabled && styles.disabled,
- isSelected && styles.selected,
+ {...mergeProps(
+ xdsClassName('tree-list-item', {
+ selected: isSelected ? 'selected' : null,
+ disabled: isDisabled ? 'disabled' : null,
+ }),
+ stylex.props(
+ styles.contentWrapper,
+ densityStyles[density],
+ (isInteractive || (hasChildren && onClick == null)) &&
+ styles.interactive,
+ (isInteractive || (hasChildren && onClick == null)) &&
+ styles.focusWithinOutline,
+ isDisabled && styles.disabled,
+ isSelected && styles.selected,
+ ),
)}
style={{marginLeft: computedMarginLeft}}
onClick={handleClick}>
diff --git a/packages/core/src/Typeahead/XDSBaseTypeahead.tsx b/packages/core/src/Typeahead/XDSBaseTypeahead.tsx
index 0bef611647..a2a6ea7ae6 100644
--- a/packages/core/src/Typeahead/XDSBaseTypeahead.tsx
+++ b/packages/core/src/Typeahead/XDSBaseTypeahead.tsx
@@ -36,6 +36,7 @@ import {
lineHeightVars,
typographyVars,
fontWeightVars,
+ shadowVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import type {XDSSearchableItem, XDSSearchSource} from './types';
@@ -178,7 +179,7 @@ const styles = stylex.create({
padding: spacingVars['--spacing-1'],
borderRadius: radiusVars['--radius-2'],
backgroundColor: colorVars['--color-surface'],
- boxShadow: `0 4px 12px ${colorVars['--color-shadow']}`,
+ boxShadow: shadowVars['--shadow-menu'],
},
popover: {
minWidth: 'anchor-size(width)',