@atlaskit/rating 0.2.50 → 0.2.52
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 +12 -0
- package/dist/cjs/components/rating-group.js +5 -5
- package/dist/cjs/components/rating.js +7 -7
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/rating-group.js +1 -1
- package/dist/es2019/components/rating.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/rating-group.js +1 -1
- package/dist/esm/components/rating.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/components/rating-group.d.ts +2 -1
- package/package.json +3 -11
- package/dist/types-ts4.0/components/rating-group.d.ts +0 -49
- package/dist/types-ts4.0/components/rating.d.ts +0 -68
- package/dist/types-ts4.0/components/star.d.ts +0 -19
- package/dist/types-ts4.0/extract-react-types/rating.d.ts +0 -5
- package/dist/types-ts4.0/extract-react-types/star.d.ts +0 -5
- package/dist/types-ts4.0/index.d.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/rating
|
|
2
2
|
|
|
3
|
+
## 0.2.52
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 0.2.51
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`016d3039482`](https://bitbucket.org/atlassian/atlassian-frontend/commits/016d3039482) - Updates `@emotion/core` v10 to `@emotion/react` v11. There is no expected behavior change.
|
|
14
|
+
|
|
3
15
|
## 0.2.50
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -13,7 +13,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
13
|
|
|
14
14
|
var _react = require("react");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _react2 = require("@emotion/react");
|
|
17
17
|
|
|
18
18
|
var _constants = require("@atlaskit/theme/constants");
|
|
19
19
|
|
|
@@ -54,13 +54,13 @@ function RatingGroup(_ref) {
|
|
|
54
54
|
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");
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
return (0,
|
|
57
|
+
return (0, _react2.jsx)("div", {
|
|
58
58
|
"data-testid": testId && "".concat(testId, "--root"),
|
|
59
|
-
css: (0,
|
|
60
|
-
}, !firstSelectionMade && (0,
|
|
59
|
+
css: (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: inline-flex;\n /* Because some children are inline-block we make the font-size zero to eliminate the implicit space between them. */\n font-size: 0;\n\n /* This implementation does some interesting tricks to keep it flowing LTR and ensuring accessibility. */\n /* Instead of it starting in an empty state - it starts filled - and then uses the CSS sibling select \"~\" */\n /* to then display the empty state for the star rating. */\n\n [data-rating-icon-checked] {\n display: inline-block;\n }\n\n [data-rating-icon] {\n display: none;\n }\n\n label:hover\n ~ label\n [data-rating-icon-checked][data-rating-icon-checked],\n input:checked ~ label [data-rating-icon-checked] {\n display: none;\n }\n\n label:hover ~ label [data-rating-icon][data-rating-icon],\n input:checked ~ label [data-rating-icon] {\n display: inline-block;\n }\n\n /* When hovering reset all elements back to filled state. */\n &:hover [data-rating-icon-checked][data-rating-icon-checked] {\n display: inline-block;\n }\n\n &:hover [data-rating-icon][data-rating-icon] {\n display: none;\n }\n "])))
|
|
60
|
+
}, !firstSelectionMade && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("label", {
|
|
61
61
|
css: _constants.visuallyHidden,
|
|
62
62
|
htmlFor: "".concat(groupName, "--empty")
|
|
63
|
-
}), (0,
|
|
63
|
+
}), (0, _react2.jsx)("input", {
|
|
64
64
|
css: _constants.visuallyHidden,
|
|
65
65
|
id: "".concat(groupName, "--empty"),
|
|
66
66
|
"data-testid": testId && "".concat(testId, "--input-empty"),
|
|
@@ -13,7 +13,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
13
13
|
|
|
14
14
|
var _react = require("react");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _react2 = require("@emotion/react");
|
|
17
17
|
|
|
18
18
|
var _motion = require("@atlaskit/motion");
|
|
19
19
|
|
|
@@ -35,7 +35,7 @@ var Rating = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
35
35
|
var onChangeHandler = (0, _react.useCallback)(function (e) {
|
|
36
36
|
onChange && onChange(e.target.checked ? value : undefined);
|
|
37
37
|
}, [onChange, value]);
|
|
38
|
-
return (0,
|
|
38
|
+
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("label", (0, _extends2.default)({}, props, {
|
|
39
39
|
ref: ref,
|
|
40
40
|
htmlFor: id,
|
|
41
41
|
"data-testid": testId && "".concat(testId, "--label"),
|
|
@@ -43,25 +43,25 @@ var Rating = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
43
43
|
transition: "transform ".concat(_motion.smallDurationMs, "ms ").concat(_motion.easeInOut),
|
|
44
44
|
transform: isChecked ? 'scale(1.2)' : undefined
|
|
45
45
|
}
|
|
46
|
-
}), (0,
|
|
46
|
+
}), (0, _react2.jsx)(_tooltip.default, {
|
|
47
47
|
testId: testId && "".concat(testId, "--tooltip"),
|
|
48
48
|
content: label,
|
|
49
49
|
delay: 10
|
|
50
|
-
}, (0,
|
|
50
|
+
}, (0, _react2.jsx)("div", null, (0, _react2.jsx)("span", {
|
|
51
51
|
css: _constants.visuallyHidden
|
|
52
|
-
}, label), (0,
|
|
52
|
+
}, label), (0, _react2.jsx)("span", {
|
|
53
53
|
"aria-hidden": "true",
|
|
54
54
|
"data-rating-icon": true,
|
|
55
55
|
"data-testid": testId && "".concat(testId, "--icon-container")
|
|
56
56
|
}, render({
|
|
57
57
|
isChecked: false
|
|
58
|
-
})), (0,
|
|
58
|
+
})), (0, _react2.jsx)("span", {
|
|
59
59
|
"aria-hidden": "true",
|
|
60
60
|
"data-rating-icon-checked": true,
|
|
61
61
|
"data-testid": testId && "".concat(testId, "--icon-checked-container")
|
|
62
62
|
}, render({
|
|
63
63
|
isChecked: true
|
|
64
|
-
}))))), (0,
|
|
64
|
+
}))))), (0, _react2.jsx)("input", {
|
|
65
65
|
id: id,
|
|
66
66
|
css: _constants.visuallyHidden,
|
|
67
67
|
onChange: onChangeHandler,
|
package/dist/cjs/version.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { Children, cloneElement, Fragment, useState } from 'react';
|
|
5
|
-
import { css, jsx } from '@emotion/
|
|
5
|
+
import { css, jsx } from '@emotion/react'; // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
|
|
6
6
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
7
7
|
|
|
8
8
|
import { visuallyHidden } from '@atlaskit/theme/constants';
|
|
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
|
|
5
5
|
/** @jsx jsx */
|
|
6
6
|
import { forwardRef, Fragment, useCallback } from 'react';
|
|
7
|
-
import { jsx } from '@emotion/
|
|
7
|
+
import { jsx } from '@emotion/react';
|
|
8
8
|
import { easeInOut, smallDurationMs } from '@atlaskit/motion'; // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
|
|
9
9
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
10
10
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -7,7 +7,7 @@ var _templateObject;
|
|
|
7
7
|
|
|
8
8
|
/** @jsx jsx */
|
|
9
9
|
import { Children, cloneElement, Fragment, useState } from 'react';
|
|
10
|
-
import { css, jsx } from '@emotion/
|
|
10
|
+
import { css, jsx } from '@emotion/react'; // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
|
|
11
11
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
12
12
|
|
|
13
13
|
import { visuallyHidden } from '@atlaskit/theme/constants';
|
|
@@ -6,7 +6,7 @@ var _excluded = ["isChecked", "name", "testId", "label", "id", "value", "onChang
|
|
|
6
6
|
|
|
7
7
|
/** @jsx jsx */
|
|
8
8
|
import { forwardRef, Fragment, useCallback } from 'react';
|
|
9
|
-
import { jsx } from '@emotion/
|
|
9
|
+
import { jsx } from '@emotion/react';
|
|
10
10
|
import { easeInOut, smallDurationMs } from '@atlaskit/motion'; // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
|
|
11
11
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
12
12
|
|
package/dist/esm/version.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
2
3
|
export interface RatingGroupProps {
|
|
3
4
|
/**
|
|
4
5
|
* Callback that is called everytime the rating changes.
|
|
@@ -46,4 +47,4 @@ export interface RatingGroupProps {
|
|
|
46
47
|
*/
|
|
47
48
|
children: JSX.Element | JSX.Element[];
|
|
48
49
|
}
|
|
49
|
-
export default function RatingGroup({ groupName, onChange, defaultValue, value, testId, children, }: RatingGroupProps): JSX.Element;
|
|
50
|
+
export default function RatingGroup({ groupName, onChange, defaultValue, value, testId, children, }: RatingGroupProps): jsx.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/rating",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.52",
|
|
4
4
|
"description": "An accessible rating component that can be heavily customized.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,14 +12,6 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
-
"typesVersions": {
|
|
16
|
-
">=4.0 <4.5": {
|
|
17
|
-
"*": [
|
|
18
|
-
"dist/types-ts4.0/*",
|
|
19
|
-
"dist/types-ts4.0/index.d.ts"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
15
|
"sideEffects": false,
|
|
24
16
|
"atlaskit:src": "src/index.tsx",
|
|
25
17
|
"atlassian": {
|
|
@@ -34,10 +26,10 @@
|
|
|
34
26
|
"@atlaskit/icon": "^21.11.0",
|
|
35
27
|
"@atlaskit/motion": "^1.3.0",
|
|
36
28
|
"@atlaskit/theme": "^12.2.0",
|
|
37
|
-
"@atlaskit/tokens": "0.
|
|
29
|
+
"@atlaskit/tokens": "0.11.0",
|
|
38
30
|
"@atlaskit/tooltip": "^17.6.0",
|
|
39
31
|
"@babel/runtime": "^7.0.0",
|
|
40
|
-
"@emotion/
|
|
32
|
+
"@emotion/react": "^11.7.1"
|
|
41
33
|
},
|
|
42
34
|
"peerDependencies": {
|
|
43
35
|
"react": "^16.8.0",
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export interface RatingGroupProps {
|
|
3
|
-
/**
|
|
4
|
-
* Callback that is called everytime the rating changes.
|
|
5
|
-
* Use this in conjunction with `value` for [controlled behaviour](https://reactjs.org/docs/forms.html#controlled-components).
|
|
6
|
-
*/
|
|
7
|
-
onChange?: (value?: string) => void;
|
|
8
|
-
/**
|
|
9
|
-
* Group name for all of the child rating items.
|
|
10
|
-
* If you have **multiple ratings on the same page make sure to have a unique name** for each group.
|
|
11
|
-
|
|
12
|
-
* Defaults to `"ak--rating-group"`.
|
|
13
|
-
*/
|
|
14
|
-
groupName?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Will set the default checked value for a child radio rating item.
|
|
17
|
-
* Use when wanting to use this in an [uncontrolled way](https://reactjs.org/docs/uncontrolled-components.html).
|
|
18
|
-
|
|
19
|
-
* Do not use with `value`.
|
|
20
|
-
*/
|
|
21
|
-
defaultValue?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Value that is used to check a child rating item.
|
|
24
|
-
* Use when wanting to use this in a [controlled way](https://reactjs.org/docs/forms.html#controlled-components).
|
|
25
|
-
|
|
26
|
-
* Do not use with `defaultValue`.
|
|
27
|
-
*/
|
|
28
|
-
value?: string;
|
|
29
|
-
/**
|
|
30
|
-
A `testId` prop is provided for specified elements,
|
|
31
|
-
which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
32
|
-
serving as a hook for automated tests.
|
|
33
|
-
|
|
34
|
-
Will set these elements:
|
|
35
|
-
|
|
36
|
-
* The root container `"{testId}--root"`
|
|
37
|
-
* The empty input `"{testId}--input-empty"` which is used to signify "nothing is selected yet".
|
|
38
|
-
*/
|
|
39
|
-
testId?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Pass in child rating items.
|
|
42
|
-
* This component expects the markup to be defined in a particular way,
|
|
43
|
-
* so if you pass extra wrapping markup expect undefined behaviour.
|
|
44
|
-
|
|
45
|
-
* You can have any amount of child rating items.
|
|
46
|
-
*/
|
|
47
|
-
children: JSX.Element | JSX.Element[];
|
|
48
|
-
}
|
|
49
|
-
export default function RatingGroup({ groupName, onChange, defaultValue, value, testId, children, }: RatingGroupProps): JSX.Element;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare type RatingRender = (props: {
|
|
3
|
-
isChecked: boolean;
|
|
4
|
-
}) => React.ReactNode;
|
|
5
|
-
export interface RatingProps {
|
|
6
|
-
/**
|
|
7
|
-
* Label for the rating item.
|
|
8
|
-
* This will be read by screen readers as well as used in the tooltip when hovering over the item.
|
|
9
|
-
*/
|
|
10
|
-
label: string;
|
|
11
|
-
/**
|
|
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
|
-
name?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Sets checked state on the rating item.
|
|
19
|
-
|
|
20
|
-
* When using this with the `<Rating />` component this is handled for you.
|
|
21
|
-
*/
|
|
22
|
-
isChecked?: boolean;
|
|
23
|
-
/**
|
|
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
|
-
testId?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Value of the rating item.
|
|
41
|
-
* This will be passed back in the `onChange()` handler when checked.
|
|
42
|
-
*/
|
|
43
|
-
value: string;
|
|
44
|
-
/**
|
|
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
|
-
id?: string;
|
|
51
|
-
/**
|
|
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
|
-
onChange?: (value?: string) => void;
|
|
59
|
-
}
|
|
60
|
-
export interface InternalRatingProps extends RatingProps {
|
|
61
|
-
/**
|
|
62
|
-
* Render callback that should return a ReactNode.
|
|
63
|
-
* Is passed an argument which is an object with one property `isChecked`.
|
|
64
|
-
*/
|
|
65
|
-
render: RatingRender;
|
|
66
|
-
}
|
|
67
|
-
declare const Rating: import("react").ForwardRefExoticComponent<InternalRatingProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
68
|
-
export default Rating;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { RatingProps } from './rating';
|
|
3
|
-
export interface StarProps extends RatingProps {
|
|
4
|
-
/**
|
|
5
|
-
* Size of the star icon.
|
|
6
|
-
|
|
7
|
-
* Defaults to `"large"`.
|
|
8
|
-
*/
|
|
9
|
-
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
10
|
-
/**
|
|
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
|
-
color?: string;
|
|
17
|
-
}
|
|
18
|
-
declare const Star: React.ForwardRefExoticComponent<StarProps & React.RefAttributes<HTMLLabelElement>>;
|
|
19
|
-
export default Star;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as RatingGroup } from './components/rating-group';
|
|
2
|
-
export type { RatingGroupProps } from './components/rating-group';
|
|
3
|
-
export { default as Star } from './components/star';
|
|
4
|
-
export type { StarProps } from './components/star';
|
|
5
|
-
export { default as Rating } from './components/rating';
|
|
6
|
-
export type { InternalRatingProps, RatingProps, RatingRender, } from './components/rating';
|