@hh.ru/magritte-ui-rating-review 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RatingReview.d.ts +1 -1
- package/RatingReview.js +2 -2
- package/RatingReview.js.map +1 -1
- package/index.css +6 -6
- package/package.json +2 -2
package/RatingReview.d.ts
CHANGED
package/RatingReview.js
CHANGED
|
@@ -6,7 +6,7 @@ import { useDisabled } from '@hh.ru/magritte-common-use-disabled';
|
|
|
6
6
|
import { StarFilledSize16, StarOutlinedSize16, StarFilledSize24, StarOutlinedSize24 } from '@hh.ru/magritte-ui-icon/icon';
|
|
7
7
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
8
8
|
|
|
9
|
-
var styles = {"rating-review":"magritte-rating-review___X1HDg_1-0-
|
|
9
|
+
var styles = {"rating-review":"magritte-rating-review___X1HDg_1-0-3","ratingReview":"magritte-rating-review___X1HDg_1-0-3","internal-container":"magritte-internal-container___Tutx7_1-0-3","internalContainer":"magritte-internal-container___Tutx7_1-0-3","size-medium":"magritte-size-medium___wVwww_1-0-3","sizeMedium":"magritte-size-medium___wVwww_1-0-3","disabled":"magritte-disabled___uGGmU_1-0-3","has-rating":"magritte-has-rating___BoybH_1-0-3","hasRating":"magritte-has-rating___BoybH_1-0-3"};
|
|
10
10
|
|
|
11
11
|
const ICON_BY_SIZE = {
|
|
12
12
|
small: {
|
|
@@ -28,7 +28,7 @@ const RatingReview = forwardRef(({ 'data-qa': dataQa, value, 'aria-describedby':
|
|
|
28
28
|
[styles.sizeMedium]: size === 'medium',
|
|
29
29
|
[styles.hasRating]: normalizedValue > 0,
|
|
30
30
|
[styles.disabled]: isDisabled,
|
|
31
|
-
}), children: jsxs("div", { className: styles.internalContainer, "aria-hidden": true, children: [jsx(Icon, {}), jsx(Text, { typography: size === 'small' ? 'subtitle-
|
|
31
|
+
}), children: jsxs("div", { className: styles.internalContainer, "aria-hidden": true, children: [jsx(Icon, {}), jsx(Text, { typography: size === 'small' ? 'subtitle-1-semibold' : 'title-4-semibold', children: normalizedValue.toLocaleString(undefined, {
|
|
32
32
|
maximumFractionDigits: fractionDigits,
|
|
33
33
|
minimumFractionDigits: fractionDigits,
|
|
34
34
|
}) })] }) }));
|
package/RatingReview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RatingReview.js","sources":["../src/RatingReview.tsx"],"sourcesContent":["import { forwardRef, type LegacyRef } from 'react';\nimport classnames from 'classnames';\n\nimport { useDisabled } from '@hh.ru/magritte-common-use-disabled';\nimport {\n StarFilledSize16,\n StarOutlinedSize16,\n StarFilledSize24,\n StarOutlinedSize24,\n} from '@hh.ru/magritte-ui-icon/icon';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './rating-review.less';\n\nexport type RatingReviewSize = 'small' | 'medium';\n\nexport interface RatingReviewProps {\n 'data-qa'?: string;\n /** Значение */\n value: number | null;\n 'aria-describedby'?: string;\n /** Размер */\n size
|
|
1
|
+
{"version":3,"file":"RatingReview.js","sources":["../src/RatingReview.tsx"],"sourcesContent":["import { forwardRef, type LegacyRef } from 'react';\nimport classnames from 'classnames';\n\nimport { useDisabled } from '@hh.ru/magritte-common-use-disabled';\nimport {\n StarFilledSize16,\n StarOutlinedSize16,\n StarFilledSize24,\n StarOutlinedSize24,\n} from '@hh.ru/magritte-ui-icon/icon';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './rating-review.less';\n\nexport type RatingReviewSize = 'small' | 'medium';\n\nexport interface RatingReviewProps {\n 'data-qa'?: string;\n /** Значение */\n value: number | null;\n 'aria-describedby'?: string;\n /** Размер */\n size?: RatingReviewSize;\n}\n\nexport const ICON_BY_SIZE = {\n small: {\n filled: StarFilledSize16,\n outline: StarOutlinedSize16,\n },\n medium: {\n filled: StarFilledSize24,\n outline: StarOutlinedSize24,\n },\n} as const;\n\nexport const normalizeRatingValue = (value: number | null): number =>\n value ? Math.round(Math.min(Math.max(value, 0), 5) * 2) / 2 : 0;\n\nexport const RatingReview = forwardRef<HTMLElement, RatingReviewProps>(\n ({ 'data-qa': dataQa, value, 'aria-describedby': describedBy, size = 'small' }, ref) => {\n const normalizedValue = normalizeRatingValue(value);\n const isDisabled = useDisabled();\n const fractionDigits = normalizedValue === 0 ? 0 : 1;\n const Icon = ICON_BY_SIZE[size][normalizedValue > 0 ? 'filled' : 'outline'];\n\n return (\n <div\n role=\"img\"\n aria-label={normalizedValue.toLocaleString()}\n data-qa={dataQa}\n aria-describedby={describedBy}\n ref={ref as LegacyRef<HTMLDivElement>}\n className={classnames(styles.ratingReview, {\n [styles.sizeMedium]: size === 'medium',\n [styles.hasRating]: normalizedValue > 0,\n [styles.disabled]: isDisabled,\n })}\n >\n <div className={styles.internalContainer} aria-hidden>\n <Icon />\n <Text typography={size === 'small' ? 'subtitle-1-semibold' : 'title-4-semibold'}>\n {normalizedValue.toLocaleString(undefined, {\n maximumFractionDigits: fractionDigits,\n minimumFractionDigits: fractionDigits,\n })}\n </Text>\n </div>\n </div>\n );\n }\n);\n\nRatingReview.displayName = 'RatingReview';\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;AAyBa,MAAA,YAAY,GAAG;AACxB,IAAA,KAAK,EAAE;AACH,QAAA,MAAM,EAAE,gBAAgB;AACxB,QAAA,OAAO,EAAE,kBAAkB;AAC9B,KAAA;AACD,IAAA,MAAM,EAAE;AACJ,QAAA,MAAM,EAAE,gBAAgB;AACxB,QAAA,OAAO,EAAE,kBAAkB;AAC9B,KAAA;EACM;AAEE,MAAA,oBAAoB,GAAG,CAAC,KAAoB,KACrD,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE;AAEvD,MAAA,YAAY,GAAG,UAAU,CAClC,CAAC,EAAE,S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AA,CACL,EACJ,CAAA,EACR;AACN,CAAC,EACH;AAEF,YAAY,CAAC,WAAW,GAAG,cAAc;;;;"}
|
package/index.css
CHANGED
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
--magritte-color-icon-state-tertiary-disabled-v21-4-6:#767676;
|
|
15
15
|
--magritte-color-icon-state-warning-disabled-v21-4-6:#eb8d057a;
|
|
16
16
|
}
|
|
17
|
-
.magritte-rating-review___X1HDg_1-0-
|
|
17
|
+
.magritte-rating-review___X1HDg_1-0-3{
|
|
18
18
|
display:inline-block;
|
|
19
19
|
--magritte-ui-icon-color-override:var(--magritte-color-icon-tertiary-v21-4-6);
|
|
20
20
|
--magritte-ui-text-color-override:var(--magritte-color-text-primary-v21-4-6);
|
|
21
21
|
}
|
|
22
|
-
.magritte-internal-container___Tutx7_1-0-
|
|
22
|
+
.magritte-internal-container___Tutx7_1-0-3{
|
|
23
23
|
display:inline-flex;
|
|
24
24
|
flex-wrap:nowrap;
|
|
25
25
|
gap:6px;
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
justify-content:center;
|
|
28
28
|
height:22px;
|
|
29
29
|
}
|
|
30
|
-
.magritte-size-medium___wVwww_1-0-
|
|
30
|
+
.magritte-size-medium___wVwww_1-0-3 .magritte-internal-container___Tutx7_1-0-3{
|
|
31
31
|
height:32px;
|
|
32
32
|
}
|
|
33
|
-
.magritte-disabled___uGGmU_1-0-
|
|
33
|
+
.magritte-disabled___uGGmU_1-0-3{
|
|
34
34
|
--magritte-ui-icon-color-override:var(--magritte-color-icon-state-tertiary-disabled-v21-4-6);
|
|
35
35
|
--magritte-ui-text-color-override:var(--magritte-color-text-state-primary-disabled-v21-4-6);
|
|
36
36
|
}
|
|
37
|
-
.magritte-disabled___uGGmU_1-0-
|
|
37
|
+
.magritte-disabled___uGGmU_1-0-3.magritte-has-rating___BoybH_1-0-3{
|
|
38
38
|
--magritte-ui-icon-color-override:var(--magritte-color-icon-state-warning-disabled-v21-4-6);
|
|
39
39
|
}
|
|
40
|
-
.magritte-has-rating___BoybH_1-0-
|
|
40
|
+
.magritte-has-rating___BoybH_1-0-3{
|
|
41
41
|
--magritte-ui-icon-color-override:var(--magritte-color-icon-warning-v21-4-6);
|
|
42
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hh.ru/magritte-ui-rating-review",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"@hh.ru/magritte-ui-theme-provider": "1.1.48",
|
|
34
34
|
"@hh.ru/magritte-ui-typography": "3.0.44"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "9897c444aadfb14784e9475464c127e66b6f7b5d"
|
|
37
37
|
}
|