@atlaskit/rating 0.3.9 → 0.3.11

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/rating
2
2
 
3
+ ## 0.3.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f88d0921a57`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f88d0921a57) - Fix deprecated import from @atlaskit/theme for "Dev Portal"
8
+
9
+ ## 0.3.10
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 0.3.9
4
16
 
5
17
  ### Patch Changes
@@ -9,12 +9,10 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = require("react");
11
11
  var _react2 = require("@emotion/react");
12
- var _constants = require("@atlaskit/theme/constants");
12
+ var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
13
13
  var _templateObject;
14
14
  /* eslint-disable @atlaskit/design-system/use-visually-hidden */
15
15
  /** @jsx jsx */
16
- // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
17
- // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
18
16
  function RatingGroup(_ref) {
19
17
  var _ref$groupName = _ref.groupName,
20
18
  groupName = _ref$groupName === void 0 ? 'ak--rating-group' : _ref$groupName,
@@ -45,12 +43,12 @@ function RatingGroup(_ref) {
45
43
  }
46
44
  return (0, _react2.jsx)("div", {
47
45
  "data-testid": testId && "".concat(testId, "--root"),
48
- 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 "])))
46
+ 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 // By default, filled in icon is shown\n [data-rating-icon-checked] {\n display: inline-block;\n }\n\n // By default, empty icon is NOT shown\n [data-rating-icon] {\n display: none;\n }\n\n label:hover\n ~ label\n [data-rating-icon-checked][data-rating-icon-checked],\n [data-testid='input-container-checked']\n ~ label\n [data-rating-icon-checked] {\n display: none;\n }\n\n label:hover ~ label [data-rating-icon][data-rating-icon],\n [data-testid='input-container-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 "])))
49
47
  }, !firstSelectionMade && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("label", {
50
- css: _constants.visuallyHidden,
51
48
  htmlFor: "".concat(groupName, "--empty")
52
- }), (0, _react2.jsx)("input", {
53
- css: _constants.visuallyHidden,
49
+ }), (0, _react2.jsx)(_visuallyHidden.default, {
50
+ testId: "input-container".concat(actualValue === undefined ? '-checked' : '')
51
+ }, (0, _react2.jsx)("input", {
54
52
  id: "".concat(groupName, "--empty"),
55
53
  "data-testid": testId && "".concat(testId, "--input-empty"),
56
54
  type: "radio",
@@ -60,7 +58,7 @@ function RatingGroup(_ref) {
60
58
  return setValue(undefined);
61
59
  },
62
60
  value: undefined
63
- })), _react.Children.map(children, function (child, index) {
61
+ }))), _react.Children.map(children, function (child, index) {
64
62
  return /*#__PURE__*/(0, _react.cloneElement)(child, {
65
63
  onChange: onChangeHandler,
66
64
  name: groupName,
@@ -10,13 +10,11 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
10
10
  var _react = require("react");
11
11
  var _react2 = require("@emotion/react");
12
12
  var _motion = require("@atlaskit/motion");
13
- var _constants = require("@atlaskit/theme/constants");
14
13
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
14
+ var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
15
15
  var _excluded = ["isChecked", "name", "testId", "label", "id", "value", "onChange", "render"];
16
16
  /* eslint-disable @atlaskit/design-system/use-visually-hidden */
17
17
  /** @jsx jsx */
18
- // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
19
- // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
20
18
  var Rating = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
21
19
  var isChecked = _ref.isChecked,
22
20
  name = _ref.name,
@@ -42,9 +40,7 @@ var Rating = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
42
40
  testId: testId && "".concat(testId, "--tooltip"),
43
41
  content: label,
44
42
  delay: 10
45
- }, (0, _react2.jsx)("div", null, (0, _react2.jsx)("span", {
46
- css: _constants.visuallyHidden
47
- }, label), (0, _react2.jsx)("span", {
43
+ }, (0, _react2.jsx)("div", null, (0, _react2.jsx)(_visuallyHidden.default, null, label), (0, _react2.jsx)("span", {
48
44
  "aria-hidden": "true",
49
45
  "data-rating-icon": true,
50
46
  "data-testid": testId && "".concat(testId, "--icon-container")
@@ -56,16 +52,17 @@ var Rating = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
56
52
  "data-testid": testId && "".concat(testId, "--icon-checked-container")
57
53
  }, render({
58
54
  isChecked: true
59
- }))))), (0, _react2.jsx)("input", {
55
+ }))))), (0, _react2.jsx)(_visuallyHidden.default, {
56
+ testId: "input-container".concat(!!isChecked ? '-checked' : '')
57
+ }, (0, _react2.jsx)("input", {
60
58
  id: id,
61
- css: _constants.visuallyHidden,
62
59
  onChange: onChangeHandler,
63
60
  checked: !!isChecked,
64
61
  value: value,
65
62
  name: name,
66
63
  "data-testid": testId && "".concat(testId, "--input"),
67
64
  type: "radio"
68
- }));
65
+ })));
69
66
  });
