@atlaskit/reactions 22.2.3 → 22.2.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/MockReactionsClient.js +2 -1
- package/dist/cjs/components/Counter/Counter.js +13 -11
- package/dist/cjs/components/Counter/styles.js +10 -7
- package/dist/cjs/components/Reaction/styles.js +2 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/MockReactionsClient.js +3 -1
- package/dist/es2019/components/Counter/Counter.js +14 -10
- package/dist/es2019/components/Counter/styles.js +6 -4
- package/dist/es2019/components/Reaction/styles.js +2 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/MockReactionsClient.js +3 -1
- package/dist/esm/components/Counter/Counter.js +14 -10
- package/dist/esm/components/Counter/styles.js +6 -4
- package/dist/esm/components/Reaction/styles.js +2 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/components/Counter/styles.d.ts +2 -1
- package/package.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -43,7 +43,8 @@ var getReactionKey = function getReactionKey(containerAri, ari) {
|
|
|
43
43
|
return "".concat(containerAri, "|").concat(ari);
|
|
44
44
|
};
|
|
45
45
|
var defaultUsers = [getUser('oscar', 'Oscar Wallhult'), getUser('julien', 'Julien Michel Hoarau'), getUser('craig', 'Craig Petchell'), getUser('jerome', 'Jerome Touffe-Blin'), getUser('esoares', 'Eduardo Soares'), getUser('lpereira', 'Luiz Pereira'), getUser('pcurren', 'Paul Curren'), getUser('ttjandra', 'Tara Tjandra'), getUser('severington', 'Ste Everington'), getUser('sguillope', 'Sylvain Guillope'), getUser('alunnon', 'Alex Lunnon'), getUser('bsmith', 'Bob Smith'), getUser('jdoe', 'Jane Doe'), getUser('mhomes', 'Mary Homes'), getUser('ckent', 'Clark Kent')];
|
|
46
|
-
var simpleMockData = (0, _defineProperty2.default)({}, getReactionKey(containerAri, ari), [getReactionSummary(':fire:', 1, true), getReactionSummary(':thumbsup:',
|
|
46
|
+
var simpleMockData = (0, _defineProperty2.default)({}, getReactionKey(containerAri, ari), [getReactionSummary(':fire:', 1, true), getReactionSummary(':thumbsup:', 33, false), getReactionSummary(':astonished:', 99, false), getReactionSummary(':heart:', 44, false) // Widest character
|
|
47
|
+
]);
|
|
47
48
|
exports.simpleMockData = simpleMockData;
|
|
48
49
|
var extendedMockData = (0, _defineProperty2.default)({}, getReactionKey(containerAri, ari), [getReactionSummary(':fire:', 1, true, true), getReactionSummary(':thumbsup:', 999, false, true), getReactionSummary(':astonished:', 9, false, true), getReactionSummary(':heart:', 99, false, true), getReactionSummary(':thinking:', 10, false, true), getReactionSummary(':clap:', 99, false, true), getReactionSummary(':thumbsdown:', 2, false, true), getReactionSummary(':bulb:', 16, false, true), getReactionSummary(':star:', 9999, false, true), getReactionSummary(':green_heart:', 9, false, true), getReactionSummary(':blue_heart:', 8392, false, true), getReactionSummary(':broken_heart:', 1, false, true), getReactionSummary(':grinning:', 10601, false, true), getReactionSummary(':slight_smile:', 99, false, true)]);
|
|
49
50
|
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.RENDER_LABEL_TESTID = exports.RENDER_COUNTER_TESTID = exports.RENDER_COMPONENT_WRAPPER = exports.Counter = void 0;
|
|
9
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _react2 = require("@emotion/react");
|
|
11
10
|
var _motion = require("@atlaskit/motion");
|
|
12
|
-
var _usePreviousValue = _interopRequireDefault(require("@atlaskit/ds-lib/use-previous-value"));
|
|
13
11
|
var _shared = require("../../shared");
|
|
14
12
|
var styles = _interopRequireWildcard(require("./styles"));
|
|
15
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -57,17 +55,21 @@ var Counter = function Counter(_ref) {
|
|
|
57
55
|
return _shared.utils.formatLargeNumber(value);
|
|
58
56
|
}
|
|
59
57
|
};
|
|
60
|
-
var
|
|
58
|
+
var lastValue = (0, _react.useRef)();
|
|
61
59
|
var label = getLabel(value);
|
|
62
|
-
|
|
60
|
+
(0, _react.useEffect)(function () {
|
|
61
|
+
lastValue.current = value;
|
|
62
|
+
}, [value]);
|
|
63
|
+
var isIncreasing = (0, _react.useMemo)(function () {
|
|
64
|
+
return lastValue.current ? lastValue.current < value : false;
|
|
65
|
+
}, [value]);
|
|
63
66
|
return (0, _react2.jsx)("div", {
|
|
64
67
|
className: className,
|
|
65
68
|
"data-testid": RENDER_COMPONENT_WRAPPER,
|
|
66
|
-
css:
|
|
67
|
-
width: label.length * 7
|
|
68
|
-
}]
|
|
69
|
+
css: styles.countStyle
|
|
69
70
|
}, (0, _react2.jsx)(_motion.ExitingPersistence, null, (0, _react2.jsx)(_motion.SlideIn, {
|
|
70
|
-
enterFrom:
|
|
71
|
+
enterFrom: isIncreasing ? 'top' : 'bottom',
|
|
72
|
+
exitTo: isIncreasing ? 'top' : 'bottom',
|
|
71
73
|
key: value,
|
|
72
74
|
duration: animationDuration
|
|
73
75
|
}, function (motion, direction) {
|
|
@@ -78,9 +80,9 @@ var Counter = function Counter(_ref) {
|
|
|
78
80
|
})],
|
|
79
81
|
className: motion.className,
|
|
80
82
|
"data-testid": RENDER_COUNTER_TESTID
|
|
81
|
-
}, (0, _react2.jsx)("
|
|
83
|
+
}, (0, _react2.jsx)("span", {
|
|
82
84
|
"data-testid": RENDER_LABEL_TESTID,
|
|
83
|
-
css: highlight
|
|
85
|
+
css: highlight ? [styles.counterLabelStyle, styles.highlightStyle] : styles.counterLabelStyle,
|
|
84
86
|
key: value
|
|
85
87
|
}, label));
|
|
86
88
|
})));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.highlightStyle = exports.countStyle = exports.containerStyle = void 0;
|
|
6
|
+
exports.highlightStyle = exports.counterLabelStyle = exports.countStyle = exports.containerStyle = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _colors = require("@atlaskit/theme/colors");
|
|
9
9
|
/** @jsx jsx */
|
|
@@ -17,13 +17,16 @@ var countStyle = (0, _react.css)({
|
|
|
17
17
|
lineHeight: '14px'
|
|
18
18
|
});
|
|
19
19
|
exports.countStyle = countStyle;
|
|
20
|
-
var highlightStyle = (0, _react.css)({
|
|
21
|
-
color: "var(--ds-text-selected, ".concat(_colors.B400, ")"),
|
|
22
|
-
fontWeight: 600
|
|
23
|
-
});
|
|
24
|
-
exports.highlightStyle = highlightStyle;
|
|
25
20
|
var containerStyle = (0, _react.css)({
|
|
26
21
|
display: 'flex',
|
|
27
22
|
flexDirection: 'column'
|
|
28
23
|
});
|
|
29
|
-
exports.containerStyle = containerStyle;
|
|
24
|
+
exports.containerStyle = containerStyle;
|
|
25
|
+
var highlightStyle = (0, _react.css)({
|
|
26
|
+
color: "var(--ds-text-selected, ".concat(_colors.B400, ")")
|
|
27
|
+
});
|
|
28
|
+
exports.highlightStyle = highlightStyle;
|
|
29
|
+
var counterLabelStyle = (0, _react.css)({
|
|
30
|
+
fontVariantNumeric: 'tabular-nums'
|
|
31
|
+
});
|
|
32
|
+
exports.counterLabelStyle = counterLabelStyle;
|
package/dist/cjs/version.json
CHANGED
|
@@ -24,8 +24,10 @@ const getReactionKey = (containerAri, ari) => {
|
|
|
24
24
|
};
|
|
25
25
|
const defaultUsers = [getUser('oscar', 'Oscar Wallhult'), getUser('julien', 'Julien Michel Hoarau'), getUser('craig', 'Craig Petchell'), getUser('jerome', 'Jerome Touffe-Blin'), getUser('esoares', 'Eduardo Soares'), getUser('lpereira', 'Luiz Pereira'), getUser('pcurren', 'Paul Curren'), getUser('ttjandra', 'Tara Tjandra'), getUser('severington', 'Ste Everington'), getUser('sguillope', 'Sylvain Guillope'), getUser('alunnon', 'Alex Lunnon'), getUser('bsmith', 'Bob Smith'), getUser('jdoe', 'Jane Doe'), getUser('mhomes', 'Mary Homes'), getUser('ckent', 'Clark Kent')];
|
|
26
26
|
export const simpleMockData = {
|
|
27
|
-
[getReactionKey(containerAri, ari)]: [getReactionSummary(':fire:', 1, true), getReactionSummary(':thumbsup:',
|
|
27
|
+
[getReactionKey(containerAri, ari)]: [getReactionSummary(':fire:', 1, true), getReactionSummary(':thumbsup:', 33, false), getReactionSummary(':astonished:', 99, false), getReactionSummary(':heart:', 44, false) // Widest character
|
|
28
|
+
]
|
|
28
29
|
};
|
|
30
|
+
|
|
29
31
|
const extendedMockData = {
|
|
30
32
|
[getReactionKey(containerAri, ari)]: [getReactionSummary(':fire:', 1, true, true), getReactionSummary(':thumbsup:', 999, false, true), getReactionSummary(':astonished:', 9, false, true), getReactionSummary(':heart:', 99, false, true), getReactionSummary(':thinking:', 10, false, true), getReactionSummary(':clap:', 99, false, true), getReactionSummary(':thumbsdown:', 2, false, true), getReactionSummary(':bulb:', 16, false, true), getReactionSummary(':star:', 9999, false, true), getReactionSummary(':green_heart:', 9, false, true), getReactionSummary(':blue_heart:', 8392, false, true), getReactionSummary(':broken_heart:', 1, false, true), getReactionSummary(':grinning:', 10601, false, true), getReactionSummary(':slight_smile:', 99, false, true)]
|
|
31
33
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { jsx, css } from '@emotion/react';
|
|
4
4
|
import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion';
|
|
5
5
|
// eslint-disable-next-line @atlaskit/design-system/no-banned-imports
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
import { utils } from '../../shared';
|
|
8
8
|
import * as styles from './styles';
|
|
9
9
|
|
|
@@ -42,17 +42,21 @@ export const Counter = ({
|
|
|
42
42
|
return utils.formatLargeNumber(value);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
const
|
|
45
|
+
const lastValue = useRef();
|
|
46
46
|
const label = getLabel(value);
|
|
47
|
-
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
lastValue.current = value;
|
|
49
|
+
}, [value]);
|
|
50
|
+
const isIncreasing = useMemo(() => {
|
|
51
|
+
return lastValue.current ? lastValue.current < value : false;
|
|
52
|
+
}, [value]);
|
|
48
53
|
return jsx("div", {
|
|
49
54
|
className: className,
|
|
50
55
|
"data-testid": RENDER_COMPONENT_WRAPPER,
|
|
51
|
-
css:
|
|
52
|
-
width: label.length * 7
|
|
53
|
-
}]
|
|
56
|
+
css: styles.countStyle
|
|
54
57
|
}, jsx(ExitingPersistence, null, jsx(SlideIn, {
|
|
55
|
-
enterFrom:
|
|
58
|
+
enterFrom: isIncreasing ? 'top' : 'bottom',
|
|
59
|
+
exitTo: isIncreasing ? 'top' : 'bottom',
|
|
56
60
|
key: value,
|
|
57
61
|
duration: animationDuration
|
|
58
62
|
}, (motion, direction) => {
|
|
@@ -63,9 +67,9 @@ export const Counter = ({
|
|
|
63
67
|
})],
|
|
64
68
|
className: motion.className,
|
|
65
69
|
"data-testid": RENDER_COUNTER_TESTID
|
|
66
|
-
}, jsx("
|
|
70
|
+
}, jsx("span", {
|
|
67
71
|
"data-testid": RENDER_LABEL_TESTID,
|
|
68
|
-
css: highlight
|
|
72
|
+
css: highlight ? [styles.counterLabelStyle, styles.highlightStyle] : styles.counterLabelStyle,
|
|
69
73
|
key: value
|
|
70
74
|
}, label));
|
|
71
75
|
})));
|
|
@@ -9,11 +9,13 @@ export const countStyle = css({
|
|
|
9
9
|
padding: '4px 8px 4px 0',
|
|
10
10
|
lineHeight: '14px'
|
|
11
11
|
});
|
|
12
|
-
export const highlightStyle = css({
|
|
13
|
-
color: `var(--ds-text-selected, ${B400})`,
|
|
14
|
-
fontWeight: 600
|
|
15
|
-
});
|
|
16
12
|
export const containerStyle = css({
|
|
17
13
|
display: 'flex',
|
|
18
14
|
flexDirection: 'column'
|
|
15
|
+
});
|
|
16
|
+
export const highlightStyle = css({
|
|
17
|
+
color: `var(--ds-text-selected, ${B400})`
|
|
18
|
+
});
|
|
19
|
+
export const counterLabelStyle = css({
|
|
20
|
+
fontVariantNumeric: 'tabular-nums'
|
|
19
21
|
});
|
|
@@ -41,7 +41,8 @@ export const reactionStyle = css({
|
|
|
41
41
|
transitionDuration: '0s, 0.2s',
|
|
42
42
|
// disabling browser focus outline
|
|
43
43
|
outline: 'none'
|
|
44
|
-
}
|
|
44
|
+
},
|
|
45
|
+
overflow: 'hidden'
|
|
45
46
|
});
|
|
46
47
|
export const reactedStyle = css({
|
|
47
48
|
backgroundColor: `var(--ds-background-selected, ${B50})`,
|
package/dist/es2019/version.json
CHANGED
|
@@ -32,7 +32,9 @@ var getReactionKey = function getReactionKey(containerAri, ari) {
|
|
|
32
32
|
return "".concat(containerAri, "|").concat(ari);
|
|
33
33
|
};
|
|
34
34
|
var defaultUsers = [getUser('oscar', 'Oscar Wallhult'), getUser('julien', 'Julien Michel Hoarau'), getUser('craig', 'Craig Petchell'), getUser('jerome', 'Jerome Touffe-Blin'), getUser('esoares', 'Eduardo Soares'), getUser('lpereira', 'Luiz Pereira'), getUser('pcurren', 'Paul Curren'), getUser('ttjandra', 'Tara Tjandra'), getUser('severington', 'Ste Everington'), getUser('sguillope', 'Sylvain Guillope'), getUser('alunnon', 'Alex Lunnon'), getUser('bsmith', 'Bob Smith'), getUser('jdoe', 'Jane Doe'), getUser('mhomes', 'Mary Homes'), getUser('ckent', 'Clark Kent')];
|
|
35
|
-
export var simpleMockData = _defineProperty({}, getReactionKey(containerAri, ari), [getReactionSummary(':fire:', 1, true), getReactionSummary(':thumbsup:',
|
|
35
|
+
export var simpleMockData = _defineProperty({}, getReactionKey(containerAri, ari), [getReactionSummary(':fire:', 1, true), getReactionSummary(':thumbsup:', 33, false), getReactionSummary(':astonished:', 99, false), getReactionSummary(':heart:', 44, false) // Widest character
|
|
36
|
+
]);
|
|
37
|
+
|
|
36
38
|
var extendedMockData = _defineProperty({}, getReactionKey(containerAri, ari), [getReactionSummary(':fire:', 1, true, true), getReactionSummary(':thumbsup:', 999, false, true), getReactionSummary(':astonished:', 9, false, true), getReactionSummary(':heart:', 99, false, true), getReactionSummary(':thinking:', 10, false, true), getReactionSummary(':clap:', 99, false, true), getReactionSummary(':thumbsdown:', 2, false, true), getReactionSummary(':bulb:', 16, false, true), getReactionSummary(':star:', 9999, false, true), getReactionSummary(':green_heart:', 9, false, true), getReactionSummary(':blue_heart:', 8392, false, true), getReactionSummary(':broken_heart:', 1, false, true), getReactionSummary(':grinning:', 10601, false, true), getReactionSummary(':slight_smile:', 99, false, true)]);
|
|
37
39
|
|
|
38
40
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { jsx, css } from '@emotion/react';
|
|
4
4
|
import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion';
|
|
5
5
|
// eslint-disable-next-line @atlaskit/design-system/no-banned-imports
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
import { utils } from '../../shared';
|
|
8
8
|
import * as styles from './styles';
|
|
9
9
|
|
|
@@ -43,17 +43,21 @@ export var Counter = function Counter(_ref) {
|
|
|
43
43
|
return utils.formatLargeNumber(value);
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
var
|
|
46
|
+
var lastValue = useRef();
|
|
47
47
|
var label = getLabel(value);
|
|
48
|
-
|
|
48
|
+
useEffect(function () {
|
|
49
|
+
lastValue.current = value;
|
|
50
|
+
}, [value]);
|
|
51
|
+
var isIncreasing = useMemo(function () {
|
|
52
|
+
return lastValue.current ? lastValue.current < value : false;
|
|
53
|
+
}, [value]);
|
|
49
54
|
return jsx("div", {
|
|
50
55
|
className: className,
|
|
51
56
|
"data-testid": RENDER_COMPONENT_WRAPPER,
|
|
52
|
-
css:
|
|
53
|
-
width: label.length * 7
|
|
54
|
-
}]
|
|
57
|
+
css: styles.countStyle
|
|
55
58
|
}, jsx(ExitingPersistence, null, jsx(SlideIn, {
|
|
56
|
-
enterFrom:
|
|
59
|
+
enterFrom: isIncreasing ? 'top' : 'bottom',
|
|
60
|
+
exitTo: isIncreasing ? 'top' : 'bottom',
|
|
57
61
|
key: value,
|
|
58
62
|
duration: animationDuration
|
|
59
63
|
}, function (motion, direction) {
|
|
@@ -64,9 +68,9 @@ export var Counter = function Counter(_ref) {
|
|
|
64
68
|
})],
|
|
65
69
|
className: motion.className,
|
|
66
70
|
"data-testid": RENDER_COUNTER_TESTID
|
|
67
|
-
}, jsx("
|
|
71
|
+
}, jsx("span", {
|
|
68
72
|
"data-testid": RENDER_LABEL_TESTID,
|
|
69
|
-
css: highlight
|
|
73
|
+
css: highlight ? [styles.counterLabelStyle, styles.highlightStyle] : styles.counterLabelStyle,
|
|
70
74
|
key: value
|
|
71
75
|
}, label));
|
|
72
76
|
})));
|
|
@@ -9,11 +9,13 @@ export var countStyle = css({
|
|
|
9
9
|
padding: '4px 8px 4px 0',
|
|
10
10
|
lineHeight: '14px'
|
|
11
11
|
});
|
|
12
|
-
export var highlightStyle = css({
|
|
13
|
-
color: "var(--ds-text-selected, ".concat(B400, ")"),
|
|
14
|
-
fontWeight: 600
|
|
15
|
-
});
|
|
16
12
|
export var containerStyle = css({
|
|
17
13
|
display: 'flex',
|
|
18
14
|
flexDirection: 'column'
|
|
15
|
+
});
|
|
16
|
+
export var highlightStyle = css({
|
|
17
|
+
color: "var(--ds-text-selected, ".concat(B400, ")")
|
|
18
|
+
});
|
|
19
|
+
export var counterLabelStyle = css({
|
|
20
|
+
fontVariantNumeric: 'tabular-nums'
|
|
19
21
|
});
|
|
@@ -41,7 +41,8 @@ export var reactionStyle = css({
|
|
|
41
41
|
transitionDuration: '0s, 0.2s',
|
|
42
42
|
// disabling browser focus outline
|
|
43
43
|
outline: 'none'
|
|
44
|
-
}
|
|
44
|
+
},
|
|
45
|
+
overflow: 'hidden'
|
|
45
46
|
});
|
|
46
47
|
export var reactedStyle = css({
|
|
47
48
|
backgroundColor: "var(--ds-background-selected, ".concat(B50, ")"),
|
package/dist/esm/version.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const countStyle: import("@emotion/react").SerializedStyles;
|
|
2
|
-
export declare const highlightStyle: import("@emotion/react").SerializedStyles;
|
|
3
2
|
export declare const containerStyle: import("@emotion/react").SerializedStyles;
|
|
3
|
+
export declare const highlightStyle: import("@emotion/react").SerializedStyles;
|
|
4
|
+
export declare const counterLabelStyle: import("@emotion/react").SerializedStyles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/reactions",
|
|
3
|
-
"version": "22.2.
|
|
3
|
+
"version": "22.2.4",
|
|
4
4
|
"description": "Reactions component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"@atlaskit/analytics-next": "^9.0.0",
|
|
31
31
|
"@atlaskit/avatar": "^21.0.0",
|
|
32
32
|
"@atlaskit/button": "^16.5.0",
|
|
33
|
-
"@atlaskit/ds-lib": "^2.1.0",
|
|
34
33
|
"@atlaskit/emoji": "^67.0.0",
|
|
35
34
|
"@atlaskit/icon": "^21.11.0",
|
|
36
35
|
"@atlaskit/modal-dialog": "^12.2.0",
|