@atlaskit/task-decision 19.1.3 → 19.1.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 +9 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/components/TaskItem.js +97 -4
- package/dist/es2019/components/TaskItem.js +92 -4
- package/dist/esm/components/TaskItem.js +97 -4
- package/dist/types/components/ResourcedTaskItem.d.ts +2 -2
- package/dist/types/components/TaskItem.d.ts +3 -3
- package/dist/types-ts4.5/components/ResourcedTaskItem.d.ts +2 -2
- package/dist/types-ts4.5/components/TaskItem.d.ts +3 -3
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/task-decision
|
|
2
2
|
|
|
3
|
+
## 19.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#139777](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/139777)
|
|
8
|
+
[`cfdfe0077993d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cfdfe0077993d) -
|
|
9
|
+
Fix bug where a refs were passed incorrectly, preventing task item focus from being set
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 19.1.3
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -16,6 +16,8 @@ var _checkboxChecked = _interopRequireDefault(require("@atlaskit/icon/core/check
|
|
|
16
16
|
var _Item = _interopRequireDefault(require("./Item"));
|
|
17
17
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
18
18
|
var _analytics = require("../analytics");
|
|
19
|
+
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
20
|
+
var _useCallbackRef = require("use-callback-ref");
|
|
19
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
23
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
@@ -37,7 +39,7 @@ var taskCount = 0;
|
|
|
37
39
|
var getCheckBoxId = function getCheckBoxId(localId) {
|
|
38
40
|
return "".concat(localId, "-").concat(taskCount++);
|
|
39
41
|
};
|
|
40
|
-
var
|
|
42
|
+
var TaskItemWithoutRefFix = function TaskItemWithoutRefFix(props) {
|
|
41
43
|
var appearance = props.appearance,
|
|
42
44
|
isDone = props.isDone,
|
|
43
45
|
isFocused = props.isFocused,
|
|
@@ -50,8 +52,8 @@ var TaskItem = function TaskItem(props) {
|
|
|
50
52
|
taskId = props.taskId,
|
|
51
53
|
onChange = props.onChange,
|
|
52
54
|
onClick = props.onClick,
|
|
53
|
-
createAnalyticsEvent = props.createAnalyticsEvent
|
|
54
|
-
|
|
55
|
+
createAnalyticsEvent = props.createAnalyticsEvent;
|
|
56
|
+
var inputRefFromProps = props.inputRef;
|
|
55
57
|
var checkBoxId = (0, _react.useMemo)(function () {
|
|
56
58
|
return getCheckBoxId(taskId);
|
|
57
59
|
}, [taskId]);
|
|
@@ -128,7 +130,98 @@ var TaskItem = function TaskItem(props) {
|
|
|
128
130
|
checkBoxId: checkBoxId
|
|
129
131
|
}, children);
|
|
130
132
|
};
|
|
133
|
+
var TaskItemWithRefFix = function TaskItemWithRefFix(props) {
|
|
134
|
+
var appearance = props.appearance,
|
|
135
|
+
isDone = props.isDone,
|
|
136
|
+
isFocused = props.isFocused,
|
|
137
|
+
contentRef = props.contentRef,
|
|
138
|
+
children = props.children,
|
|
139
|
+
placeholder = props.placeholder,
|
|
140
|
+
showPlaceholder = props.showPlaceholder,
|
|
141
|
+
disabled = props.disabled,
|
|
142
|
+
dataAttributes = props.dataAttributes,
|
|
143
|
+
taskId = props.taskId,
|
|
144
|
+
onChange = props.onChange,
|
|
145
|
+
onClick = props.onClick,
|
|
146
|
+
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
147
|
+
inputRefFromProps = props.inputRef;
|
|
148
|
+
var checkBoxId = (0, _react.useMemo)(function () {
|
|
149
|
+
return getCheckBoxId(taskId);
|
|
150
|
+
}, [taskId]);
|
|
151
|
+
var handleOnChange = (0, _react.useMemo)(function () {
|
|
152
|
+
return function (_evt) {
|
|
153
|
+
var newIsDone = !isDone;
|
|
154
|
+
if (onChange) {
|
|
155
|
+
onChange(taskId, newIsDone);
|
|
156
|
+
}
|
|
157
|
+
var action = newIsDone ? 'checked' : 'unchecked';
|
|
158
|
+
if (createAnalyticsEvent) {
|
|
159
|
+
(0, _analytics.createAndFireEventInElementsChannel)({
|
|
160
|
+
action: action,
|
|
161
|
+
actionSubject: 'action',
|
|
162
|
+
eventType: 'ui',
|
|
163
|
+
attributes: {
|
|
164
|
+
localId: taskId
|
|
165
|
+
}
|
|
166
|
+
})(createAnalyticsEvent);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}, [onChange, taskId, isDone, createAnalyticsEvent]);
|
|
170
|
+
var handleOnKeyPress = (0, _react.useMemo)(function () {
|
|
171
|
+
return function (event) {
|
|
172
|
+
if (event.key === 'Enter') {
|
|
173
|
+
handleOnChange(event);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}, [handleOnChange]);
|
|
177
|
+
var localInputRef = (0, _react.useRef)(null);
|
|
178
|
+
var inputRef = (0, _useCallbackRef.useMergeRefs)(inputRefFromProps === undefined ? [localInputRef] : [inputRefFromProps, localInputRef]);
|
|
179
|
+
var icon = /*#__PURE__*/_react.default.createElement("span", {
|
|
180
|
+
contentEditable: false,
|
|
181
|
+
className: (0, _runtime.ax)(["_16jlidpf _1o9zidpf _i0dl1tcg _1bsb1tcg _4t3i1tcg _kqswh2mm _1wpzv2br _1snx1r31 _1746glyw _dx3f1o36 _1h5xidpf _sqizidpf _fs2cidpf _1smcidpf _oezm15vq _1l0615vq _1abj1mn3 _18a711so _16np1elr _a27kkb7n _q3p7usvi _qhqx1nu9 _10cr1ssb _zfav1ssb _m7eu1ooe _l9o0n7od _1efjn7od _1u2istnw _32ro1j9a _1wn015vq _den512j9 _zh8l1b66 _g5w3stnw _whhepxbi _1stbpxbi _18tob3bt _1awt1ule _haf81ssb _ra781ssb _cr751ooe _1q8r7vkz _9l2s7vkz _1mh7kb7n _s3uktlke _1davidpf _8bo8stnw _psnc1ssb _4k421ssb _1rvv1ooe _13vl73ad _1t711tcg _1nuz1tcg _cs4qstnw _9j2j1ssb _1mwj1ssb _19l51ooe _12yy1d5g _1miy1elr _1umo18hz _tpz25w2r _k6dg18hz _1qduewfl _q8ft1fvw _1y9t5w2r _ut031fvw _gi9hr01l _1qp6muej _wxkgr01l _wo245w2r _c8dpmuej _d2dcsyzs _1eulsyzs _1bc7syzs _16fmsyzs _bhkusyzs _czfesyzs _1gxgsyzs _19w0syzs _1x1y1lg7"]),
|
|
182
|
+
style: {
|
|
183
|
+
"--_toyvsf": (0, _runtime.ix)("2px solid ".concat("var(--ds-border-focused, #388BFF)"))
|
|
184
|
+
}
|
|
185
|
+
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
186
|
+
id: checkBoxId,
|
|
187
|
+
"aria-labelledby": "".concat(checkBoxId, "-wrapper"),
|
|
188
|
+
name: checkBoxId,
|
|
189
|
+
type: "checkbox",
|
|
190
|
+
onChange: handleOnChange,
|
|
191
|
+
onClick: onClick,
|
|
192
|
+
checked: !!isDone,
|
|
193
|
+
disabled: !!disabled,
|
|
194
|
+
suppressHydrationWarning: true,
|
|
195
|
+
onKeyPress: handleOnKeyPress,
|
|
196
|
+
ref: inputRef
|
|
197
|
+
}), isDone ? /*#__PURE__*/_react.default.createElement(_checkboxChecked.default, {
|
|
198
|
+
label: ""
|
|
199
|
+
}) : /*#__PURE__*/_react.default.createElement(CheckboxUncheckedIcon, {
|
|
200
|
+
label: ""
|
|
201
|
+
}));
|
|
202
|
+
_react.default.useEffect(function () {
|
|
203
|
+
if (isFocused && inputRef.current) {
|
|
204
|
+
var _inputRef$current4, _inputRef$current5;
|
|
205
|
+
(_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 || _inputRef$current4.focus();
|
|
206
|
+
(_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 || _inputRef$current5.blur();
|
|
207
|
+
setTimeout(function () {
|
|
208
|
+
var _inputRef$current6;
|
|
209
|
+
(_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 || _inputRef$current6.focus();
|
|
210
|
+
}, 100);
|
|
211
|
+
}
|
|
212
|
+
}, [isFocused, inputRef]);
|
|
213
|
+
return /*#__PURE__*/_react.default.createElement(_Item.default, {
|
|
214
|
+
appearance: appearance,
|
|
215
|
+
contentRef: contentRef,
|
|
216
|
+
icon: icon,
|
|
217
|
+
placeholder: placeholder,
|
|
218
|
+
showPlaceholder: showPlaceholder,
|
|
219
|
+
itemType: "TASK",
|
|
220
|
+
dataAttributes: dataAttributes,
|
|
221
|
+
checkBoxId: checkBoxId
|
|
222
|
+
}, children);
|
|
223
|
+
};
|
|
131
224
|
|
|
132
225
|
// This is to ensure that the "type" is exported, as it gets lost and not exported along with TaskItem after
|
|
133
226
|
// going through the high order component.
|
|
134
|
-
var _default = exports.default = (0, _analyticsNext.withAnalyticsEvents)()(
|
|
227
|
+
var _default = exports.default = (0, _platformFeatureFlagsReact.componentWithFG)('platform_editor_task_item_ref_fix', (0, _analyticsNext.withAnalyticsEvents)()(TaskItemWithRefFix), (0, _analyticsNext.withAnalyticsEvents)()(TaskItemWithoutRefFix));
|
|
@@ -11,6 +11,8 @@ import CheckboxCheckedIcon from '@atlaskit/icon/core/checkbox-checked';
|
|
|
11
11
|
import Item from './Item';
|
|
12
12
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
13
13
|
import { createAndFireEventInElementsChannel } from '../analytics';
|
|
14
|
+
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
15
|
+
import { useMergeRefs } from 'use-callback-ref';
|
|
14
16
|
const CheckboxUncheckedIcon = props => /*#__PURE__*/React.createElement(Icon, _extends({
|
|
15
17
|
dangerouslySetGlyph: `<rect width="12.5" height="12.5" x="1.75" y="1.75" stroke="currentcolor" stroke-width="1.5" rx="1.25"/>`,
|
|
16
18
|
type: 'core'
|
|
@@ -24,7 +26,7 @@ const CheckboxUncheckedIcon = props => /*#__PURE__*/React.createElement(Icon, _e
|
|
|
24
26
|
const checkboxStyles = null;
|
|
25
27
|
let taskCount = 0;
|
|
26
28
|
const getCheckBoxId = localId => `${localId}-${taskCount++}`;
|
|
27
|
-
const
|
|
29
|
+
const TaskItemWithoutRefFix = props => {
|
|
28
30
|
const {
|
|
29
31
|
appearance,
|
|
30
32
|
isDone,
|
|
@@ -38,9 +40,9 @@ const TaskItem = props => {
|
|
|
38
40
|
taskId,
|
|
39
41
|
onChange,
|
|
40
42
|
onClick,
|
|
41
|
-
createAnalyticsEvent
|
|
42
|
-
inputRef: inputRefFromProps
|
|
43
|
+
createAnalyticsEvent
|
|
43
44
|
} = props;
|
|
45
|
+
const inputRefFromProps = props.inputRef;
|
|
44
46
|
const checkBoxId = useMemo(() => getCheckBoxId(taskId), [taskId]);
|
|
45
47
|
const handleOnChange = useMemo(() => {
|
|
46
48
|
return _evt => {
|
|
@@ -110,8 +112,94 @@ const TaskItem = props => {
|
|
|
110
112
|
checkBoxId: checkBoxId
|
|
111
113
|
}, children);
|
|
112
114
|
};
|
|
115
|
+
const TaskItemWithRefFix = props => {
|
|
116
|
+
const {
|
|
117
|
+
appearance,
|
|
118
|
+
isDone,
|
|
119
|
+
isFocused,
|
|
120
|
+
contentRef,
|
|
121
|
+
children,
|
|
122
|
+
placeholder,
|
|
123
|
+
showPlaceholder,
|
|
124
|
+
disabled,
|
|
125
|
+
dataAttributes,
|
|
126
|
+
taskId,
|
|
127
|
+
onChange,
|
|
128
|
+
onClick,
|
|
129
|
+
createAnalyticsEvent,
|
|
130
|
+
inputRef: inputRefFromProps
|
|
131
|
+
} = props;
|
|
132
|
+
const checkBoxId = useMemo(() => getCheckBoxId(taskId), [taskId]);
|
|
133
|
+
const handleOnChange = useMemo(() => {
|
|
134
|
+
return _evt => {
|
|
135
|
+
const newIsDone = !isDone;
|
|
136
|
+
if (onChange) {
|
|
137
|
+
onChange(taskId, newIsDone);
|
|
138
|
+
}
|
|
139
|
+
const action = newIsDone ? 'checked' : 'unchecked';
|
|
140
|
+
if (createAnalyticsEvent) {
|
|
141
|
+
createAndFireEventInElementsChannel({
|
|
142
|
+
action,
|
|
143
|
+
actionSubject: 'action',
|
|
144
|
+
eventType: 'ui',
|
|
145
|
+
attributes: {
|
|
146
|
+
localId: taskId
|
|
147
|
+
}
|
|
148
|
+
})(createAnalyticsEvent);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}, [onChange, taskId, isDone, createAnalyticsEvent]);
|
|
152
|
+
const handleOnKeyPress = useMemo(() => event => {
|
|
153
|
+
if (event.key === 'Enter') {
|
|
154
|
+
handleOnChange(event);
|
|
155
|
+
}
|
|
156
|
+
}, [handleOnChange]);
|
|
157
|
+
const localInputRef = useRef(null);
|
|
158
|
+
const inputRef = useMergeRefs(inputRefFromProps === undefined ? [localInputRef] : [inputRefFromProps, localInputRef]);
|
|
159
|
+
const icon = /*#__PURE__*/React.createElement("span", {
|
|
160
|
+
contentEditable: false,
|
|
161
|
+
className: ax(["_16jlidpf _1o9zidpf _i0dl1tcg _1bsb1tcg _4t3i1tcg _kqswh2mm _1wpzv2br _1snx1r31 _1746glyw _dx3f1o36 _1h5xidpf _sqizidpf _fs2cidpf _1smcidpf _oezm15vq _1l0615vq _1abj1mn3 _18a711so _16np1elr _a27kkb7n _q3p7usvi _qhqx1nu9 _10cr1ssb _zfav1ssb _m7eu1ooe _l9o0n7od _1efjn7od _1u2istnw _32ro1j9a _1wn015vq _den5ugt7 _zh8l1b66 _g5w3stnw _whhepxbi _1stbpxbi _18tob3bt _1awt1ule _haf81ssb _ra781ssb _cr751ooe _1q8r7vkz _9l2s7vkz _1mh7kb7n _s3uktlke _1davidpf _8bo8stnw _psnc1ssb _4k421ssb _1rvv1ooe _13vl73ad _1t711tcg _1nuz1tcg _cs4qstnw _9j2j1ssb _1mwj1ssb _19l51ooe _12yy1d5g _1miy1elr _1umo18hz _tpz25w2r _k6dg18hz _1qduewfl _q8ft1fvw _1y9t5w2r _ut031fvw _gi9hr01l _1qp6muej _wxkgr01l _wo245w2r _c8dpmuej _d2dcsyzs _1eulsyzs _1bc7syzs _16fmsyzs _bhkusyzs _czfesyzs _1gxgsyzs _19w0syzs _1x1y1lg7"])
|
|
162
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
163
|
+
id: checkBoxId,
|
|
164
|
+
"aria-labelledby": `${checkBoxId}-wrapper`,
|
|
165
|
+
name: checkBoxId,
|
|
166
|
+
type: "checkbox",
|
|
167
|
+
onChange: handleOnChange,
|
|
168
|
+
onClick: onClick,
|
|
169
|
+
checked: !!isDone,
|
|
170
|
+
disabled: !!disabled,
|
|
171
|
+
suppressHydrationWarning: true,
|
|
172
|
+
onKeyPress: handleOnKeyPress,
|
|
173
|
+
ref: inputRef
|
|
174
|
+
}), isDone ? /*#__PURE__*/React.createElement(CheckboxCheckedIcon, {
|
|
175
|
+
label: ""
|
|
176
|
+
}) : /*#__PURE__*/React.createElement(CheckboxUncheckedIcon, {
|
|
177
|
+
label: ""
|
|
178
|
+
}));
|
|
179
|
+
React.useEffect(() => {
|
|
180
|
+
if (isFocused && inputRef.current) {
|
|
181
|
+
var _inputRef$current4, _inputRef$current5;
|
|
182
|
+
(_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.focus();
|
|
183
|
+
(_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.blur();
|
|
184
|
+
setTimeout(() => {
|
|
185
|
+
var _inputRef$current6;
|
|
186
|
+
(_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.focus();
|
|
187
|
+
}, 100);
|
|
188
|
+
}
|
|
189
|
+
}, [isFocused, inputRef]);
|
|
190
|
+
return /*#__PURE__*/React.createElement(Item, {
|
|
191
|
+
appearance: appearance,
|
|
192
|
+
contentRef: contentRef,
|
|
193
|
+
icon: icon,
|
|
194
|
+
placeholder: placeholder,
|
|
195
|
+
showPlaceholder: showPlaceholder,
|
|
196
|
+
itemType: "TASK",
|
|
197
|
+
dataAttributes: dataAttributes,
|
|
198
|
+
checkBoxId: checkBoxId
|
|
199
|
+
}, children);
|
|
200
|
+
};
|
|
113
201
|
|
|
114
202
|
// This is to ensure that the "type" is exported, as it gets lost and not exported along with TaskItem after
|
|
115
203
|
// going through the high order component.
|
|
116
204
|
|
|
117
|
-
export default withAnalyticsEvents()(
|
|
205
|
+
export default componentWithFG('platform_editor_task_item_ref_fix', withAnalyticsEvents()(TaskItemWithRefFix), withAnalyticsEvents()(TaskItemWithoutRefFix));
|
|
@@ -11,6 +11,8 @@ import CheckboxCheckedIcon from '@atlaskit/icon/core/checkbox-checked';
|
|
|
11
11
|
import Item from './Item';
|
|
12
12
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
13
13
|
import { createAndFireEventInElementsChannel } from '../analytics';
|
|
14
|
+
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
15
|
+
import { useMergeRefs } from 'use-callback-ref';
|
|
14
16
|
var CheckboxUncheckedIcon = function CheckboxUncheckedIcon(props) {
|
|
15
17
|
return /*#__PURE__*/React.createElement(Icon, _extends({
|
|
16
18
|
dangerouslySetGlyph: "<rect width=\"12.5\" height=\"12.5\" x=\"1.75\" y=\"1.75\" stroke=\"currentcolor\" stroke-width=\"1.5\" rx=\"1.25\"/>",
|
|
@@ -28,7 +30,7 @@ var taskCount = 0;
|
|
|
28
30
|
var getCheckBoxId = function getCheckBoxId(localId) {
|
|
29
31
|
return "".concat(localId, "-").concat(taskCount++);
|
|
30
32
|
};
|
|
31
|
-
var
|
|
33
|
+
var TaskItemWithoutRefFix = function TaskItemWithoutRefFix(props) {
|
|
32
34
|
var appearance = props.appearance,
|
|
33
35
|
isDone = props.isDone,
|
|
34
36
|
isFocused = props.isFocused,
|
|
@@ -41,8 +43,8 @@ var TaskItem = function TaskItem(props) {
|
|
|
41
43
|
taskId = props.taskId,
|
|
42
44
|
onChange = props.onChange,
|
|
43
45
|
onClick = props.onClick,
|
|
44
|
-
createAnalyticsEvent = props.createAnalyticsEvent
|
|
45
|
-
|
|
46
|
+
createAnalyticsEvent = props.createAnalyticsEvent;
|
|
47
|
+
var inputRefFromProps = props.inputRef;
|
|
46
48
|
var checkBoxId = useMemo(function () {
|
|
47
49
|
return getCheckBoxId(taskId);
|
|
48
50
|
}, [taskId]);
|
|
@@ -119,8 +121,99 @@ var TaskItem = function TaskItem(props) {
|
|
|
119
121
|
checkBoxId: checkBoxId
|
|
120
122
|
}, children);
|
|
121
123
|
};
|
|
124
|
+
var TaskItemWithRefFix = function TaskItemWithRefFix(props) {
|
|
125
|
+
var appearance = props.appearance,
|
|
126
|
+
isDone = props.isDone,
|
|
127
|
+
isFocused = props.isFocused,
|
|
128
|
+
contentRef = props.contentRef,
|
|
129
|
+
children = props.children,
|
|
130
|
+
placeholder = props.placeholder,
|
|
131
|
+
showPlaceholder = props.showPlaceholder,
|
|
132
|
+
disabled = props.disabled,
|
|
133
|
+
dataAttributes = props.dataAttributes,
|
|
134
|
+
taskId = props.taskId,
|
|
135
|
+
onChange = props.onChange,
|
|
136
|
+
onClick = props.onClick,
|
|
137
|
+
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
138
|
+
inputRefFromProps = props.inputRef;
|
|
139
|
+
var checkBoxId = useMemo(function () {
|
|
140
|
+
return getCheckBoxId(taskId);
|
|
141
|
+
}, [taskId]);
|
|
142
|
+
var handleOnChange = useMemo(function () {
|
|
143
|
+
return function (_evt) {
|
|
144
|
+
var newIsDone = !isDone;
|
|
145
|
+
if (onChange) {
|
|
146
|
+
onChange(taskId, newIsDone);
|
|
147
|
+
}
|
|
148
|
+
var action = newIsDone ? 'checked' : 'unchecked';
|
|
149
|
+
if (createAnalyticsEvent) {
|
|
150
|
+
createAndFireEventInElementsChannel({
|
|
151
|
+
action: action,
|
|
152
|
+
actionSubject: 'action',
|
|
153
|
+
eventType: 'ui',
|
|
154
|
+
attributes: {
|
|
155
|
+
localId: taskId
|
|
156
|
+
}
|
|
157
|
+
})(createAnalyticsEvent);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}, [onChange, taskId, isDone, createAnalyticsEvent]);
|
|
161
|
+
var handleOnKeyPress = useMemo(function () {
|
|
162
|
+
return function (event) {
|
|
163
|
+
if (event.key === 'Enter') {
|
|
164
|
+
handleOnChange(event);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}, [handleOnChange]);
|
|
168
|
+
var localInputRef = useRef(null);
|
|
169
|
+
var inputRef = useMergeRefs(inputRefFromProps === undefined ? [localInputRef] : [inputRefFromProps, localInputRef]);
|
|
170
|
+
var icon = /*#__PURE__*/React.createElement("span", {
|
|
171
|
+
contentEditable: false,
|
|
172
|
+
className: ax(["_16jlidpf _1o9zidpf _i0dl1tcg _1bsb1tcg _4t3i1tcg _kqswh2mm _1wpzv2br _1snx1r31 _1746glyw _dx3f1o36 _1h5xidpf _sqizidpf _fs2cidpf _1smcidpf _oezm15vq _1l0615vq _1abj1mn3 _18a711so _16np1elr _a27kkb7n _q3p7usvi _qhqx1nu9 _10cr1ssb _zfav1ssb _m7eu1ooe _l9o0n7od _1efjn7od _1u2istnw _32ro1j9a _1wn015vq _den512j9 _zh8l1b66 _g5w3stnw _whhepxbi _1stbpxbi _18tob3bt _1awt1ule _haf81ssb _ra781ssb _cr751ooe _1q8r7vkz _9l2s7vkz _1mh7kb7n _s3uktlke _1davidpf _8bo8stnw _psnc1ssb _4k421ssb _1rvv1ooe _13vl73ad _1t711tcg _1nuz1tcg _cs4qstnw _9j2j1ssb _1mwj1ssb _19l51ooe _12yy1d5g _1miy1elr _1umo18hz _tpz25w2r _k6dg18hz _1qduewfl _q8ft1fvw _1y9t5w2r _ut031fvw _gi9hr01l _1qp6muej _wxkgr01l _wo245w2r _c8dpmuej _d2dcsyzs _1eulsyzs _1bc7syzs _16fmsyzs _bhkusyzs _czfesyzs _1gxgsyzs _19w0syzs _1x1y1lg7"]),
|
|
173
|
+
style: {
|
|
174
|
+
"--_toyvsf": ix("2px solid ".concat("var(--ds-border-focused, #388BFF)"))
|
|
175
|
+
}
|
|
176
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
177
|
+
id: checkBoxId,
|
|
178
|
+
"aria-labelledby": "".concat(checkBoxId, "-wrapper"),
|
|
179
|
+
name: checkBoxId,
|
|
180
|
+
type: "checkbox",
|
|
181
|
+
onChange: handleOnChange,
|
|
182
|
+
onClick: onClick,
|
|
183
|
+
checked: !!isDone,
|
|
184
|
+
disabled: !!disabled,
|
|
185
|
+
suppressHydrationWarning: true,
|
|
186
|
+
onKeyPress: handleOnKeyPress,
|
|
187
|
+
ref: inputRef
|
|
188
|
+
}), isDone ? /*#__PURE__*/React.createElement(CheckboxCheckedIcon, {
|
|
189
|
+
label: ""
|
|
190
|
+
}) : /*#__PURE__*/React.createElement(CheckboxUncheckedIcon, {
|
|
191
|
+
label: ""
|
|
192
|
+
}));
|
|
193
|
+
React.useEffect(function () {
|
|
194
|
+
if (isFocused && inputRef.current) {
|
|
195
|
+
var _inputRef$current4, _inputRef$current5;
|
|
196
|
+
(_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 || _inputRef$current4.focus();
|
|
197
|
+
(_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 || _inputRef$current5.blur();
|
|
198
|
+
setTimeout(function () {
|
|
199
|
+
var _inputRef$current6;
|
|
200
|
+
(_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 || _inputRef$current6.focus();
|
|
201
|
+
}, 100);
|
|
202
|
+
}
|
|
203
|
+
}, [isFocused, inputRef]);
|
|
204
|
+
return /*#__PURE__*/React.createElement(Item, {
|
|
205
|
+
appearance: appearance,
|
|
206
|
+
contentRef: contentRef,
|
|
207
|
+
icon: icon,
|
|
208
|
+
placeholder: placeholder,
|
|
209
|
+
showPlaceholder: showPlaceholder,
|
|
210
|
+
itemType: "TASK",
|
|
211
|
+
dataAttributes: dataAttributes,
|
|
212
|
+
checkBoxId: checkBoxId
|
|
213
|
+
}, children);
|
|
214
|
+
};
|
|
122
215
|
|
|
123
216
|
// This is to ensure that the "type" is exported, as it gets lost and not exported along with TaskItem after
|
|
124
217
|
// going through the high order component.
|
|
125
218
|
|
|
126
|
-
export default withAnalyticsEvents()(
|
|
219
|
+
export default componentWithFG('platform_editor_task_item_ref_fix', withAnalyticsEvents()(TaskItemWithRefFix), withAnalyticsEvents()(TaskItemWithoutRefFix));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { type
|
|
1
|
+
import React, { type Ref } from 'react';
|
|
2
2
|
import { PureComponent } from 'react';
|
|
3
3
|
import { type Appearance, type ContentRef, type TaskDecisionProvider } from '../types';
|
|
4
4
|
export interface Props {
|
|
@@ -19,7 +19,7 @@ export interface Props {
|
|
|
19
19
|
dataAttributes?: {
|
|
20
20
|
[key: string]: string | number;
|
|
21
21
|
};
|
|
22
|
-
inputRef?:
|
|
22
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
23
23
|
disableOnChange?: boolean;
|
|
24
24
|
}
|
|
25
25
|
export interface State {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { Ref } from 'react';
|
|
6
6
|
import { type Appearance, type ContentRef } from '../types';
|
|
7
7
|
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
8
8
|
export interface Props {
|
|
@@ -21,7 +21,7 @@ export interface Props {
|
|
|
21
21
|
dataAttributes?: {
|
|
22
22
|
[key: string]: string | number;
|
|
23
23
|
};
|
|
24
|
-
inputRef?:
|
|
24
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
25
25
|
}
|
|
26
|
-
declare const _default: React.
|
|
26
|
+
declare const _default: React.FC<Omit<Omit<Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>, "ref"> & React.RefAttributes<any>>;
|
|
27
27
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { type
|
|
1
|
+
import React, { type Ref } from 'react';
|
|
2
2
|
import { PureComponent } from 'react';
|
|
3
3
|
import { type Appearance, type ContentRef, type TaskDecisionProvider } from '../types';
|
|
4
4
|
export interface Props {
|
|
@@ -19,7 +19,7 @@ export interface Props {
|
|
|
19
19
|
dataAttributes?: {
|
|
20
20
|
[key: string]: string | number;
|
|
21
21
|
};
|
|
22
|
-
inputRef?:
|
|
22
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
23
23
|
disableOnChange?: boolean;
|
|
24
24
|
}
|
|
25
25
|
export interface State {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { Ref } from 'react';
|
|
6
6
|
import { type Appearance, type ContentRef } from '../types';
|
|
7
7
|
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
8
8
|
export interface Props {
|
|
@@ -21,7 +21,7 @@ export interface Props {
|
|
|
21
21
|
dataAttributes?: {
|
|
22
22
|
[key: string]: string | number;
|
|
23
23
|
};
|
|
24
|
-
inputRef?:
|
|
24
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
25
25
|
}
|
|
26
|
-
declare const _default: React.
|
|
26
|
+
declare const _default: React.FC<Omit<Omit<Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>, "ref"> & React.RefAttributes<any>>;
|
|
27
27
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/task-decision",
|
|
3
|
-
"version": "19.1.
|
|
3
|
+
"version": "19.1.4",
|
|
4
4
|
"description": "Tasks and decisions react components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -43,11 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@atlaskit/analytics-namespaced-context": "^7.0.0",
|
|
45
45
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
46
|
-
"@atlaskit/icon": "^25.
|
|
47
|
-
"@atlaskit/
|
|
46
|
+
"@atlaskit/icon": "^25.6.0",
|
|
47
|
+
"@atlaskit/platform-feature-flags-react": "^0.1.0",
|
|
48
|
+
"@atlaskit/tokens": "^4.7.0",
|
|
48
49
|
"@atlaskit/util-service-support": "^6.3.0",
|
|
49
50
|
"@babel/runtime": "^7.0.0",
|
|
50
51
|
"@compiled/react": "^0.18.3",
|
|
52
|
+
"use-callback-ref": "^1.2.3",
|
|
51
53
|
"uuid": "^3.1.0"
|
|
52
54
|
},
|
|
53
55
|
"peerDependencies": {
|