70
67
  var _default = Rating;
71
68
  exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/rating",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "sideEffects": false
5
5
  }
@@ -2,10 +2,7 @@
2
2
  /** @jsx jsx */
3
3
  import { Children, cloneElement, Fragment, useState } from 'react';
4
4
  import { css, jsx } from '@emotion/react';
5
-
6
- // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
7
- // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
8
- import { visuallyHidden } from '@atlaskit/theme/constants';
5
+ import VisuallyHidden from '@atlaskit/visually-hidden';
9
6
  export default function RatingGroup({
10
7
  groupName = 'ak--rating-group',
11
8
  onChange,
@@ -42,10 +39,12 @@ Use "defaultValue" or "value" happy days :-).
42
39
  /* Instead of it starting in an empty state - it starts filled - and then uses the CSS sibling select "~" */
43
40
  /* to then display the empty state for the star rating. */
44
41
 
42
+ // By default, filled in icon is shown
45
43
  [data-rating-icon-checked] {
46
44
  display: inline-block;
47
45
  }
48
46
 
47
+ // By default, empty icon is NOT shown
49
48
  [data-rating-icon] {
50
49
  display: none;
51
50
  }
@@ -53,12 +52,14 @@ Use "defaultValue" or "value" happy days :-).
53
52
  label:hover
54
53
  ~ label
55
54
  [data-rating-icon-checked][data-rating-icon-checked],
56
- input:checked ~ label [data-rating-icon-checked] {
55
+ [data-testid='input-container-checked']
56
+ ~ label
57
+ [data-rating-icon-checked] {
57
58
  display: none;
58
59
  }
59
60
 
60
61
  label:hover ~ label [data-rating-icon][data-rating-icon],
61
- input:checked ~ label [data-rating-icon] {
62
+ [data-testid='input-container-checked'] ~ label [data-rating-icon] {
62
63
  display: inline-block;
63
64
  }
64
65
 
@@ -72,10 +73,10 @@ Use "defaultValue" or "value" happy days :-).
72
73
  }
