+
setHoverValue(null)}>
+ {positions.map((position) => {
+ const active = isItemActive(position);
+ return (
+
+ );
+ })}
+
+
+ {type === 'number' && (itemLabels?.[0] || itemLabels?.[total - 1]) && (
+
+ {itemLabels?.[0]}
+ {itemLabels?.[total - 1]}
+
+ )}
+
+ {type === 'star' && displayValue > 0 && itemLabels?.[displayValue - 1] && (
+
{itemLabels[displayValue - 1]}
+ )}
+
+ );
+};
+
+Rating.displayName = 'Rating';
+
+export default Rating;
diff --git a/src/tedi/index.ts b/src/tedi/index.ts
index 7c5590604..b24b1ac9e 100644
--- a/src/tedi/index.ts
+++ b/src/tedi/index.ts
@@ -71,6 +71,7 @@ export * from './components/misc/scroll-fade/scroll-fade';
export * from './components/misc/affix/affix';
export * from './components/misc/ellipsis/ellipsis';
export * from './components/misc/option-content/option-content';
+export * from './components/form/rating/rating';
export * from './components/layout/sidenav';
export * from './components/layout/footer';
From ce502894a429d6dcc1ea863e66d1264e919c4ef8 Mon Sep 17 00:00:00 2001
From: Airike Jaska <95303654+airikej@users.noreply.github.com>
Date: Wed, 1 Jul 2026 10:13:06 +0300
Subject: [PATCH 02/12] feat(rating): design review fixes #531
---
.../components/form/rating/rating.module.scss | 34 ++++++++++++++++---
src/tedi/components/form/rating/rating.tsx | 8 ++---
2 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/src/tedi/components/form/rating/rating.module.scss b/src/tedi/components/form/rating/rating.module.scss
index 166131da9..db9d4b36a 100644
--- a/src/tedi/components/form/rating/rating.module.scss
+++ b/src/tedi/components/form/rating/rating.module.scss
@@ -1,8 +1,11 @@
+@use '@tedi-design-system/core/bootstrap-utility/breakpoints';
+
.tedi-rating {
display: flex;
flex-direction: column;
gap: var(--layout-grid-gutters-04);
align-items: flex-start;
+ width: fit-content;
}
.tedi-rating__items {
@@ -67,21 +70,28 @@
background-color: var(--feedback-indicator);
}
-.tedi-rating__caption,
-.tedi-rating__endpoints,
-.tedi-rating__star-caption {
+.tedi-rating__caption {
font-size: var(--body-small-regular-size);
color: var(--general-text-secondary);
+ text-align: center;
}
-.tedi-rating__caption {
+.tedi-rating__star-caption {
+ align-self: stretch;
+ min-height: var(--body-extra-small-line-height);
+ font-size: var(--body-extra-small-size);
+ line-height: var(--body-extra-small-line-height);
+ color: var(--general-text-secondary);
text-align: center;
}
.tedi-rating__endpoints {
display: flex;
+ align-self: stretch;
justify-content: space-between;
- width: 100%;
+ font-size: var(--body-extra-small-size);
+ line-height: var(--body-extra-small-line-height);
+ color: var(--general-text-secondary);
}
.tedi-rating--disabled {
@@ -95,3 +105,17 @@
background-color: var(--general-text-disabled);
}
}
+
+@include breakpoints.media-breakpoint-down(md) {
+ .tedi-rating--number {
+ .tedi-rating__items {
+ display: grid;
+ grid-template-columns: repeat(5, auto);
+ }
+
+ .tedi-rating__circle {
+ width: var(--button-md-height);
+ height: var(--button-md-height);
+ }
+ }
+}
diff --git a/src/tedi/components/form/rating/rating.tsx b/src/tedi/components/form/rating/rating.tsx
index b68a211a5..4812d1e6d 100644
--- a/src/tedi/components/form/rating/rating.tsx
+++ b/src/tedi/components/form/rating/rating.tsx
@@ -116,8 +116,6 @@ export const Rating = (props: RatingProps): JSX.Element => {
const isItemActive = (position: number): boolean =>
type === 'icon' ? position === displayValue : position <= displayValue;
- // `||` (not `??`) so sparse label arrays — e.g. only the number scale's endpoints — still give
- // every radio a non-empty accessible name.
const itemLabel = (position: number): string => itemLabels?.[position - 1] || `${position} of ${total}`;
const renderVisual = (position: number, active: boolean): React.ReactNode => {
@@ -198,8 +196,10 @@ export const Rating = (props: RatingProps): JSX.Element => {
)}
- {type === 'star' && displayValue > 0 && itemLabels?.[displayValue - 1] && (
-