@atlaskit/rating 0.2.26 → 0.2.27

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,11 @@
1
1
  # @atlaskit/rating
2
2
 
3
+ ## 0.2.27
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 0.2.26
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/rating",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/rating",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/rating",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/rating",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
4
4
  "description": "An accessible rating component that can be heavily customized.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -24,9 +24,9 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@atlaskit/icon": "^21.10.0",
27
- "@atlaskit/motion": "^1.1.0",
27
+ "@atlaskit/motion": "^1.2.0",
28
28
  "@atlaskit/theme": "^12.1.0",
29
- "@atlaskit/tokens": "0.10.11",
29
+ "@atlaskit/tokens": "0.10.12",
30
30
  "@atlaskit/tooltip": "^17.5.0",
31
31
  "@babel/runtime": "^7.0.0",
32
32
  "@emotion/core": "^10.0.9"
package/report.api.md CHANGED
@@ -9,18 +9,19 @@ import { ForwardRefExoticComponent } from 'react';
9
9
  import { default as React_2 } from 'react';
10
10
  import { RefAttributes } from 'react';
11
11
 
12
- // @public (undocumented)
13
- export interface InternalRatingProps extends RatingProps {
12
+ export declare interface InternalRatingProps extends RatingProps {
13
+ /**
14
+ * Render callback that should return a ReactNode.
15
+ * Is passed an argument which is an object with one property `isChecked`.
16
+ */
14
17
  render: RatingRender;
15
18
  }
16
19
 
17
- // @public (undocumented)
18
- export const Rating: ForwardRefExoticComponent<
20
+ export declare const Rating: ForwardRefExoticComponent<
19
21
  InternalRatingProps & RefAttributes<HTMLLabelElement>
20
22
  >;
21
23
 
22
- // @public (undocumented)
23
- export function RatingGroup({
24
+ export declare function RatingGroup({
24
25
  groupName,
25
26
  onChange,
26
27
  defaultValue,
@@ -29,40 +30,133 @@ export function RatingGroup({
29
30
  children,
30
31
  }: RatingGroupProps): JSX.Element;
31
32
 
32
- // @public (undocumented)
33
- export interface RatingGroupProps {
34
- children: JSX.Element | JSX.Element[];
35
- defaultValue?: string;
36
- groupName?: string;
33
+ export declare interface RatingGroupProps {
34
+ /**
35
+ * Callback that is called everytime the rating changes.
36
+ * Use this in conjunction with `value` for [controlled behaviour](https://reactjs.org/docs/forms.html#controlled-components).
37
+ */
37
38
  onChange?: (value?: string) => void;
38
- testId?: string;
39
+ /**
40
+ * Group name for all of the child rating items.
41
+ * If you have **multiple ratings on the same page make sure to have a unique name** for each group.
42
+
43
+ * Defaults to `"ak--rating-group"`.
44
+ */
45
+ groupName?: string;
46
+ /**
47
+ * Will set the default checked value for a child radio rating item.
48
+ * Use when wanting to use this in an [uncontrolled way](https://reactjs.org/docs/uncontrolled-components.html).
49
+
50
+ * Do not use with `value`.
51
+ */
52
+ defaultValue?: string;
53
+ /**
54
+ * Value that is used to check a child rating item.
55
+ * Use when wanting to use this in a [controlled way](https://reactjs.org/docs/forms.html#controlled-components).
56
+
57
+ * Do not use with `defaultValue`.
58
+ */
39
59
  value?: string;
60
+ /**
61
+ A `testId` prop is provided for specified elements,
62
+ which is a unique string that appears as a data attribute `data-testid` in the rendered code,
63
+ serving as a hook for automated tests.
64
+
65
+ Will set these elements:
66
+
67
+ * The root container `"{testId}--root"`
68
+ * The empty input `"{testId}--input-empty"` which is used to signify "nothing is selected yet".
69
+ */
70
+ testId?: string;
71
+ /**
72
+ * Pass in child rating items.
73
+ * This component expects the markup to be defined in a particular way,
74
+ * so if you pass extra wrapping markup expect undefined behaviour.
75
+
76
+ * You can have any amount of child rating items.
77
+ */
78
+ children: JSX.Element | JSX.Element[];
40
79
  }
41
80
 
42
- // @public (undocumented)
43
- export interface RatingProps {
44
- id?: string;
45
- isChecked?: boolean;
81
+ export declare interface RatingProps {
82
+ /**
83
+ * Label for the rating item.
84
+ * This will be read by screen readers as well as used in the tooltip when hovering over the item.
85
+ */
46
86
  label: string;
87
+ /**
88
+ * This is passed to the radio button input.
89
+
90
+ * When using this with the `<Rating />` component this is handled for you.
91
+ */
47
92
  name?: string;
48
- onChange?: (value?: string) => void;
93
+ /**
94
+ * Sets checked state on the rating item.
95
+
96
+ * When using this with the `<Rating />` component this is handled for you.
97
+ */
98
+ isChecked?: boolean;
99
+ /**
100
+ A `testId` prop is provided for specified elements,
101
+ which is a unique string that appears as a data attribute `data-testid` in the rendered code,
102
+ serving as a hook for automated tests.
103
+
104
+ Will set two elements:
105
+
106
+ * The label as `"{testId}--label"`
107
+ * The radio button as `"{testId}--input"`
108
+ * The unchecked icon container `"{testId}--icon-container"`
109
+ * The checked icon container `"{testId}--icon-checked-container"`
110
+
111
+ When using this with the `<Rating />` component this will inherit its `testId` as `"{testId}--{index}--{element}"`,
112
+ for example label would be `"{testId}--{index}--label"`.
113
+ */
49
114
  testId?: string;
115
+ /**
116
+ * Value of the rating item.
117
+ * This will be passed back in the `onChange()` handler when checked.
118
+ */
50
119
  value: string;
120
+ /**
121
+ * Id that is passed to both the label and the radio button element.
122
+ * This is needed to declare their relationship.
123
+
124
+ * When using this with the `<Rating />` component this is handled for you.
125
+ */
126
+ id?: string;
127
+ /**
128
+ * Handler that is called back whenever the radio button element changes its checked state.
129
+ * When checked will be passed the `value` -
130
+ * when unchecked will be passed `undefined`.
131
+
132
+ * When using this with the `<Rating />` component this is handled for you.
133
+ */
134
+ onChange?: (value?: string) => void;
51
135
  }
52
136
 
53
- // @public (undocumented)
54
- export type RatingRender = (props: { isChecked: boolean }) => React.ReactNode;
137
+ export declare type RatingRender = (props: {
138
+ isChecked: boolean;
139
+ }) => React.ReactNode;
55
140
 
56
- // @public (undocumented)
57
- export const Star: React_2.ForwardRefExoticComponent<
141
+ export declare const Star: React_2.ForwardRefExoticComponent<
58
142
  StarProps & React_2.RefAttributes<HTMLLabelElement>
59
143
  >;
60
144
 
61
- // @public (undocumented)
62
- export interface StarProps extends RatingProps {
63
- color?: string;
145
+ export declare interface StarProps extends RatingProps {
146
+ /**
147
+ * Size of the star icon.
148
+
149
+ * Defaults to `"large"`.
150
+ */
64
151
  size?: 'small' | 'medium' | 'large' | 'xlarge';
152
+ /**
153
+ * Color of the star icon,
154
+ * when wanting to customize the color please ensure you use `colors` from `@atlaskit/theme`.
155
+
156
+ * Defaults to `colors.Y200`.
157
+ */
158
+ color?: string;
65
159
  }
66
160
 
67
- // (No @packageDocumentation comment for this package)
161
+ export {};
68
162
  ```