73
74
  `
74
75
  }, !firstSelectionMade && jsx(Fragment, null, jsx("label", {
75
- css: visuallyHidden,
76
76
  htmlFor: `${groupName}--empty`
77
- }), jsx("input", {
78
- css: visuallyHidden,
77
+ }), jsx(VisuallyHidden, {
78
+ testId: `input-container${actualValue === undefined ? '-checked' : ''}`
79
+ }, jsx("input", {
79
80
  id: `${groupName}--empty`,
80
81
  "data-testid": testId && `${testId}--input-empty`,
81
82
  type: "radio",
@@ -83,7 +84,7 @@ Use "defaultValue" or "value" happy days :-).
83
84
  checked: actualValue === undefined,
84
85
  onChange: () => setValue(undefined),
85
86
  value: undefined
86
- })), Children.map(children, (child, index) => /*#__PURE__*/cloneElement(child, {
87
+ }))), Children.map(children, (child, index) => /*#__PURE__*/cloneElement(child, {
87
88
  onChange: onChangeHandler,
88
89
  name: groupName,
89
90
  id: `${groupName}--${index}`,
@@ -4,10 +4,8 @@ import _extends from "@babel/runtime/helpers/extends";
4
4
  import { forwardRef, Fragment, useCallback } from 'react';
5
5
  import { jsx } from '@emotion/react';
6
6
  import { easeInOut, smallDurationMs } from '@atlaskit/motion';
7
- // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
8
- // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
9
- import { visuallyHidden } from '@atlaskit/theme/constants';
10
7
  import Tooltip from '@atlaskit/tooltip';
8
+ import VisuallyHidden from '@atlaskit/visually-hidden';
11
9
  const Rating = /*#__PURE__*/forwardRef(({
12
10
  isChecked,
13
11
  name,
@@ -34,9 +32,7 @@ const Rating = /*#__PURE__*/forwardRef(({
34
32
  testId: testId && `${testId}--tooltip`,
35
33
  content: label,
36
34
  delay: 10
37
- }, jsx("div", null, jsx("span", {
38
- css: visuallyHidden
39
- }, label), jsx("span", {
35
+ }, jsx("div", null, jsx(VisuallyHidden, null, label), jsx("span", {
40
36
  "aria-hidden": "true",
41
37
  "data-rating-icon": true,
42
38
  "data-testid": testId && `${testId}--icon-container`
@@ -48,15 +44,16 @@ const Rating = /*#__PURE__*/forwardRef(({
48
44
  "data-testid": testId && `${testId}--icon-checked-container`
49
45
  }, render({
50
46
  isChecked: true
51
- }))))), jsx("input", {
47
+ }))))), jsx(VisuallyHidden, {
48
+ testId: `input-container${!!isChecked ? '-checked' : ''}`
49
+ }, jsx("input", {
52
50
  id: id,
53
- css: visuallyHidden,
54
51
  onChange: onChangeHandler,
55
52
  checked: !!isChecked,
56
53
  value: value,
57
54
  name: name,
58
55
  "data-testid": testId && `${testId}--input`,
59
56
  type: "radio"
60
- }));
57
+ })));
61
58
  });
62
59
  export default Rating;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/rating",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "sideEffects": false
5
5
  }
@@ -5,10 +5,7 @@ var _templateObject;
5
5
  /** @jsx jsx */
6
6
  import { Children, cloneElement, Fragment, useState } from 'react';
7
7
  import { css, jsx } from '@emotion/react';
8
-
9
- // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
10
- // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
11
- import { visuallyHidden } from '@atlaskit/theme/constants';
8
+ import VisuallyHidden from '@atlaskit/visually-hidden';
12
9
  export default function RatingGroup(_ref) {
13
10
  var _ref$groupName = _ref.groupName,
14
11
  groupName = _ref$groupName === void 0 ? 'ak--rating-group' : _ref$groupName,
@@ -39,12 +36,12 @@ export default function RatingGroup(_ref) {
39
36
  }
40
37
  return jsx("div", {
41
38
  "data-testid": testId && "".concat(testId, "--root"),
42
- css: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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 "])))
39
+ css: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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 // By default, filled in icon is shown\n [data-rating-icon-checked] {\n display: inline-block;\n }\n\n // By default, empty icon is NOT shown\n [data-rating-icon] {\n display: none;\n }\n\n label:hover\n ~ label\n [data-rating-icon-checked][data-rating-icon-checked],\n [data-testid='input-container-checked']\n ~ label\n [data-rating-icon-checked] {\n display: none;\n }\n\n label:hover ~ label [data-rating-icon][data-rating-icon],\n [data-testid='input-container-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 "])))
43
40
  }, !firstSelectionMade && jsx(Fragment, null, jsx("label", {
44
- css: visuallyHidden,
45
41
  htmlFor: "".concat(groupName, "--empty")
46
- }), jsx("input", {
47
- css: visuallyHidden,
42
+ }), jsx(VisuallyHidden, {
43
+ testId: "input-container".concat(actualValue === undefined ? '-checked' : '')
44
+ }, jsx("input", {
48
45
  id: "".concat(groupName, "--empty"),
49
46
  "data-testid": testId && "".concat(testId, "--input-empty"),
50
47
  type: "radio",
@@ -54,7 +51,7 @@ export default function RatingGroup(_ref) {
54
51
  return setValue(undefined);
55
52
  },
56
53
  value: undefined
57
- })), Children.map(children, function (child, index) {
54
+ }))), Children.map(children, function (child, index) {
58
55
  return /*#__PURE__*/cloneElement(child, {
59
56
  onChange: onChangeHandler,
60
57
  name: groupName,
@@ -6,10 +6,8 @@ var _excluded = ["isChecked", "name", "testId", "label", "id", "value", "onChang
6
6
  import { forwardRef, Fragment, useCallback } from 'react';
7
7
  import { jsx } from '@emotion/react';
8
8
  import { easeInOut, smallDurationMs } from '@atlaskit/motion';
9
- // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
10
- // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
11
- import { visuallyHidden } from '@atlaskit/theme/constants';
12
9
  import Tooltip from '@atlaskit/tooltip';
10
+ import VisuallyHidden from '@atlaskit/visually-hidden';
13
11
  var Rating = /*#__PURE__*/forwardRef(function (_ref, ref) {
14
12
  var isChecked = _ref.isChecked,
15
13
  name = _ref.name,
@@ -35,9 +33,7 @@ var Rating = /*#__PURE__*/forwardRef(function (_ref, ref) {
35
33
  testId: testId && "".concat(testId, "--tooltip"),
36
34
  content: label,
37
35
  delay: 10
38
- }, jsx("div", null, jsx("span", {
39
- css: visuallyHidden
40
- }, label), jsx("span", {
36
+ }, jsx("div", null, jsx(VisuallyHidden, null, label), jsx("span", {
41
37
  "aria-hidden": "true",
42
38
  "data-rating-icon": true,
43
39
  "data-testid": testId && "".concat(testId, "--icon-container")
@@ -49,15 +45,16 @@ var Rating = /*#__PURE__*/forwardRef(function (_ref, ref) {
49
45
  "data-testid": testId && "".concat(testId, "--icon-checked-container")
50
46
  }, render({
51
47
  isChecked: true
52
- }))))), jsx("input", {
48
+ }))))), jsx(VisuallyHidden, {
49
+ testId: "input-container".concat(!!isChecked ? '-checked' : '')
50
+ }, jsx("input", {
53
51
  id: id,
54
- css: visuallyHidden,
55
52
  onChange: onChangeHandler,
56
53
  checked: !!isChecked,
57
54
  value: value,
58
55
  name: name,
59
56
  "data-testid": testId && "".concat(testId, "--input"),
60
57
  type: "radio"
61
- }));
58
+ })));
62
59
  });
63
60
  export default Rating;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/rating",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/rating",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "description": "An accessible rating component that can be heavily customized.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -25,7 +25,7 @@
25
25
  "atlassian": {
26
26
  "team": "Dev Portal",
27
27
  "deprecatedAutoEntryPoints": true,
28
- "releaseModel": "scheduled",
28
+ "releaseModel": "continuous",
29
29
  "website": {
30
30
  "name": "Rating"
31
31
  }
@@ -34,8 +34,9 @@
34
34
  "@atlaskit/icon": "^21.12.0",
35
35
  "@atlaskit/motion": "^1.4.0",
36
36
  "@atlaskit/theme": "^12.5.0",
37
- "@atlaskit/tokens": "1.5.1",
37
+ "@atlaskit/tokens": "1.5.2",
38
38
  "@atlaskit/tooltip": "^17.8.0",
39
+ "@atlaskit/visually-hidden": "^1.2.3",
39
40
  "@babel/runtime": "^7.0.0",
40
41
  "@emotion/react": "^11.7.1"
41
42
  },
@@ -0,0 +1,62 @@
1
+ ## API Report File for "@atlaskit/rating"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ /// <reference types="react" />
8
+
9
+ import { ForwardRefExoticComponent } from 'react';
10
+ import { jsx } from '@emotion/react';
11
+ import { default as React_2 } from 'react';
12
+ import { RefAttributes } from 'react';
13
+
14
+ // @public (undocumented)
15
+ export interface InternalRatingProps extends RatingProps {
16
+ render: RatingRender;
17
+ }
18
+
19
+ // @public (undocumented)
20
+ export const Rating: ForwardRefExoticComponent<InternalRatingProps & RefAttributes<HTMLLabelElement>>;
21
+
22
+ // @public (undocumented)
23
+ export function RatingGroup({ groupName, onChange, defaultValue, value, testId, children, }: RatingGroupProps): jsx.JSX.Element;
24
+
25
+ // @public (undocumented)
26
+ export interface RatingGroupProps {
27
+ children: JSX.Element | JSX.Element[];
28
+ defaultValue?: string;
29
+ groupName?: string;
30
+ onChange?: (value?: string) => void;
31
+ testId?: string;
32
+ value?: string;
33
+ }
34
+
35
+ // @public (undocumented)
36
+ export interface RatingProps {
37
+ id?: string;
38
+ isChecked?: boolean;
39
+ label: string;
40
+ name?: string;
41
+ onChange?: (value?: string) => void;
42
+ testId?: string;
43
+ value: string;
44
+ }
45
+
46
+ // @public (undocumented)
47
+ export type RatingRender = (props: {
48
+ isChecked: boolean;
49
+ }) => React.ReactNode;
50
+
51
+ // @public (undocumented)
52
+ export const Star: React_2.ForwardRefExoticComponent<StarProps & React_2.RefAttributes<HTMLLabelElement>>;
53
+
54
+ // @public (undocumented)
55
+ export interface StarProps extends RatingProps {
56
+ color?: string;
57
+ size?: 'large' | 'medium' | 'small' | 'xlarge';
58
+ }
59
+
60
+ // (No @packageDocumentation comment for this package)
61
+
62
+ ```