@atlaskit/rating 0.3.28 → 0.3.29
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/CHANGELOG.md +133 -52
- package/__perf__/default.tsx +8 -12
- package/dist/cjs/components/rating-group.js +38 -5
- package/dist/cjs/components/rating.js +5 -1
- package/dist/es2019/components/rating-group.js +37 -44
- package/dist/es2019/components/rating.js +6 -1
- package/dist/esm/components/rating-group.js +37 -5
- package/dist/esm/components/rating.js +6 -1
- package/dist/types/components/rating-group.d.ts +30 -30
- package/dist/types/components/rating.d.ts +33 -33
- package/dist/types/components/star.d.ts +10 -10
- package/dist/types/extract-react-types/rating.d.ts +1 -1
- package/dist/types/extract-react-types/star.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types-ts4.5/components/rating-group.d.ts +30 -30
- package/dist/types-ts4.5/components/rating.d.ts +33 -33
- package/dist/types-ts4.5/components/star.d.ts +10 -10
- package/dist/types-ts4.5/extract-react-types/rating.d.ts +1 -1
- package/dist/types-ts4.5/extract-react-types/star.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/package.json +68 -70
- package/report.api.md +28 -27
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
var _templateObject;
|
|
4
2
|
/* eslint-disable @atlaskit/design-system/use-visually-hidden */
|
|
5
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @jsxRuntime classic
|
|
5
|
+
* @jsx jsx
|
|
6
|
+
*/
|
|
6
7
|
import { Children, cloneElement, Fragment, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
10
|
import { css, jsx } from '@emotion/react';
|
|
8
11
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
9
12
|
export default function RatingGroup(_ref) {
|
|
@@ -35,8 +38,37 @@ export default function RatingGroup(_ref) {
|
|
|
35
38
|
console.error("@atlaskit/rating\nDon't use \"defaultValue\" with \"value\" you're trying to mix uncontrolled and controlled modes.\nUse \"defaultValue\" or \"value\" happy days :-).\n");
|
|
36
39
|
}
|
|
37
40
|
return jsx("div", {
|
|
38
|
-
"data-testid": testId && "".concat(testId, "--root")
|
|
39
|
-
|
|
41
|
+
"data-testid": testId && "".concat(testId, "--root")
|
|
42
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
43
|
+
,
|
|
44
|
+
css: css({
|
|
45
|
+
display: 'inline-flex',
|
|
46
|
+
fontSize: 0,
|
|
47
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
48
|
+
'[data-rating-icon-checked]': {
|
|
49
|
+
display: 'inline-block'
|
|
50
|
+
},
|
|
51
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
52
|
+
'[data-rating-icon]': {
|
|
53
|
+
display: 'none'
|
|
54
|
+
},
|
|
55
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
56
|
+
"label:hover ~ label [data-rating-icon-checked][data-rating-icon-checked], [data-testid='input-container-checked'] ~ label [data-rating-icon-checked]": {
|
|
57
|
+
display: 'none'
|
|
58
|
+
},
|
|
59
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
60
|
+
"label:hover ~ label [data-rating-icon][data-rating-icon], [data-testid='input-container-checked'] ~ label [data-rating-icon]": {
|
|
61
|
+
display: 'inline-block'
|
|
62
|
+
},
|
|
63
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
64
|
+
'&:hover [data-rating-icon-checked][data-rating-icon-checked]': {
|
|
65
|
+
display: 'inline-block'
|
|
66
|
+
},
|
|
67
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
68
|
+
'&:hover [data-rating-icon][data-rating-icon]': {
|
|
69
|
+
display: 'none'
|
|
70
|
+
}
|
|
71
|
+
})
|
|
40
72
|
}, !firstSelectionMade && jsx(Fragment, null, jsx("label", {
|
|
41
73
|
htmlFor: "".concat(groupName, "--empty")
|
|
42
74
|
}), jsx(VisuallyHidden, {
|
|
@@ -2,8 +2,13 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["isChecked", "name", "testId", "label", "id", "value", "onChange", "render"];
|
|
4
4
|
/* eslint-disable @atlaskit/design-system/use-visually-hidden */
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* @jsxRuntime classic
|
|
7
|
+
* @jsx jsx
|
|
8
|
+
*/
|
|
6
9
|
import { forwardRef, Fragment, useCallback } from 'react';
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
12
|
import { jsx } from '@emotion/react';
|
|
8
13
|
import { easeInOut, smallDurationMs } from '@atlaskit/motion';
|
|
9
14
|
import Tooltip from '@atlaskit/tooltip';
|
|
@@ -7,44 +7,44 @@ export interface RatingGroupProps {
|
|
|
7
7
|
*/
|
|
8
8
|
onChange?: (value?: string) => void;
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
* Group name for all of the child rating items.
|
|
11
|
+
* If you have **multiple ratings on the same page make sure to have a unique name** for each group.
|
|
12
|
+
|
|
13
|
+
* Defaults to `"ak--rating-group"`.
|
|
14
|
+
*/
|
|
15
15
|
groupName?: string;
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
* Will set the default checked value for a child radio rating item.
|
|
18
|
+
* Use when wanting to use this in an [uncontrolled way](https://reactjs.org/docs/uncontrolled-components.html).
|
|
19
|
+
|
|
20
|
+
* Do not use with `value`.
|
|
21
|
+
*/
|
|
22
22
|
defaultValue?: string;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
* Value that is used to check a child rating item.
|
|
25
|
+
* Use when wanting to use this in a [controlled way](https://reactjs.org/docs/forms.html#controlled-components).
|
|
26
|
+
|
|
27
|
+
* Do not use with `defaultValue`.
|
|
28
|
+
*/
|
|
29
29
|
value?: string;
|
|
30
30
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
A `testId` prop is provided for specified elements,
|
|
32
|
+
which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
33
|
+
serving as a hook for automated tests.
|
|
34
|
+
|
|
35
|
+
Will set these elements:
|
|
36
|
+
|
|
37
|
+
* The root container `"{testId}--root"`
|
|
38
|
+
* The empty input `"{testId}--input-empty"` which is used to signify "nothing is selected yet".
|
|
39
|
+
*/
|
|
40
40
|
testId?: string;
|
|
41
41
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
* Pass in child rating items.
|
|
43
|
+
* This component expects the markup to be defined in a particular way,
|
|
44
|
+
* so if you pass extra wrapping markup expect undefined behaviour.
|
|
45
|
+
|
|
46
|
+
* You can have any amount of child rating items.
|
|
47
|
+
*/
|
|
48
48
|
children: JSX.Element | JSX.Element[];
|
|
49
49
|
}
|
|
50
50
|
export default function RatingGroup({ groupName, onChange, defaultValue, value, testId, children, }: RatingGroupProps): jsx.JSX.Element;
|
|
@@ -9,32 +9,32 @@ export interface RatingProps {
|
|
|
9
9
|
*/
|
|
10
10
|
label: string;
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
* This is passed to the radio button input.
|
|
13
|
+
|
|
14
|
+
* When using this with the `<Rating />` component this is handled for you.
|
|
15
|
+
*/
|
|
16
16
|
name?: string;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
* Sets checked state on the rating item.
|
|
19
|
+
|
|
20
|
+
* When using this with the `<Rating />` component this is handled for you.
|
|
21
|
+
*/
|
|
22
22
|
isChecked?: boolean;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
A `testId` prop is provided for specified elements,
|
|
25
|
+
which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
26
|
+
serving as a hook for automated tests.
|
|
27
|
+
|
|
28
|
+
Will set two elements:
|
|
29
|
+
|
|
30
|
+
* The label as `"{testId}--label"`
|
|
31
|
+
* The radio button as `"{testId}--input"`
|
|
32
|
+
* The unchecked icon container `"{testId}--icon-container"`
|
|
33
|
+
* The checked icon container `"{testId}--icon-checked-container"`
|
|
34
|
+
|
|
35
|
+
When using this with the `<Rating />` component this will inherit its `testId` as `"{testId}--{index}--{element}"`,
|
|
36
|
+
for example label would be `"{testId}--{index}--label"`.
|
|
37
|
+
*/
|
|
38
38
|
testId?: string;
|
|
39
39
|
/**
|
|
40
40
|
* Value of the rating item.
|
|
@@ -42,19 +42,19 @@ export interface RatingProps {
|
|
|
42
42
|
*/
|
|
43
43
|
value: string;
|
|
44
44
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
* Id that is passed to both the label and the radio button element.
|
|
46
|
+
* This is needed to declare their relationship.
|
|
47
|
+
|
|
48
|
+
* When using this with the `<Rating />` component this is handled for you.
|
|
49
|
+
*/
|
|
50
50
|
id?: string;
|
|
51
51
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
* Handler that is called back whenever the radio button element changes its checked state.
|
|
53
|
+
* When checked will be passed the `value` -
|
|
54
|
+
* when unchecked will be passed `undefined`.
|
|
55
|
+
|
|
56
|
+
* When using this with the `<Rating />` component this is handled for you.
|
|
57
|
+
*/
|
|
58
58
|
onChange?: (value?: string) => void;
|
|
59
59
|
}
|
|
60
60
|
export interface InternalRatingProps extends RatingProps {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RatingProps } from './rating';
|
|
2
|
+
import { type RatingProps } from './rating';
|
|
3
3
|
export interface StarProps extends RatingProps {
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
* Size of the star icon.
|
|
6
|
+
|
|
7
|
+
* Defaults to `"large"`.
|
|
8
|
+
*/
|
|
9
9
|
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
* Color of the star icon,
|
|
12
|
+
* when wanting to customize the color please ensure you use `colors` from `@atlaskit/theme`.
|
|
13
|
+
|
|
14
|
+
* Defaults to `colors.Y200`.
|
|
15
|
+
*/
|
|
16
16
|
color?: string;
|
|
17
17
|
}
|
|
18
18
|
declare const Star: React.ForwardRefExoticComponent<StarProps & React.RefAttributes<HTMLLabelElement>>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export type { RatingGroupProps } from './components/rating-group';
|
|
|
3
3
|
export { default as Star } from './components/star';
|
|
4
4
|
export type { StarProps } from './components/star';
|
|
5
5
|
export { default as Rating } from './components/rating';
|
|
6
|
-
export type { InternalRatingProps, RatingProps, RatingRender
|
|
6
|
+
export type { InternalRatingProps, RatingProps, RatingRender } from './components/rating';
|
|
@@ -7,44 +7,44 @@ export interface RatingGroupProps {
|
|
|
7
7
|
*/
|
|
8
8
|
onChange?: (value?: string) => void;
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
* Group name for all of the child rating items.
|
|
11
|
+
* If you have **multiple ratings on the same page make sure to have a unique name** for each group.
|
|
12
|
+
|
|
13
|
+
* Defaults to `"ak--rating-group"`.
|
|
14
|
+
*/
|
|
15
15
|
groupName?: string;
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
* Will set the default checked value for a child radio rating item.
|
|
18
|
+
* Use when wanting to use this in an [uncontrolled way](https://reactjs.org/docs/uncontrolled-components.html).
|
|
19
|
+
|
|
20
|
+
* Do not use with `value`.
|
|
21
|
+
*/
|
|
22
22
|
defaultValue?: string;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
* Value that is used to check a child rating item.
|
|
25
|
+
* Use when wanting to use this in a [controlled way](https://reactjs.org/docs/forms.html#controlled-components).
|
|
26
|
+
|
|
27
|
+
* Do not use with `defaultValue`.
|
|
28
|
+
*/
|
|
29
29
|
value?: string;
|
|
30
30
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
A `testId` prop is provided for specified elements,
|
|
32
|
+
which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
33
|
+
serving as a hook for automated tests.
|
|
34
|
+
|
|
35
|
+
Will set these elements:
|
|
36
|
+
|
|
37
|
+
* The root container `"{testId}--root"`
|
|
38
|
+
* The empty input `"{testId}--input-empty"` which is used to signify "nothing is selected yet".
|
|
39
|
+
*/
|
|
40
40
|
testId?: string;
|
|
41
41
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
* Pass in child rating items.
|
|
43
|
+
* This component expects the markup to be defined in a particular way,
|
|
44
|
+
* so if you pass extra wrapping markup expect undefined behaviour.
|
|
45
|
+
|
|
46
|
+
* You can have any amount of child rating items.
|
|
47
|
+
*/
|
|
48
48
|
children: JSX.Element | JSX.Element[];
|
|
49
49
|
}
|
|
50
50
|
export default function RatingGroup({ groupName, onChange, defaultValue, value, testId, children, }: RatingGroupProps): jsx.JSX.Element;
|
|
@@ -9,32 +9,32 @@ export interface RatingProps {
|
|
|
9
9
|
*/
|
|
10
10
|
label: string;
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
* This is passed to the radio button input.
|
|
13
|
+
|
|
14
|
+
* When using this with the `<Rating />` component this is handled for you.
|
|
15
|
+
*/
|
|
16
16
|
name?: string;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
* Sets checked state on the rating item.
|
|
19
|
+
|
|
20
|
+
* When using this with the `<Rating />` component this is handled for you.
|
|
21
|
+
*/
|
|
22
22
|
isChecked?: boolean;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
A `testId` prop is provided for specified elements,
|
|
25
|
+
which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
26
|
+
serving as a hook for automated tests.
|
|
27
|
+
|
|
28
|
+
Will set two elements:
|
|
29
|
+
|
|
30
|
+
* The label as `"{testId}--label"`
|
|
31
|
+
* The radio button as `"{testId}--input"`
|
|
32
|
+
* The unchecked icon container `"{testId}--icon-container"`
|
|
33
|
+
* The checked icon container `"{testId}--icon-checked-container"`
|
|
34
|
+
|
|
35
|
+
When using this with the `<Rating />` component this will inherit its `testId` as `"{testId}--{index}--{element}"`,
|
|
36
|
+
for example label would be `"{testId}--{index}--label"`.
|
|
37
|
+
*/
|
|
38
38
|
testId?: string;
|
|
39
39
|
/**
|
|
40
40
|
* Value of the rating item.
|
|
@@ -42,19 +42,19 @@ export interface RatingProps {
|
|
|
42
42
|
*/
|
|
43
43
|
value: string;
|
|
44
44
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
* Id that is passed to both the label and the radio button element.
|
|
46
|
+
* This is needed to declare their relationship.
|
|
47
|
+
|
|
48
|
+
* When using this with the `<Rating />` component this is handled for you.
|
|
49
|
+
*/
|
|
50
50
|
id?: string;
|
|
51
51
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
* Handler that is called back whenever the radio button element changes its checked state.
|
|
53
|
+
* When checked will be passed the `value` -
|
|
54
|
+
* when unchecked will be passed `undefined`.
|
|
55
|
+
|
|
56
|
+
* When using this with the `<Rating />` component this is handled for you.
|
|
57
|
+
*/
|
|
58
58
|
onChange?: (value?: string) => void;
|
|
59
59
|
}
|
|
60
60
|
export interface InternalRatingProps extends RatingProps {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RatingProps } from './rating';
|
|
2
|
+
import { type RatingProps } from './rating';
|
|
3
3
|
export interface StarProps extends RatingProps {
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
* Size of the star icon.
|
|
6
|
+
|
|
7
|
+
* Defaults to `"large"`.
|
|
8
|
+
*/
|
|
9
9
|
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
* Color of the star icon,
|
|
12
|
+
* when wanting to customize the color please ensure you use `colors` from `@atlaskit/theme`.
|
|
13
|
+
|
|
14
|
+
* Defaults to `colors.Y200`.
|
|
15
|
+
*/
|
|
16
16
|
color?: string;
|
|
17
17
|
}
|
|
18
18
|
declare const Star: React.ForwardRefExoticComponent<StarProps & React.RefAttributes<HTMLLabelElement>>;
|
|
@@ -3,4 +3,4 @@ export type { RatingGroupProps } from './components/rating-group';
|
|
|
3
3
|
export { default as Star } from './components/star';
|
|
4
4
|
export type { StarProps } from './components/star';
|
|
5
5
|
export { default as Rating } from './components/rating';
|
|
6
|
-
export type { InternalRatingProps, RatingProps, RatingRender
|
|
6
|
+
export type { InternalRatingProps, RatingProps, RatingRender } from './components/rating';
|