@atlaskit/rating 3.0.3 → 3.0.4
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 +6 -0
- package/dist/cjs/components/rating-group.compiled.css +8 -0
- package/dist/cjs/components/rating-group.js +15 -41
- package/dist/cjs/components/rating.js +12 -12
- package/dist/es2019/components/rating-group.compiled.css +8 -0
- package/dist/es2019/components/rating-group.js +13 -38
- package/dist/es2019/components/rating.js +11 -11
- package/dist/esm/components/rating-group.compiled.css +8 -0
- package/dist/esm/components/rating-group.js +14 -38
- package/dist/esm/components/rating.js +11 -11
- package/dist/types/components/rating-group.d.ts +1 -2
- package/dist/types-ts4.5/components/rating-group.d.ts +1 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
._1e0c116y{display:inline-flex}
|
|
2
|
+
._1luw1o8l:hover [data-rating-icon-checked][data-rating-icon-checked]{display:inline-block}
|
|
3
|
+
._1wybidpf{font-size:0}
|
|
4
|
+
._aut1glyw [data-rating-icon]{display:none}
|
|
5
|
+
._f1xfglyw [data-testid=input-container-checked]~label [data-rating-icon-checked], ._lmyrglyw label:hover~label [data-rating-icon-checked][data-rating-icon-checked]{display:none}
|
|
6
|
+
._lht81o8l [data-testid=input-container-checked]~label [data-rating-icon], ._bw0b1o8l label:hover~label [data-rating-icon][data-rating-icon]{display:inline-block}
|
|
7
|
+
._lxmnglyw:hover [data-rating-icon][data-rating-icon]{display:none}
|
|
8
|
+
._ssb01o8l [data-rating-icon-checked]{display:inline-block}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
+
/* rating-group.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
Object.defineProperty(exports, "__esModule", {
|
|
5
7
|
value: true
|
|
6
8
|
});
|
|
7
9
|
exports.default = RatingGroup;
|
|
10
|
+
require("./rating-group.compiled.css");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
13
|
+
var _runtime = require("@compiled/react/runtime");
|
|
8
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _react2 = require("@emotion/react");
|
|
11
15
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
12
17
|
/* eslint-disable @atlaskit/design-system/use-visually-hidden */
|
|
13
|
-
/**
|
|
14
|
-
* @jsxRuntime classic
|
|
15
|
-
* @jsx jsx
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
18
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
19
|
-
|
|
19
|
+
var styles = {
|
|
20
|
+
container: "_1e0c116y _1wybidpf _ssb01o8l _aut1glyw _f1xfglyw _lmyrglyw _lht81o8l _bw0b1o8l _1luw1o8l _lxmnglyw"
|
|
21
|
+
};
|
|
20
22
|
function RatingGroup(_ref) {
|
|
21
23
|
var _ref$groupName = _ref.groupName,
|
|
22
24
|
groupName = _ref$groupName === void 0 ? 'ak--rating-group' : _ref$groupName,
|
|
@@ -45,44 +47,16 @@ function RatingGroup(_ref) {
|
|
|
45
47
|
// eslint-disable-next-line no-console
|
|
46
48
|
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");
|
|
47
49
|
}
|
|
48
|
-
return
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
49
51
|
"data-testid": testId && "".concat(testId, "--root")
|
|
50
52
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
51
53
|
,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
55
|
-
fontSize: 0,
|
|
56
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
57
|
-
'[data-rating-icon-checked]': {
|
|
58
|
-
display: 'inline-block'
|
|
59
|
-
},
|
|
60
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
61
|
-
'[data-rating-icon]': {
|
|
62
|
-
display: 'none'
|
|
63
|
-
},
|
|
64
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
65
|
-
"label:hover ~ label [data-rating-icon-checked][data-rating-icon-checked], [data-testid='input-container-checked'] ~ label [data-rating-icon-checked]": {
|
|
66
|
-
display: 'none'
|
|
67
|
-
},
|
|
68
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
69
|
-
"label:hover ~ label [data-rating-icon][data-rating-icon], [data-testid='input-container-checked'] ~ label [data-rating-icon]": {
|
|
70
|
-
display: 'inline-block'
|
|
71
|
-
},
|
|
72
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
73
|
-
'&:hover [data-rating-icon-checked][data-rating-icon-checked]': {
|
|
74
|
-
display: 'inline-block'
|
|
75
|
-
},
|
|
76
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
77
|
-
'&:hover [data-rating-icon][data-rating-icon]': {
|
|
78
|
-
display: 'none'
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
}, !firstSelectionMade && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("label", {
|
|
54
|
+
className: (0, _runtime.ax)([styles.container])
|
|
55
|
+
}, !firstSelectionMade && /*#__PURE__*/React.createElement(_react.Fragment, null, /*#__PURE__*/React.createElement("label", {
|
|
82
56
|
htmlFor: "".concat(groupName, "--empty")
|
|
83
|
-
}
|
|
57
|
+
}, "Star Rating"), /*#__PURE__*/React.createElement(_visuallyHidden.default, {
|
|
84
58
|
testId: "input-container".concat(actualValue === undefined ? '-checked' : '')
|
|
85
|
-
},
|
|
59
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
86
60
|
id: "".concat(groupName, "--empty"),
|
|
87
61
|
"data-testid": testId && "".concat(testId, "--input-empty"),
|
|
88
62
|
type: "radio",
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
+
/* rating.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
Object.defineProperty(exports, "__esModule", {
|
|
5
7
|
value: true
|
|
6
8
|
});
|
|
7
9
|
exports.default = void 0;
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var React = _react;
|
|
12
|
+
var _runtime = require("@compiled/react/runtime");
|
|
8
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
var _react2 = require("@emotion/react");
|
|
12
15
|
var _motion = require("@atlaskit/motion");
|
|
13
16
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
14
17
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
15
18
|
var _excluded = ["isChecked", "name", "testId", "label", "id", "value", "onChange", "render"];
|
|
16
19
|
/* eslint-disable @atlaskit/design-system/use-visually-hidden */
|
|
17
|
-
/**
|
|
18
|
-
* @jsxRuntime classic
|
|
19
|
-
* @jsx jsx
|
|
20
|
-
*/
|
|
21
20
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
21
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
22
22
|
var Rating = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
23
23
|
var isChecked = _ref.isChecked,
|
|
24
24
|
name = _ref.name,
|
|
@@ -32,7 +32,7 @@ var Rating = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
32
32
|
var onChangeHandler = (0, _react.useCallback)(function (e) {
|
|
33
33
|
onChange && onChange(e.target.checked ? value : undefined);
|
|
34
34
|
}, [onChange, value]);
|
|
35
|
-
return
|
|
35
|
+
return /*#__PURE__*/React.createElement(_react.Fragment, null, /*#__PURE__*/React.createElement("label", (0, _extends2.default)({}, props, {
|
|
36
36
|
ref: ref,
|
|
37
37
|
htmlFor: id,
|
|
38
38
|
"data-testid": testId && "".concat(testId, "--label"),
|
|
@@ -41,25 +41,25 @@ var Rating = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
41
41
|
transition: "transform ".concat(_motion.durations.small, "ms ").concat(_motion.easeInOut),
|
|
42
42
|
transform: isChecked ? 'scale(1.2)' : undefined
|
|
43
43
|
}
|
|
44
|
-
}),
|
|
44
|
+
}), /*#__PURE__*/React.createElement(_tooltip.default, {
|
|
45
45
|
testId: testId && "".concat(testId, "--tooltip"),
|
|
46
46
|
content: label,
|
|
47
47
|
delay: 10
|
|
48
|
-
},
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_visuallyHidden.default, null, label), /*#__PURE__*/React.createElement("span", {
|
|
49
49
|
"aria-hidden": "true",
|
|
50
50
|
"data-rating-icon": true,
|
|
51
51
|
"data-testid": testId && "".concat(testId, "--icon-container")
|
|
52
52
|
}, render({
|
|
53
53
|
isChecked: false
|
|
54
|
-
})),
|
|
54
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
55
55
|
"aria-hidden": "true",
|
|
56
56
|
"data-rating-icon-checked": true,
|
|
57
57
|
"data-testid": testId && "".concat(testId, "--icon-checked-container")
|
|
58
58
|
}, render({
|
|
59
59
|
isChecked: true
|
|
60
|
-
}))))),
|
|
60
|
+
}))))), /*#__PURE__*/React.createElement(_visuallyHidden.default, {
|
|
61
61
|
testId: "input-container".concat(!!isChecked ? '-checked' : '')
|
|
62
|
-
},
|
|
62
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
63
63
|
id: id,
|
|
64
64
|
onChange: onChangeHandler,
|
|
65
65
|
checked: !!isChecked,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
._1e0c116y{display:inline-flex}
|
|
2
|
+
._1luw1o8l:hover [data-rating-icon-checked][data-rating-icon-checked]{display:inline-block}
|
|
3
|
+
._1wybidpf{font-size:0}
|
|
4
|
+
._aut1glyw [data-rating-icon]{display:none}
|
|
5
|
+
._f1xfglyw [data-testid=input-container-checked]~label [data-rating-icon-checked], ._lmyrglyw label:hover~label [data-rating-icon-checked][data-rating-icon-checked]{display:none}
|
|
6
|
+
._lht81o8l [data-testid=input-container-checked]~label [data-rating-icon], ._bw0b1o8l label:hover~label [data-rating-icon][data-rating-icon]{display:inline-block}
|
|
7
|
+
._lxmnglyw:hover [data-rating-icon][data-rating-icon]{display:none}
|
|
8
|
+
._ssb01o8l [data-rating-icon-checked]{display:inline-block}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
/* rating-group.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
/* eslint-disable @atlaskit/design-system/use-visually-hidden */
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
*/
|
|
3
|
+
import "./rating-group.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { Children, cloneElement, Fragment, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
11
|
+
const styles = {
|
|
12
|
+
container: "_1e0c116y _1wybidpf _ssb01o8l _aut1glyw _f1xfglyw _lmyrglyw _lht81o8l _bw0b1o8l _1luw1o8l _lxmnglyw"
|
|
13
|
+
};
|
|
11
14
|
export default function RatingGroup({
|
|
12
15
|
groupName = 'ak--rating-group',
|
|
13
16
|
onChange,
|
|
@@ -33,44 +36,16 @@ Don't use "defaultValue" with "value" you're trying to mix uncontrolled and cont
|
|
|
33
36
|
Use "defaultValue" or "value" happy days :-).
|
|
34
37
|
`);
|
|
35
38
|
}
|
|
36
|
-
return
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
37
40
|
"data-testid": testId && `${testId}--root`
|
|
38
41
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
39
42
|
,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
43
|
-
fontSize: 0,
|
|
44
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
45
|
-
'[data-rating-icon-checked]': {
|
|
46
|
-
display: 'inline-block'
|
|
47
|
-
},
|
|
48
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
49
|
-
'[data-rating-icon]': {
|
|
50
|
-
display: 'none'
|
|
51
|
-
},
|
|
52
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
53
|
-
"label:hover ~ label [data-rating-icon-checked][data-rating-icon-checked], [data-testid='input-container-checked'] ~ label [data-rating-icon-checked]": {
|
|
54
|
-
display: 'none'
|
|
55
|
-
},
|
|
56
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
57
|
-
"label:hover ~ label [data-rating-icon][data-rating-icon], [data-testid='input-container-checked'] ~ label [data-rating-icon]": {
|
|
58
|
-
display: 'inline-block'
|
|
59
|
-
},
|
|
60
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
61
|
-
'&:hover [data-rating-icon-checked][data-rating-icon-checked]': {
|
|
62
|
-
display: 'inline-block'
|
|
63
|
-
},
|
|
64
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
65
|
-
'&:hover [data-rating-icon][data-rating-icon]': {
|
|
66
|
-
display: 'none'
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
}, !firstSelectionMade && jsx(Fragment, null, jsx("label", {
|
|
43
|
+
className: ax([styles.container])
|
|
44
|
+
}, !firstSelectionMade && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("label", {
|
|
70
45
|
htmlFor: `${groupName}--empty`
|
|
71
|
-
}),
|
|
46
|
+
}, "Star Rating"), /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
72
47
|
testId: `input-container${actualValue === undefined ? '-checked' : ''}`
|
|
73
|
-
},
|
|
48
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
74
49
|
id: `${groupName}--empty`,
|
|
75
50
|
"data-testid": testId && `${testId}--input-empty`,
|
|
76
51
|
type: "radio",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
/* rating.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
2
5
|
/* eslint-disable @atlaskit/design-system/use-visually-hidden */
|
|
3
|
-
|
|
4
|
-
* @jsxRuntime classic
|
|
5
|
-
* @jsx jsx
|
|
6
|
-
*/
|
|
6
|
+
|
|
7
7
|
import { forwardRef, Fragment, useCallback } from 'react';
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
import { durations, easeInOut } from '@atlaskit/motion';
|
|
12
12
|
import Tooltip from '@atlaskit/tooltip';
|
|
13
13
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
@@ -25,7 +25,7 @@ const Rating = /*#__PURE__*/forwardRef(({
|
|
|
25
25
|
const onChangeHandler = useCallback(e => {
|
|
26
26
|
onChange && onChange(e.target.checked ? value : undefined);
|
|
27
27
|
}, [onChange, value]);
|
|
28
|
-
return
|
|
28
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("label", _extends({}, props, {
|
|
29
29
|
ref: ref,
|
|
30
30
|
htmlFor: id,
|
|
31
31
|
"data-testid": testId && `${testId}--label`,
|
|
@@ -34,25 +34,25 @@ const Rating = /*#__PURE__*/forwardRef(({
|
|
|
34
34
|
transition: `transform ${durations.small}ms ${easeInOut}`,
|
|
35
35
|
transform: isChecked ? 'scale(1.2)' : undefined
|
|
36
36
|
}
|
|
37
|
-
}),
|
|
37
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
38
38
|
testId: testId && `${testId}--tooltip`,
|
|
39
39
|
content: label,
|
|
40
40
|
delay: 10
|
|
41
|
-
},
|
|
41
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(VisuallyHidden, null, label), /*#__PURE__*/React.createElement("span", {
|
|
42
42
|
"aria-hidden": "true",
|
|
43
43
|
"data-rating-icon": true,
|
|
44
44
|
"data-testid": testId && `${testId}--icon-container`
|
|
45
45
|
}, render({
|
|
46
46
|
isChecked: false
|
|
47
|
-
})),
|
|
47
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
48
48
|
"aria-hidden": "true",
|
|
49
49
|
"data-rating-icon-checked": true,
|
|
50
50
|
"data-testid": testId && `${testId}--icon-checked-container`
|
|
51
51
|
}, render({
|
|
52
52
|
isChecked: true
|
|
53
|
-
}))))),
|
|
53
|
+
}))))), /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
54
54
|
testId: `input-container${!!isChecked ? '-checked' : ''}`
|
|
55
|
-
},
|
|
55
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
56
56
|
id: id,
|
|
57
57
|
onChange: onChangeHandler,
|
|
58
58
|
checked: !!isChecked,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
._1e0c116y{display:inline-flex}
|
|
2
|
+
._1luw1o8l:hover [data-rating-icon-checked][data-rating-icon-checked]{display:inline-block}
|
|
3
|
+
._1wybidpf{font-size:0}
|
|
4
|
+
._aut1glyw [data-rating-icon]{display:none}
|
|
5
|
+
._f1xfglyw [data-testid=input-container-checked]~label [data-rating-icon-checked], ._lmyrglyw label:hover~label [data-rating-icon-checked][data-rating-icon-checked]{display:none}
|
|
6
|
+
._lht81o8l [data-testid=input-container-checked]~label [data-rating-icon], ._bw0b1o8l label:hover~label [data-rating-icon][data-rating-icon]{display:inline-block}
|
|
7
|
+
._lxmnglyw:hover [data-rating-icon][data-rating-icon]{display:none}
|
|
8
|
+
._ssb01o8l [data-rating-icon-checked]{display:inline-block}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
/* rating-group.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import "./rating-group.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
2
6
|
/* eslint-disable @atlaskit/design-system/use-visually-hidden */
|
|
3
|
-
|
|
4
|
-
* @jsxRuntime classic
|
|
5
|
-
* @jsx jsx
|
|
6
|
-
*/
|
|
7
|
+
|
|
7
8
|
import { Children, cloneElement, Fragment, useState } from 'react';
|
|
8
9
|
|
|
9
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
|
-
|
|
11
|
+
|
|
11
12
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
13
|
+
var styles = {
|
|
14
|
+
container: "_1e0c116y _1wybidpf _ssb01o8l _aut1glyw _f1xfglyw _lmyrglyw _lht81o8l _bw0b1o8l _1luw1o8l _lxmnglyw"
|
|
15
|
+
};
|
|
12
16
|
export default function RatingGroup(_ref) {
|
|
13
17
|
var _ref$groupName = _ref.groupName,
|
|
14
18
|
groupName = _ref$groupName === void 0 ? 'ak--rating-group' : _ref$groupName,
|
|
@@ -37,44 +41,16 @@ export default function RatingGroup(_ref) {
|
|
|
37
41
|
// eslint-disable-next-line no-console
|
|
38
42
|
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");
|
|
39
43
|
}
|
|
40
|
-
return
|
|
44
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
41
45
|
"data-testid": testId && "".concat(testId, "--root")
|
|
42
46
|
// 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
47
|
,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
47
|
-
fontSize: 0,
|
|
48
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
49
|
-
'[data-rating-icon-checked]': {
|
|
50
|
-
display: 'inline-block'
|
|
51
|
-
},
|
|
52
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
53
|
-
'[data-rating-icon]': {
|
|
54
|
-
display: 'none'
|
|
55
|
-
},
|
|
56
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
57
|
-
"label:hover ~ label [data-rating-icon-checked][data-rating-icon-checked], [data-testid='input-container-checked'] ~ label [data-rating-icon-checked]": {
|
|
58
|
-
display: 'none'
|
|
59
|
-
},
|
|
60
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
61
|
-
"label:hover ~ label [data-rating-icon][data-rating-icon], [data-testid='input-container-checked'] ~ label [data-rating-icon]": {
|
|
62
|
-
display: 'inline-block'
|
|
63
|
-
},
|
|
64
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
65
|
-
'&:hover [data-rating-icon-checked][data-rating-icon-checked]': {
|
|
66
|
-
display: 'inline-block'
|
|
67
|
-
},
|
|
68
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
69
|
-
'&:hover [data-rating-icon][data-rating-icon]': {
|
|
70
|
-
display: 'none'
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
}, !firstSelectionMade && jsx(Fragment, null, jsx("label", {
|
|
48
|
+
className: ax([styles.container])
|
|
49
|
+
}, !firstSelectionMade && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("label", {
|
|
74
50
|
htmlFor: "".concat(groupName, "--empty")
|
|
75
|
-
}),
|
|
51
|
+
}, "Star Rating"), /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
76
52
|
testId: "input-container".concat(actualValue === undefined ? '-checked' : '')
|
|
77
|
-
},
|
|
53
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
78
54
|
id: "".concat(groupName, "--empty"),
|
|
79
55
|
"data-testid": testId && "".concat(testId, "--input-empty"),
|
|
80
56
|
type: "radio",
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
/* rating.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
4
|
var _excluded = ["isChecked", "name", "testId", "label", "id", "value", "onChange", "render"];
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
7
|
/* eslint-disable @atlaskit/design-system/use-visually-hidden */
|
|
5
|
-
|
|
6
|
-
* @jsxRuntime classic
|
|
7
|
-
* @jsx jsx
|
|
8
|
-
*/
|
|
8
|
+
|
|
9
9
|
import { forwardRef, Fragment, useCallback } from 'react';
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
import { durations, easeInOut } from '@atlaskit/motion';
|
|
14
14
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
15
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
@@ -26,7 +26,7 @@ var Rating = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
26
26
|
var onChangeHandler = useCallback(function (e) {
|
|
27
27
|
onChange && onChange(e.target.checked ? value : undefined);
|
|
28
28
|
}, [onChange, value]);
|
|
29
|
-
return
|
|
29
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("label", _extends({}, props, {
|
|
30
30
|
ref: ref,
|
|
31
31
|
htmlFor: id,
|
|
32
32
|
"data-testid": testId && "".concat(testId, "--label"),
|
|
@@ -35,25 +35,25 @@ var Rating = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
35
35
|
transition: "transform ".concat(durations.small, "ms ").concat(easeInOut),
|
|
36
36
|
transform: isChecked ? 'scale(1.2)' : undefined
|
|
37
37
|
}
|
|
38
|
-
}),
|
|
38
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
39
39
|
testId: testId && "".concat(testId, "--tooltip"),
|
|
40
40
|
content: label,
|
|
41
41
|
delay: 10
|
|
42
|
-
},
|
|
42
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(VisuallyHidden, null, label), /*#__PURE__*/React.createElement("span", {
|
|
43
43
|
"aria-hidden": "true",
|
|
44
44
|
"data-rating-icon": true,
|
|
45
45
|
"data-testid": testId && "".concat(testId, "--icon-container")
|
|
46
46
|
}, render({
|
|
47
47
|
isChecked: false
|
|
48
|
-
})),
|
|
48
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
49
49
|
"aria-hidden": "true",
|
|
50
50
|
"data-rating-icon-checked": true,
|
|
51
51
|
"data-testid": testId && "".concat(testId, "--icon-checked-container")
|
|
52
52
|
}, render({
|
|
53
53
|
isChecked: true
|
|
54
|
-
}))))),
|
|
54
|
+
}))))), /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
55
55
|
testId: "input-container".concat(!!isChecked ? '-checked' : '')
|
|
56
|
-
},
|
|
56
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
57
57
|
id: id,
|
|
58
58
|
onChange: onChangeHandler,
|
|
59
59
|
checked: !!isChecked,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
2
|
export interface RatingGroupProps {
|
|
4
3
|
/**
|
|
5
4
|
* Callback that is called everytime the rating changes.
|
|
@@ -47,4 +46,4 @@ export interface RatingGroupProps {
|
|
|
47
46
|
*/
|
|
48
47
|
children: JSX.Element | JSX.Element[];
|
|
49
48
|
}
|
|
50
|
-
export default function RatingGroup({ groupName, onChange, defaultValue, value, testId, children, }: RatingGroupProps):
|
|
49
|
+
export default function RatingGroup({ groupName, onChange, defaultValue, value, testId, children, }: RatingGroupProps): JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
2
|
export interface RatingGroupProps {
|
|
4
3
|
/**
|
|
5
4
|
* Callback that is called everytime the rating changes.
|
|
@@ -47,4 +46,4 @@ export interface RatingGroupProps {
|
|
|
47
46
|
*/
|
|
48
47
|
children: JSX.Element | JSX.Element[];
|
|
49
48
|
}
|
|
50
|
-
export default function RatingGroup({ groupName, onChange, defaultValue, value, testId, children, }: RatingGroupProps):
|
|
49
|
+
export default function RatingGroup({ groupName, onChange, defaultValue, value, testId, children, }: RatingGroupProps): JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/rating",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "An accessible rating component that can be heavily customized.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"runReact18": true
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/icon": "^
|
|
35
|
+
"@atlaskit/icon": "^27.0.0",
|
|
36
36
|
"@atlaskit/motion": "^5.1.0",
|
|
37
37
|
"@atlaskit/theme": "^18.0.0",
|
|
38
|
-
"@atlaskit/tokens": "^5.
|
|
39
|
-
"@atlaskit/tooltip": "^20.
|
|
38
|
+
"@atlaskit/tokens": "^5.2.0",
|
|
39
|
+
"@atlaskit/tooltip": "^20.3.0",
|
|
40
40
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
|
-
"@
|
|
42
|
+
"@compiled/react": "^0.18.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": "^18.2.0",
|