(
}}
>
(
'PRIVATE_TreeView-item-toggle',
onSelect && 'PRIVATE_TreeView-item-toggle--hover',
level === 1 && 'PRIVATE_TreeView-item-toggle--end',
- {
- [classes.TreeViewItemToggle]: cssModulesEnabled,
- [classes.TreeViewItemToggleHover]: cssModulesEnabled,
- [classes.TreeViewItemToggleEnd]: cssModulesEnabled,
- },
+ classes.TreeViewItemToggle,
+ classes.TreeViewItemToggleHover,
+ classes.TreeViewItemToggleEnd,
)}
onClick={event => {
if (onSelect) {
@@ -592,18 +357,9 @@ const Item = React.forwardRef(
)}
) : null}
-
+
{slots.leadingVisual}
-
+
{childrenWithoutSubTree}
{slots.trailingVisual}
@@ -618,16 +374,10 @@ const Item = React.forwardRef(
/** Lines to indicate the depth of an item in a TreeView */
const LevelIndicatorLines: React.FC<{level: number}> = ({level}) => {
- const cssModulesEnabled = useFeatureFlag(CSS_MODULES_FEATURE_FLAG)
return (
{Array.from({length: level - 1}).map((_, index) => (
-
+
))}
)
@@ -777,66 +527,18 @@ function usePreviousValue(value: T): T {
return ref.current
}
-const StyledSkeletonItemContainer = toggleStyledComponent(
- CSS_MODULES_FEATURE_FLAG,
- 'span',
- styled.span.attrs({
- className: 'PRIVATE_TreeView-item-skeleton',
- })`
- display: flex;
- align-items: center;
- column-gap: 0.5rem;
- height: 2rem;
-
- @media (pointer: coarse) {
- height: 2.75rem;
- }
-
- &:nth-of-type(5n + 1) {
- --tree-item-loading-width: 67%;
- }
-
- &:nth-of-type(5n + 2) {
- --tree-item-loading-width: 47%;
- }
-
- &:nth-of-type(5n + 3) {
- --tree-item-loading-width: 73%;
- }
-
- &:nth-of-type(5n + 4) {
- --tree-item-loading-width: 64%;
- }
-
- &:nth-of-type(5n + 5) {
- --tree-item-loading-width: 50%;
- }
- `,
-)
-
-const StyledSkeletonText = toggleStyledComponent(
- CSS_MODULES_FEATURE_FLAG,
- SkeletonText,
- styled(SkeletonText)`
- width: var(--tree-item-loading-width, 67%);
- `,
-)
-
const SkeletonItem = () => {
- const cssModulesEnabled = useFeatureFlag(CSS_MODULES_FEATURE_FLAG)
return (
-
-
-
+
+
)
}
@@ -846,7 +548,6 @@ type LoadingItemProps = {
const LoadingItem = React.forwardRef
(({count}, ref) => {
const itemId = useId()
- const cssModulesEnabled = useFeatureFlag(CSS_MODULES_FEATURE_FLAG)
if (count) {
return (
@@ -854,9 +555,7 @@ const LoadingItem = React.forwardRef(({count}, re
{Array.from({length: count}).map((_, i) => {
return
})}
-
- Loading {count} items
-
+ Loading {count} items
)
}
@@ -908,22 +607,18 @@ export type TreeViewVisualProps = {
}
const LeadingVisual: React.FC = props => {
- const cssModulesEnabled = useFeatureFlag(CSS_MODULES_FEATURE_FLAG)
const {isExpanded, leadingVisualId} = React.useContext(ItemContext)
const children = typeof props.children === 'function' ? props.children({isExpanded}) : props.children
return (
<>
{props.label}
-
+
{children}
>
@@ -933,22 +628,18 @@ const LeadingVisual: React.FC
= props => {
LeadingVisual.displayName = 'TreeView.LeadingVisual'
const TrailingVisual: React.FC = props => {
- const cssModulesEnabled = useFeatureFlag(CSS_MODULES_FEATURE_FLAG)
const {isExpanded, trailingVisualId} = React.useContext(ItemContext)
const children = typeof props.children === 'function' ? props.children({isExpanded}) : props.children
return (
<>
{props.label}
-
+
{children}
>
@@ -961,21 +652,15 @@ TrailingVisual.displayName = 'TreeView.TrailingVisual'
// TreeView.LeadingAction
const LeadingAction: React.FC
= props => {
- const cssModulesEnabled = useFeatureFlag(CSS_MODULES_FEATURE_FLAG)
const {isExpanded} = React.useContext(ItemContext)
const children = typeof props.children === 'function' ? props.children({isExpanded}) : props.children
return (
<>
-
+
{props.label}
{children}
@@ -989,11 +674,10 @@ LeadingAction.displayName = 'TreeView.LeadingAction'
// TreeView.DirectoryIcon
const DirectoryIcon = () => {
- const cssModulesEnabled = useFeatureFlag(CSS_MODULES_FEATURE_FLAG)
const {isExpanded} = React.useContext(ItemContext)
const Icon = isExpanded ? FileDirectoryOpenFillIcon : FileDirectoryFillIcon
return (
-