@atlaskit/task-decision 17.4.3 → 17.5.0
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 +22 -0
- package/dist/cjs/components/DecisionItem.js +58 -71
- package/dist/cjs/components/DecisionList.js +6 -3
- package/dist/cjs/components/Item.js +73 -20
- package/dist/cjs/components/TaskItem.js +89 -96
- package/dist/cjs/components/TaskList.js +7 -4
- package/dist/cjs/components/listStyle.js +21 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/DecisionItem.js +51 -34
- package/dist/es2019/components/DecisionList.js +6 -3
- package/dist/es2019/components/Item.js +70 -16
- package/dist/es2019/components/TaskItem.js +154 -72
- package/dist/es2019/components/TaskList.js +7 -4
- package/dist/es2019/components/listStyle.js +12 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/DecisionItem.js +54 -62
- package/dist/esm/components/DecisionList.js +6 -3
- package/dist/esm/components/Item.js +72 -16
- package/dist/esm/components/TaskItem.js +86 -92
- package/dist/esm/components/TaskList.js +7 -4
- package/dist/esm/components/listStyle.js +12 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/DecisionItem.d.ts +4 -5
- package/dist/types/components/DecisionList.d.ts +3 -1
- package/dist/types/components/Item.d.ts +6 -2
- package/dist/types/components/TaskItem.d.ts +2 -11
- package/dist/types/components/TaskList.d.ts +2 -1
- package/dist/types/components/listStyle.d.ts +2 -0
- package/package.json +11 -9
- package/report.api.md +334 -0
- package/dist/cjs/styled/DecisionItem.js +0 -31
- package/dist/cjs/styled/Item.js +0 -41
- package/dist/cjs/styled/ListWrapper.js +0 -24
- package/dist/cjs/styled/Placeholder.js +0 -24
- package/dist/cjs/styled/TaskItem.js +0 -46
- package/dist/es2019/styled/DecisionItem.js +0 -21
- package/dist/es2019/styled/Item.js +0 -39
- package/dist/es2019/styled/ListWrapper.js +0 -20
- package/dist/es2019/styled/Placeholder.js +0 -15
- package/dist/es2019/styled/TaskItem.js +0 -95
- package/dist/esm/styled/DecisionItem.js +0 -17
- package/dist/esm/styled/Item.js +0 -18
- package/dist/esm/styled/ListWrapper.js +0 -11
- package/dist/esm/styled/Placeholder.js +0 -12
- package/dist/esm/styled/TaskItem.js +0 -26
- package/dist/types/styled/DecisionItem.d.ts +0 -5
- package/dist/types/styled/Item.d.ts +0 -7
- package/dist/types/styled/ListWrapper.d.ts +0 -4
- package/dist/types/styled/Placeholder.d.ts +0 -5
- package/dist/types/styled/TaskItem.d.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/task-decision
|
|
2
2
|
|
|
3
|
+
## 17.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`2112384b533`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2112384b533) - Replaced styled components with emotion.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 17.4.5
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
18
|
+
|
|
19
|
+
## 17.4.4
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [`bffe28af76b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bffe28af76b) - ED-14764: Modified CSS display attribute for checkboxes in action items slightly to address the problem seen in firefox where the cursor does not move to the previous item using the up arrow key. No appearance changes to the component as a result of this modification.
|
|
24
|
+
|
|
3
25
|
## 17.4.3
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -2,84 +2,71 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = void 0;
|
|
11
9
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _react = require("@emotion/react");
|
|
25
11
|
|
|
26
12
|
var _decision = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/decision"));
|
|
27
13
|
|
|
28
|
-
var _DecisionItem = require("../styled/DecisionItem");
|
|
29
|
-
|
|
30
14
|
var _Item = _interopRequireDefault(require("./Item"));
|
|
31
15
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
16
|
+
var _tokens = require("@atlaskit/tokens");
|
|
17
|
+
|
|
18
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
19
|
+
|
|
20
|
+
var _components = require("@atlaskit/theme/components");
|
|
21
|
+
|
|
22
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
23
|
+
|
|
24
|
+
/** @jsx jsx */
|
|
25
|
+
var iconStyles = function iconStyles(showPlaceholder) {
|
|
26
|
+
return function (theme) {
|
|
27
|
+
return (0, _react.css)({
|
|
28
|
+
flex: '0 0 16px',
|
|
29
|
+
height: '16px',
|
|
30
|
+
width: '16px',
|
|
31
|
+
margin: "4px ".concat((0, _constants.gridSize)() * 1.5, "px 0 0"),
|
|
32
|
+
color: showPlaceholder ? (0, _tokens.token)('color.icon.subtle', _colors.N100) : (0, _components.themed)({
|
|
33
|
+
light: (0, _tokens.token)('color.icon.success', _colors.G400),
|
|
34
|
+
dark: (0, _tokens.token)('color.icon.success', _colors.G200)
|
|
35
|
+
})({
|
|
36
|
+
theme: theme
|
|
37
|
+
}),
|
|
38
|
+
'> span': {
|
|
39
|
+
margin: '-8px'
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var DecisionItem = function DecisionItem(_ref) {
|
|
46
|
+
var appearance = _ref.appearance,
|
|
47
|
+
children = _ref.children,
|
|
48
|
+
contentRef = _ref.contentRef,
|
|
49
|
+
placeholder = _ref.placeholder,
|
|
50
|
+
showPlaceholder = _ref.showPlaceholder,
|
|
51
|
+
dataAttributes = _ref.dataAttributes;
|
|
52
|
+
var theme = (0, _components.useGlobalTheme)();
|
|
53
|
+
var icon = (0, _react.jsx)("span", {
|
|
54
|
+
css: iconStyles(showPlaceholder)(theme)
|
|
55
|
+
}, (0, _react.jsx)(_decision.default, {
|
|
56
|
+
label: "Decision",
|
|
57
|
+
size: "large"
|
|
58
|
+
}));
|
|
59
|
+
return (0, _react.jsx)(_Item.default, {
|
|
60
|
+
appearance: appearance,
|
|
61
|
+
contentRef: contentRef,
|
|
62
|
+
icon: icon,
|
|
63
|
+
placeholder: placeholder,
|
|
64
|
+
showPlaceholder: showPlaceholder,
|
|
65
|
+
itemType: "DECISION",
|
|
66
|
+
dataAttributes: dataAttributes,
|
|
67
|
+
theme: theme
|
|
68
|
+
}, children);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var _default = DecisionItem;
|
|
72
|
+
exports.default = _default;
|
|
@@ -21,7 +21,9 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
21
21
|
|
|
22
22
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _react2 = require("@emotion/react");
|
|
25
|
+
|
|
26
|
+
var _listStyle = _interopRequireDefault(require("./listStyle"));
|
|
25
27
|
|
|
26
28
|
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); }
|
|
27
29
|
|
|
@@ -56,13 +58,14 @@ var DecisionList = /*#__PURE__*/function (_PureComponent) {
|
|
|
56
58
|
// a new uuid generated by the editor for the cloned content.
|
|
57
59
|
|
|
58
60
|
|
|
59
|
-
return
|
|
61
|
+
return (0, _react2.jsx)("ol", {
|
|
62
|
+
css: _listStyle.default,
|
|
60
63
|
"data-decision-list-local-id": "",
|
|
61
64
|
"data-node-type": "decisionList"
|
|
62
65
|
}, _react.default.Children.map(children, function (child, idx) {
|
|
63
66
|
var _ref = child.props,
|
|
64
67
|
localId = _ref.localId;
|
|
65
|
-
return
|
|
68
|
+
return (0, _react2.jsx)("li", {
|
|
66
69
|
key: idx,
|
|
67
70
|
"data-decision-local-id": localId || '',
|
|
68
71
|
"data-decision-state": "DECIDED"
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -23,22 +21,69 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
23
21
|
|
|
24
22
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
23
|
|
|
26
|
-
var _react =
|
|
24
|
+
var _react = require("react");
|
|
27
25
|
|
|
28
|
-
var
|
|
26
|
+
var _react2 = require("@emotion/react");
|
|
29
27
|
|
|
30
|
-
var
|
|
28
|
+
var _components = require("@atlaskit/theme/components");
|
|
31
29
|
|
|
32
|
-
var
|
|
30
|
+
var _tokens = require("@atlaskit/tokens");
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
37
35
|
|
|
38
36
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
39
37
|
|
|
40
38
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
39
|
|
|
40
|
+
var contentStyle = (0, _react2.css)({
|
|
41
|
+
margin: 0,
|
|
42
|
+
wordWrap: 'break-word',
|
|
43
|
+
minWidth: 0,
|
|
44
|
+
flex: '1 1 auto'
|
|
45
|
+
});
|
|
46
|
+
var taskStyles = (0, _react2.css)({
|
|
47
|
+
display: 'flex',
|
|
48
|
+
flexDirection: 'row',
|
|
49
|
+
padding: '6px 3px',
|
|
50
|
+
position: 'relative'
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
var decisionStyles = function decisionStyles(theme) {
|
|
54
|
+
return (0, _react2.css)({
|
|
55
|
+
display: 'flex',
|
|
56
|
+
flexDirection: 'row',
|
|
57
|
+
margin: "".concat((0, _constants.gridSize)(), "px 0 0 0"),
|
|
58
|
+
padding: "".concat((0, _constants.gridSize)(), "px"),
|
|
59
|
+
paddingLeft: "".concat((0, _constants.gridSize)() * 1.5, "px"),
|
|
60
|
+
borderRadius: "".concat((0, _constants.borderRadius)(), "px"),
|
|
61
|
+
backgroundColor: (0, _components.themed)({
|
|
62
|
+
light: (0, _tokens.token)('color.background.neutral', _colors.N20A),
|
|
63
|
+
dark: (0, _tokens.token)('color.background.neutral', _colors.DN50)
|
|
64
|
+
})({
|
|
65
|
+
theme: theme
|
|
66
|
+
}),
|
|
67
|
+
position: 'relative',
|
|
68
|
+
'.decision-item': {
|
|
69
|
+
cursor: 'initial'
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var placeHolderStyles = function placeHolderStyles(offset) {
|
|
75
|
+
return (0, _react2.css)({
|
|
76
|
+
margin: "0 0 0 ".concat(offset, "px"),
|
|
77
|
+
position: 'absolute',
|
|
78
|
+
color: (0, _tokens.token)('color.text.subtlest', _colors.N100),
|
|
79
|
+
pointerEvents: 'none',
|
|
80
|
+
textOverflow: 'ellipsis',
|
|
81
|
+
overflow: 'hidden',
|
|
82
|
+
whiteSpace: 'nowrap',
|
|
83
|
+
maxWidth: 'calc(100% - 50px)'
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
42
87
|
var Item = /*#__PURE__*/function (_PureComponent) {
|
|
43
88
|
(0, _inherits2.default)(Item, _PureComponent);
|
|
44
89
|
|
|
@@ -63,9 +108,10 @@ var Item = /*#__PURE__*/function (_PureComponent) {
|
|
|
63
108
|
}
|
|
64
109
|
|
|
65
110
|
var offset = (0, _constants.gridSize)() * (itemType === 'TASK' ? 3 : 3.5);
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
111
|
+
return (0, _react2.jsx)("span", {
|
|
112
|
+
"data-component": "placeholder",
|
|
113
|
+
css: placeHolderStyles(offset),
|
|
114
|
+
contentEditable: false
|
|
69
115
|
}, placeholder);
|
|
70
116
|
}
|
|
71
117
|
}, {
|
|
@@ -76,21 +122,28 @@ var Item = /*#__PURE__*/function (_PureComponent) {
|
|
|
76
122
|
children = _this$props2.children,
|
|
77
123
|
icon = _this$props2.icon,
|
|
78
124
|
itemType = _this$props2.itemType,
|
|
125
|
+
checkBoxId = _this$props2.checkBoxId,
|
|
79
126
|
dataAttributes = _this$props2.dataAttributes,
|
|
80
|
-
|
|
127
|
+
theme = _this$props2.theme;
|
|
81
128
|
|
|
82
129
|
if (itemType === 'TASK') {
|
|
83
|
-
return
|
|
130
|
+
return (0, _react2.jsx)("div", {
|
|
131
|
+
css: taskStyles,
|
|
84
132
|
id: "".concat(checkBoxId, "-wrapper")
|
|
85
|
-
}, icon, this.renderPlaceholder(),
|
|
86
|
-
|
|
87
|
-
|
|
133
|
+
}, icon, this.renderPlaceholder(), (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
134
|
+
"data-component": "content",
|
|
135
|
+
css: contentStyle,
|
|
136
|
+
ref: contentRef
|
|
137
|
+
}, dataAttributes), children));
|
|
88
138
|
} else if (itemType === 'DECISION') {
|
|
89
|
-
return
|
|
139
|
+
return (0, _react2.jsx)("div", {
|
|
140
|
+
css: decisionStyles(theme),
|
|
90
141
|
"data-decision-wrapper": "true"
|
|
91
|
-
}, icon, this.renderPlaceholder(),
|
|
92
|
-
|
|
93
|
-
|
|
142
|
+
}, icon, this.renderPlaceholder(), (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
143
|
+
"data-component": "content",
|
|
144
|
+
css: contentStyle,
|
|
145
|
+
ref: contentRef
|
|
146
|
+
}, dataAttributes), children));
|
|
94
147
|
}
|
|
95
148
|
|
|
96
149
|
return null;
|
|
@@ -7,62 +7,85 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.default =
|
|
10
|
+
exports.default = void 0;
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _react2 = require("@emotion/react");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _Item = _interopRequireDefault(require("./Item"));
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _analytics = require("../analytics");
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _components = require("@atlaskit/theme/components");
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _tokens = require("@atlaskit/tokens");
|
|
29
29
|
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
30
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
33
31
|
|
|
34
|
-
var
|
|
32
|
+
var _templateObject, _templateObject2;
|
|
35
33
|
|
|
36
34
|
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); }
|
|
37
35
|
|
|
38
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
37
|
|
|
40
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
41
|
-
|
|
42
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
|
-
|
|
44
38
|
var taskCount = 0;
|
|
45
39
|
|
|
46
40
|
var getCheckBoxId = function getCheckBoxId(localId) {
|
|
47
41
|
return "".concat(localId, "-").concat(taskCount++);
|
|
48
42
|
};
|
|
49
43
|
|
|
50
|
-
var
|
|
51
|
-
(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
var checkboxStyles = function checkboxStyles(isRenderer) {
|
|
45
|
+
return function (theme) {
|
|
46
|
+
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n flex: 0 0 16px;\n width: 16px;\n height: 16px;\n position: relative;\n align-self: start;\n margin: 4px ", "px 0 0;\n\n & > input[type='checkbox'] {\n width: 16px;\n height: 16px;\n z-index: 1;\n cursor: pointer;\n position: absolute;\n outline: none;\n margin: 0;\n opacity: 0;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n\n + div {\n box-sizing: border-box;\n display: inline;\n width: 100%;\n cursor: pointer;\n\n &::after {\n background: ", ";\n background-size: 16px;\n border-radius: 3px;\n border-style: solid;\n border-width: 1px;\n border-color: ", ";\n box-sizing: border-box;\n content: '';\n height: 16px;\n left: 50%;\n position: absolute;\n transition: border-color 0.2s ease-in-out;\n top: 8px;\n width: 16px;\n transform: translate(-50%, -50%);\n }\n }\n ", "\n\n &:not([disabled]):hover + div::after {\n background: ", ";\n transition: border 0.2s ease-in-out;\n }\n &[disabled] + div {\n opacity: 0.5;\n cursor: default;\n }\n &:checked {\n + div::after {\n background: url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8c3ZnIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiIgdmlld0JveD0iMCAwIDEyIDEyIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPg0KICA8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHJ4PSIyIiBmaWxsPSIjMDA1MkNDIj48L3JlY3Q+DQogIDxwYXRoIGZpbGw9IiNGRkZGRkYiIGQ9Ik05LjM3NCA0LjkxNEw1LjQ1NiA4LjgzMmEuNzY5Ljc2OSAwIDAgMS0xLjA4OCAwTDIuNjI2IDcuMDkxYS43NjkuNzY5IDAgMSAxIDEuMDg4LTEuMDg5TDQuOTEyIDcuMmwzLjM3NC0zLjM3NGEuNzY5Ljc2OSAwIDEgMSAxLjA4OCAxLjA4OCI+PC9wYXRoPg0KPC9zdmc+)\n no-repeat 0 0;\n background-size: 16px;\n border: 0;\n border-color: transparent;\n }\n &:not([disabled]):hover + div::after {\n background: url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8c3ZnIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiIgdmlld0JveD0iMCAwIDEyIDEyIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPg0KICA8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHJ4PSIyIiBmaWxsPSIjMDc0N0E2Ij48L3JlY3Q+DQogIDxwYXRoIGZpbGw9IiNGRkZGRkYiIGQ9Ik05LjM3NCA0LjkxNEw1LjQ1NiA4LjgzMmEuNzY5Ljc2OSAwIDAgMS0xLjA4OCAwTDIuNjI2IDcuMDkxYS43NjkuNzY5IDAgMSAxIDEuMDg4LTEuMDg5TDQuOTEyIDcuMmwzLjM3NC0zLjM3NGEuNzY5Ljc2OSAwIDEgMSAxLjA4OCAxLjA4OCI+PC9wYXRoPg0KPC9zdmc+)\n no-repeat 0 0;\n background-size: 16px;\n }\n }\n }\n "])), (0, _constants.gridSize)(), (0, _components.themed)({
|
|
47
|
+
light: (0, _tokens.token)('color.background.input', _colors.N0),
|
|
48
|
+
dark: (0, _tokens.token)('color.background.input', _colors.DN100)
|
|
49
|
+
})({
|
|
50
|
+
theme: theme
|
|
51
|
+
}), (0, _components.themed)({
|
|
52
|
+
light: (0, _tokens.token)('color.border', _colors.N90),
|
|
53
|
+
dark: (0, _tokens.token)('color.border', _colors.DN200)
|
|
54
|
+
})({
|
|
55
|
+
theme: theme
|
|
56
|
+
}), isRenderer ? (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n &:focus-visible + div:after {\n outline: 2px solid\n ", ";\n }\n "])), (0, _components.themed)({
|
|
57
|
+
light: (0, _tokens.token)('color.border.focused', _colors.B300),
|
|
58
|
+
dark: (0, _tokens.token)('color.border.focused', _colors.B75)
|
|
59
|
+
})({
|
|
60
|
+
theme: theme
|
|
61
|
+
})) : '', (0, _components.themed)({
|
|
62
|
+
light: (0, _tokens.token)('color.background.input', _colors.N30),
|
|
63
|
+
dark: (0, _tokens.token)('color.background.input', _colors.B75)
|
|
64
|
+
})({
|
|
65
|
+
theme: theme
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
};
|
|
57
69
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
var TaskItem = function TaskItem(props) {
|
|
71
|
+
var appearance = props.appearance,
|
|
72
|
+
isDone = props.isDone,
|
|
73
|
+
isRenderer = props.isRenderer,
|
|
74
|
+
contentRef = props.contentRef,
|
|
75
|
+
children = props.children,
|
|
76
|
+
placeholder = props.placeholder,
|
|
77
|
+
showPlaceholder = props.showPlaceholder,
|
|
78
|
+
disabled = props.disabled,
|
|
79
|
+
dataAttributes = props.dataAttributes,
|
|
80
|
+
taskId = props.taskId,
|
|
81
|
+
onChange = props.onChange,
|
|
82
|
+
createAnalyticsEvent = props.createAnalyticsEvent;
|
|
83
|
+
var theme = (0, _components.useGlobalTheme)();
|
|
84
|
+
var checkBoxId = (0, _react.useMemo)(function () {
|
|
85
|
+
return getCheckBoxId(taskId);
|
|
86
|
+
}, [taskId]);
|
|
87
|
+
var handleOnChange = (0, _react.useMemo)(function () {
|
|
88
|
+
return function (_evt) {
|
|
66
89
|
var newIsDone = !isDone;
|
|
67
90
|
|
|
68
91
|
if (onChange) {
|
|
@@ -81,74 +104,44 @@ var TaskItem = /*#__PURE__*/function (_PureComponent) {
|
|
|
81
104
|
}
|
|
82
105
|
})(createAnalyticsEvent);
|
|
83
106
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
107
|
+
};
|
|
108
|
+
}, [onChange, taskId, isDone, createAnalyticsEvent]);
|
|
109
|
+
var handleOnKeyPress = (0, _react.useMemo)(function () {
|
|
110
|
+
return function (event) {
|
|
86
111
|
if (event.key === 'Enter') {
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
_this.checkBoxId = getCheckBoxId(props.taskId);
|
|
91
|
-
return _this;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
(0, _createClass2.default)(TaskItem, [{
|
|
95
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
96
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
97
|
-
if (nextProps.taskId !== this.props.taskId) {
|
|
98
|
-
this.checkBoxId = getCheckBoxId(nextProps.taskId);
|
|
112
|
+
handleOnChange(event);
|
|
99
113
|
}
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}), /*#__PURE__*/_react.default.createElement("div", null));
|
|
129
|
-
|
|
130
|
-
return /*#__PURE__*/_react.default.createElement(_Item.default, {
|
|
131
|
-
appearance: appearance,
|
|
132
|
-
contentRef: contentRef,
|
|
133
|
-
icon: icon,
|
|
134
|
-
placeholder: placeholder,
|
|
135
|
-
showPlaceholder: showPlaceholder,
|
|
136
|
-
itemType: "TASK",
|
|
137
|
-
dataAttributes: dataAttributes,
|
|
138
|
-
checkBoxId: this.checkBoxId
|
|
139
|
-
}, children);
|
|
140
|
-
}
|
|
141
|
-
}]);
|
|
142
|
-
return TaskItem;
|
|
143
|
-
}(_react.PureComponent); // This is to ensure that the "type" is exported, as it gets lost and not exported along with TaskItem after
|
|
114
|
+
};
|
|
115
|
+
}, [handleOnChange]);
|
|
116
|
+
var icon = (0, _react2.jsx)("span", {
|
|
117
|
+
css: checkboxStyles(isRenderer)(theme),
|
|
118
|
+
contentEditable: false
|
|
119
|
+
}, (0, _react2.jsx)("input", {
|
|
120
|
+
id: checkBoxId,
|
|
121
|
+
"aria-labelledby": "".concat(checkBoxId, "-wrapper"),
|
|
122
|
+
name: checkBoxId,
|
|
123
|
+
type: "checkbox",
|
|
124
|
+
onChange: handleOnChange,
|
|
125
|
+
checked: !!isDone,
|
|
126
|
+
disabled: !!disabled,
|
|
127
|
+
suppressHydrationWarning: true,
|
|
128
|
+
onKeyPress: handleOnKeyPress
|
|
129
|
+
}), (0, _react2.jsx)("div", null));
|
|
130
|
+
return (0, _react2.jsx)(_Item.default, {
|
|
131
|
+
appearance: appearance,
|
|
132
|
+
contentRef: contentRef,
|
|
133
|
+
icon: icon,
|
|
134
|
+
placeholder: placeholder,
|
|
135
|
+
showPlaceholder: showPlaceholder,
|
|
136
|
+
itemType: "TASK",
|
|
137
|
+
dataAttributes: dataAttributes,
|
|
138
|
+
checkBoxId: checkBoxId,
|
|
139
|
+
theme: theme
|
|
140
|
+
}, children);
|
|
141
|
+
}; // This is to ensure that the "type" is exported, as it gets lost and not exported along with TaskItem after
|
|
144
142
|
// going through the high order component.
|
|
145
143
|
|
|
146
144
|
|
|
147
|
-
exports.TaskItem = TaskItem;
|
|
148
|
-
(0, _defineProperty2.default)(TaskItem, "defaultProps", {
|
|
149
|
-
appearance: 'inline'
|
|
150
|
-
});
|
|
151
|
-
|
|
152
145
|
var _default = (0, _analyticsNext.withAnalyticsEvents)()(TaskItem);
|
|
153
146
|
|
|
154
147
|
exports.default = _default;
|
|
@@ -21,10 +21,12 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
21
21
|
|
|
22
22
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _react2 = require("@emotion/react");
|
|
25
25
|
|
|
26
26
|
var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
|
|
27
27
|
|
|
28
|
+
var _listStyle = _interopRequireDefault(require("./listStyle"));
|
|
29
|
+
|
|
28
30
|
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); }
|
|
29
31
|
|
|
30
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -62,18 +64,19 @@ var TaskList = /*#__PURE__*/function (_PureComponent) {
|
|
|
62
64
|
// a new uuid generated by the editor for the cloned content.
|
|
63
65
|
|
|
64
66
|
|
|
65
|
-
return
|
|
67
|
+
return (0, _react2.jsx)("div", {
|
|
68
|
+
css: _listStyle.default,
|
|
66
69
|
"data-task-list-local-id": ""
|
|
67
70
|
}, _react.default.Children.map(children, function (child, idx) {
|
|
68
71
|
var _ref = child.props,
|
|
69
72
|
localId = _ref.localId;
|
|
70
|
-
return
|
|
73
|
+
return (0, _react2.jsx)(_analyticsNamespacedContext.FabricElementsAnalyticsContext, {
|
|
71
74
|
data: {
|
|
72
75
|
listLocalId: listId,
|
|
73
76
|
listSize: listSize,
|
|
74
77
|
position: idx
|
|
75
78
|
}
|
|
76
|
-
},
|
|
79
|
+
}, (0, _react2.jsx)("div", {
|
|
77
80
|
key: idx,
|
|
78
81
|
"data-task-local-id": localId || ''
|
|
79
82
|
}, child));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
|
+
|
|
10
|
+
var listStyle = (0, _react.css)({
|
|
11
|
+
/*
|
|
12
|
+
Increasing specificity with double ampersand to ensure these rules take
|
|
13
|
+
priority over the global styles applied to 'ol' elements.
|
|
14
|
+
*/
|
|
15
|
+
'&&': {
|
|
16
|
+
listStyleType: 'none',
|
|
17
|
+
paddingLeft: 0
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var _default = listStyle;
|
|
21
|
+
exports.default = _default;
|
package/dist/cjs/version.json
CHANGED