Skip to content

Commit cd391e0

Browse files
committed
fix(Item): migrate to mod values
1 parent df05f0e commit cd391e0

File tree

1 file changed

+24
-41
lines changed

1 file changed

+24
-41
lines changed

src/components/content/Item/Item.tsx

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -778,43 +778,30 @@ const Item = <T extends HTMLElement = HTMLDivElement>(
778778
[hotkeys, finalIsDisabled],
779779
);
780780

781-
mods = useMemo(() => {
782-
return {
783-
'with-icon': !!finalIcon,
784-
'with-right-icon': !!finalRightIcon,
785-
'with-label': !!(children || labelProps),
786-
'with-prefix': !!finalPrefix,
787-
'with-suffix': !!finalSuffix,
788-
'with-description': showDescriptions,
789-
'with-description-block':
790-
showDescriptions && descriptionPlacement === 'block',
791-
'with-actions': !!actions,
792-
'with-actions-content': !!(actions && actions !== true),
793-
checkbox: hasCheckbox,
794-
disabled: finalIsDisabled,
795-
selected: isSelected === true,
796-
loading: isLoading,
797-
card: isCard === true,
798-
button: isButton === true,
799-
[`shape-${shape}`]: true,
800-
...mods,
801-
};
802-
}, [
803-
finalIcon,
804-
finalRightIcon,
805-
finalPrefix,
806-
finalSuffix,
807-
showDescriptions,
808-
descriptionPlacement,
809-
hasCheckbox,
810-
isSelected,
811-
isLoading,
812-
isCard,
813-
isButton,
814-
shape,
815-
actions,
816-
mods,
817-
]);
781+
mods = {
782+
'with-icon': !!finalIcon,
783+
'with-right-icon': !!finalRightIcon,
784+
'with-label': !!(children || labelProps),
785+
'with-prefix': !!finalPrefix,
786+
'with-suffix': !!finalSuffix,
787+
'with-description': showDescriptions,
788+
'with-description-block':
789+
showDescriptions && descriptionPlacement === 'block',
790+
'with-actions': !!actions,
791+
'with-actions-content': !!(actions && actions !== true),
792+
checkbox: hasCheckbox,
793+
disabled: finalIsDisabled,
794+
selected: isSelected === true,
795+
loading: isLoading,
796+
card: isCard === true,
797+
button: isButton === true,
798+
[`shape-${shape}`]: true,
799+
// Use value mods for data-* attributes
800+
size: typeof size === 'number' ? undefined : size,
801+
type,
802+
theme,
803+
...mods,
804+
};
818805

819806
const {
820807
labelProps: finalLabelProps,
@@ -860,10 +847,6 @@ const Item = <T extends HTMLElement = HTMLDivElement>(
860847
theme && type ? (`${theme}.${type}` as ItemVariant) : undefined
861848
}
862849
disabled={finalIsDisabled}
863-
data-size={typeof size === 'number' ? undefined : size}
864-
data-type={type}
865-
data-theme={theme}
866-
data-shape={shape}
867850
aria-disabled={finalIsDisabled}
868851
aria-selected={isSelected}
869852
mods={mods}

0 commit comments

Comments
 (0)