-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Summary
Text is a custom polymorphic typography component using CVA. Has hardcoded pixel values in deprecated size variants, missing heading element support, and outdated JSDoc comments.
Improvements
1. Replace hardcoded pixel values in deprecated size variants
CSS contains hardcoded px values (13px, 18px, 20px, 22px, 24px, 28px) in size classes text-3 through text-10. Should use design tokens or be removed.
2. Add heading element support (h1-h6)
The as prop supports span, div, p, label, a but not heading elements. Users cannot render semantically correct headings.
3. Add single-line truncation variant
Only lineClamp exists for multi-line truncation. Missing a truncate variant for common single-line text-overflow: ellipsis pattern.
4. Update outdated JSDoc comments
Comments suggest "Use 'regular' | 'medium'" for weight but the component actually supports 15 weight options. Misleading documentation.
5. Clean up or deprecate numeric size variants (1-10)
Numeric sizes coexist with named sizes (micro, mini, small, regular, large). Should formally deprecate or remove numeric variants.
6. Fix lineClamp variant returning arrays
lineClamp variant returns class arrays [styles['text-line-clamp'], styles['text-line-clamp-1']] instead of single class strings. Inconsistent with other variants.
Files
packages/raystack/raystack/components/text/