Skip to content

Commit

Permalink
[Rating]: added to uui, removed redundant props for all packages
Browse files Browse the repository at this point in the history
  • Loading branch information
siarhei-epam committed Nov 13, 2024
1 parent 4eb7756 commit 409c35d
Show file tree
Hide file tree
Showing 13 changed files with 634 additions and 229 deletions.
4 changes: 3 additions & 1 deletion app/src/docs/Rating.doc.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import * as uui from '@epam/uui';
import * as loveship from '@epam/loveship';
import * as promo from '@epam/promo';
import { DocBuilder, TDocConfig, TDocContext, TSkin } from '@epam/uui-docs';
import { BaseDocsBlock, DocExample, EditableDocContent } from '../common';
import * as uui from '@epam/uui';

export class RatingDoc extends BaseDocsBlock {
title = 'Rating';
Expand All @@ -12,6 +12,7 @@ export class RatingDoc extends BaseDocsBlock {
name: 'Rating',
contexts: [TDocContext.Default, TDocContext.Form],
bySkin: {
[TSkin.UUI]: { type: '@epam/uui:RatingProps', component: uui.Rating },
[TSkin.Loveship]: { type: '@epam/loveship:RatingProps', component: loveship.Rating },
[TSkin.Promo]: { type: '@epam/promo:RatingProps', component: promo.Rating },
},
Expand All @@ -23,6 +24,7 @@ export class RatingDoc extends BaseDocsBlock {
0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5,
],
});
doc.merge('hint', { examples: [{ value: (rating) => `${rating} star(s)`, name: '(rating) => string' }] });
},
};

Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* [Data Sources]: cursor-based pagination support. More details [here](http://uui.epam.com/documents?id=dataSources-lazy-dataSource&mode=doc&category=dataSources&theme=loveship#using_cursor-based_pagination)
* [TimelineScale]: added bottom/top month text customisation.
* [TimelineScale]: customisation of today line height was added.
* [Rating]: added to uui, removed redundant props for all packages.

**What's Fixed**
* [VirtualList]: fixed estimatedHeight calculations in components with pagination
Expand Down
2 changes: 1 addition & 1 deletion epam-promo/components/inputs/Rating.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function applyRatingMods(mods: RatingMods & uuiComponents.RatingProps) {
}

/** Represents the properties of a Rating component. */
export interface RatingProps extends uuiComponents.RatingProps, RatingMods {}
export interface RatingProps extends Omit<uuiComponents.RatingProps, 'filledStarIcon' | 'emptyStarIcon' | 'renderRating' | 'from' | 'to'>, RatingMods {}

export const Rating = withMods<uuiComponents.RatingProps, RatingProps>(
uuiComponents.Rating,
Expand Down
8 changes: 6 additions & 2 deletions loveship/components/inputs/Rating.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface RatingMods {
size?: 18 | 24 | 30;
}

/** Represents the properties for the MultiSwitch component. */
/** Represents the properties for the Rating component. */
export interface RatingProps extends uuiComponents.RatingProps, RatingMods {}

function applyRatingMods(mods: RatingMods & uuiComponents.RatingProps) {
Expand All @@ -25,6 +25,10 @@ function applyRatingMods(mods: RatingMods & uuiComponents.RatingProps) {

export const Rating = createSkinComponent<uuiComponents.RatingProps, RatingProps>(
uuiComponents.Rating,
() => ({ filledStarIcon: FilledStarIcon, emptyStarIcon: EmptyStarIcon, Tooltip }),
() => ({
filledStarIcon: FilledStarIcon,
emptyStarIcon: EmptyStarIcon,
Tooltip,
}),
applyRatingMods,
);
3 changes: 3 additions & 0 deletions public/docs/docsGenOutput/docsGenOutput.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@ type Autogenerated_TDocsGenExportedTypeRef = '@epam/uui-core:AcceptDropParams' |
'@epam/uui:RangeDatePickerInputProps' |
'@epam/uui:RangeDatePickerProps' |
'@epam/uui:RangeDatePickerValue' |
'@epam/uui:RatingCoreProps' |
'@epam/uui:RatingModsOverride' |
'@epam/uui:RatingProps' |
'@epam/uui:RichTextViewModsOverride' |
'@epam/uui:RichTextViewProps' |
'@epam/uui:RowMods' |
Expand Down
Loading

0 comments on commit 409c35d

Please sign in to comment.