@dhis2-ui/node 8.1.11 → 8.2.2
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/build/cjs/leaves.js +15 -12
- package/build/cjs/node.js +16 -15
- package/build/cjs/node.stories.js +9 -11
- package/build/cjs/toggle.js +8 -7
- package/build/es/leaves.js +15 -12
- package/build/es/node.js +16 -15
- package/build/es/node.stories.js +8 -10
- package/build/es/toggle.js +8 -7
- package/package.json +3 -3
package/build/cjs/leaves.js
CHANGED
|
@@ -15,18 +15,21 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
const Leaves =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
18
|
+
const Leaves = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
children,
|
|
21
|
+
open,
|
|
22
|
+
dataTest
|
|
23
|
+
} = _ref;
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
+
"data-test": dataTest,
|
|
26
|
+
className: "jsx-3677374542" + " " + ((0, _classnames.default)({
|
|
27
|
+
open
|
|
28
|
+
}) || "")
|
|
29
|
+
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
30
|
+
id: "3677374542"
|
|
31
|
+
}, ["div.jsx-3677374542{height:0;overflow:hidden;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".open.jsx-3677374542{height:auto;}"]));
|
|
32
|
+
};
|
|
30
33
|
|
|
31
34
|
exports.Leaves = Leaves;
|
|
32
35
|
Leaves.propTypes = {
|
package/build/cjs/node.js
CHANGED
|
@@ -21,16 +21,17 @@ var _toggle = require("./toggle.js");
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
|
-
const Node =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
const Node = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
open,
|
|
27
|
+
className,
|
|
28
|
+
component: label,
|
|
29
|
+
children,
|
|
30
|
+
icon,
|
|
31
|
+
onOpen,
|
|
32
|
+
onClose,
|
|
33
|
+
dataTest
|
|
34
|
+
} = _ref;
|
|
34
35
|
const hasLeaves = !!_react.default.Children.toArray(children).filter(i => i).length;
|
|
35
36
|
const showArrow = !icon && hasLeaves;
|
|
36
37
|
const showSpacer = !icon && !hasLeaves;
|
|
@@ -38,22 +39,22 @@ const Node = ({
|
|
|
38
39
|
"data-test": dataTest,
|
|
39
40
|
className: "jsx-1433072554" + " " + ((0, _classnames.default)('node', className) || "")
|
|
40
41
|
}, icon && /*#__PURE__*/_react.default.createElement("div", {
|
|
41
|
-
"data-test":
|
|
42
|
+
"data-test": "".concat(dataTest, "-icon"),
|
|
42
43
|
className: "jsx-1433072554"
|
|
43
44
|
}, icon), showArrow && /*#__PURE__*/_react.default.createElement(_toggle.Toggle, {
|
|
44
45
|
open: open,
|
|
45
46
|
onOpen: onOpen,
|
|
46
47
|
onClose: onClose,
|
|
47
|
-
dataTest:
|
|
48
|
+
dataTest: "".concat(dataTest, "-toggle")
|
|
48
49
|
}), showSpacer && /*#__PURE__*/_react.default.createElement(_spacer.Spacer, null), /*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
-
"data-test":
|
|
50
|
+
"data-test": "".concat(dataTest, "-content"),
|
|
50
51
|
className: "jsx-1433072554"
|
|
51
52
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
52
|
-
"data-test":
|
|
53
|
+
"data-test": "".concat(dataTest, "-label"),
|
|
53
54
|
className: "jsx-1433072554"
|
|
54
55
|
}, label), /*#__PURE__*/_react.default.createElement(_leaves.Leaves, {
|
|
55
56
|
open: open,
|
|
56
|
-
dataTest:
|
|
57
|
+
dataTest: "".concat(dataTest, "-leaves")
|
|
57
58
|
}, children)), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
58
59
|
id: "1433072554"
|
|
59
60
|
}, [".node.jsx-1433072554{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}"]));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = exports._2LevelsOpen = exports.TextLeaves = exports.MultipleRoots = exports.CustomIcon = void 0;
|
|
7
7
|
|
|
8
8
|
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
9
|
|
|
@@ -19,13 +19,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
19
|
|
|
20
20
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
21
|
|
|
22
|
-
const description =
|
|
23
|
-
A tool for creating hierarchical, multi-level selectors. Applied in the Organisation Unit Tree component, for example.
|
|
24
|
-
|
|
25
|
-
\`\`\`js
|
|
26
|
-
import { Node } from '@dhis2/ui'
|
|
27
|
-
\`\`\`
|
|
28
|
-
`;
|
|
22
|
+
const description = "\nA tool for creating hierarchical, multi-level selectors. Applied in the Organisation Unit Tree component, for example.\n\n```js\nimport { Node } from '@dhis2/ui'\n```\n";
|
|
29
23
|
|
|
30
24
|
const say = something => () => alert(something);
|
|
31
25
|
|
|
@@ -39,12 +33,16 @@ window.onClose = (payload, event) => {
|
|
|
39
33
|
console.log('onClose event', event);
|
|
40
34
|
};
|
|
41
35
|
|
|
42
|
-
const onOpen = (
|
|
36
|
+
const onOpen = function () {
|
|
37
|
+
return window.onOpen(...arguments);
|
|
38
|
+
};
|
|
43
39
|
|
|
44
|
-
const onClose = (
|
|
40
|
+
const onClose = function () {
|
|
41
|
+
return window.onClose(...arguments);
|
|
42
|
+
};
|
|
45
43
|
|
|
46
44
|
var _default = {
|
|
47
|
-
title: '
|
|
45
|
+
title: 'Node',
|
|
48
46
|
component: _node.Node,
|
|
49
47
|
parameters: {
|
|
50
48
|
docs: {
|
package/build/cjs/toggle.js
CHANGED
|
@@ -28,12 +28,13 @@ const ArrowDown = () => /*#__PURE__*/_react.default.createElement("svg", {
|
|
|
28
28
|
id: "2769585603"
|
|
29
29
|
}, ["svg.jsx-2769585603{fill:inherit;height:24px;width:24px;vertical-align:middle;pointer-events:none;}"]));
|
|
30
30
|
|
|
31
|
-
const Toggle =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
const Toggle = _ref => {
|
|
32
|
+
let {
|
|
33
|
+
open,
|
|
34
|
+
onOpen,
|
|
35
|
+
onClose,
|
|
36
|
+
dataTest
|
|
37
|
+
} = _ref;
|
|
37
38
|
const onClick = open ? onClose : onOpen;
|
|
38
39
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
39
40
|
"data-test": dataTest,
|
|
@@ -48,7 +49,7 @@ const Toggle = ({
|
|
|
48
49
|
}, /*#__PURE__*/_react.default.createElement(ArrowDown, null)), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
49
50
|
id: "486382662",
|
|
50
51
|
dynamic: [_uiConstants.colors.grey400, _uiConstants.colors.grey700]
|
|
51
|
-
}, ["div.__jsx-style-dynamic-selector{width:24px;position:relative;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}",
|
|
52
|
+
}, ["div.__jsx-style-dynamic-selector{width:24px;position:relative;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}", "div.__jsx-style-dynamic-selector:after{background:".concat(_uiConstants.colors.grey400, ";height:calc(100% - 24px);left:12px;position:absolute;top:15px;width:1px;z-index:1;}"), ".open.__jsx-style-dynamic-selector:after{content:'';}", "span.__jsx-style-dynamic-selector{display:block;position:relative;z-index:2;fill:".concat(_uiConstants.colors.grey700, ";}"), "div.__jsx-style-dynamic-selector svg{vertical-align:top;-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);}", ".open.__jsx-style-dynamic-selector svg{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);}"]));
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
exports.Toggle = Toggle;
|
package/build/es/leaves.js
CHANGED
|
@@ -2,18 +2,21 @@ import _JSXStyle from "styled-jsx/style";
|
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
export const Leaves =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
5
|
+
export const Leaves = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
open,
|
|
9
|
+
dataTest
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
"data-test": dataTest,
|
|
13
|
+
className: "jsx-3677374542" + " " + (cx({
|
|
14
|
+
open
|
|
15
|
+
}) || "")
|
|
16
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
17
|
+
id: "3677374542"
|
|
18
|
+
}, ["div.jsx-3677374542{height:0;overflow:hidden;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".open.jsx-3677374542{height:auto;}"]));
|
|
19
|
+
};
|
|
17
20
|
Leaves.propTypes = {
|
|
18
21
|
children: PropTypes.node,
|
|
19
22
|
dataTest: PropTypes.string,
|
package/build/es/node.js
CHANGED
|
@@ -5,16 +5,17 @@ import React from 'react';
|
|
|
5
5
|
import { Leaves } from './leaves.js';
|
|
6
6
|
import { Spacer } from './spacer.js';
|
|
7
7
|
import { Toggle } from './toggle.js';
|
|
8
|
-
export const Node =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
export const Node = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
open,
|
|
11
|
+
className,
|
|
12
|
+
component: label,
|
|
13
|
+
children,
|
|
14
|
+
icon,
|
|
15
|
+
onOpen,
|
|
16
|
+
onClose,
|
|
17
|
+
dataTest
|
|
18
|
+
} = _ref;
|
|
18
19
|
const hasLeaves = !!React.Children.toArray(children).filter(i => i).length;
|
|
19
20
|
const showArrow = !icon && hasLeaves;
|
|
20
21
|
const showSpacer = !icon && !hasLeaves;
|
|
@@ -22,22 +23,22 @@ export const Node = ({
|
|
|
22
23
|
"data-test": dataTest,
|
|
23
24
|
className: "jsx-1433072554" + " " + (cx('node', className) || "")
|
|
24
25
|
}, icon && /*#__PURE__*/React.createElement("div", {
|
|
25
|
-
"data-test":
|
|
26
|
+
"data-test": "".concat(dataTest, "-icon"),
|
|
26
27
|
className: "jsx-1433072554"
|
|
27
28
|
}, icon), showArrow && /*#__PURE__*/React.createElement(Toggle, {
|
|
28
29
|
open: open,
|
|
29
30
|
onOpen: onOpen,
|
|
30
31
|
onClose: onClose,
|
|
31
|
-
dataTest:
|
|
32
|
+
dataTest: "".concat(dataTest, "-toggle")
|
|
32
33
|
}), showSpacer && /*#__PURE__*/React.createElement(Spacer, null), /*#__PURE__*/React.createElement("div", {
|
|
33
|
-
"data-test":
|
|
34
|
+
"data-test": "".concat(dataTest, "-content"),
|
|
34
35
|
className: "jsx-1433072554"
|
|
35
36
|
}, /*#__PURE__*/React.createElement("div", {
|
|
36
|
-
"data-test":
|
|
37
|
+
"data-test": "".concat(dataTest, "-label"),
|
|
37
38
|
className: "jsx-1433072554"
|
|
38
39
|
}, label), /*#__PURE__*/React.createElement(Leaves, {
|
|
39
40
|
open: open,
|
|
40
|
-
dataTest:
|
|
41
|
+
dataTest: "".concat(dataTest, "-leaves")
|
|
41
42
|
}, children)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
42
43
|
id: "1433072554"
|
|
43
44
|
}, [".node.jsx-1433072554{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}"]));
|
package/build/es/node.stories.js
CHANGED
|
@@ -6,13 +6,7 @@ import { Checkbox } from '@dhis2-ui/checkbox';
|
|
|
6
6
|
import { CircularLoader } from '@dhis2-ui/loader';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { Node } from './node.js';
|
|
9
|
-
const description =
|
|
10
|
-
A tool for creating hierarchical, multi-level selectors. Applied in the Organisation Unit Tree component, for example.
|
|
11
|
-
|
|
12
|
-
\`\`\`js
|
|
13
|
-
import { Node } from '@dhis2/ui'
|
|
14
|
-
\`\`\`
|
|
15
|
-
`;
|
|
9
|
+
const description = "\nA tool for creating hierarchical, multi-level selectors. Applied in the Organisation Unit Tree component, for example.\n\n```js\nimport { Node } from '@dhis2/ui'\n```\n";
|
|
16
10
|
|
|
17
11
|
const say = something => () => alert(something);
|
|
18
12
|
|
|
@@ -26,12 +20,16 @@ window.onClose = (payload, event) => {
|
|
|
26
20
|
console.log('onClose event', event);
|
|
27
21
|
};
|
|
28
22
|
|
|
29
|
-
const onOpen = (
|
|
23
|
+
const onOpen = function () {
|
|
24
|
+
return window.onOpen(...arguments);
|
|
25
|
+
};
|
|
30
26
|
|
|
31
|
-
const onClose = (
|
|
27
|
+
const onClose = function () {
|
|
28
|
+
return window.onClose(...arguments);
|
|
29
|
+
};
|
|
32
30
|
|
|
33
31
|
export default {
|
|
34
|
-
title: '
|
|
32
|
+
title: 'Node',
|
|
35
33
|
component: Node,
|
|
36
34
|
parameters: {
|
|
37
35
|
docs: {
|
package/build/es/toggle.js
CHANGED
|
@@ -15,12 +15,13 @@ const ArrowDown = () => /*#__PURE__*/React.createElement("svg", {
|
|
|
15
15
|
id: "2769585603"
|
|
16
16
|
}, ["svg.jsx-2769585603{fill:inherit;height:24px;width:24px;vertical-align:middle;pointer-events:none;}"]));
|
|
17
17
|
|
|
18
|
-
export const Toggle =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
export const Toggle = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
open,
|
|
21
|
+
onOpen,
|
|
22
|
+
onClose,
|
|
23
|
+
dataTest
|
|
24
|
+
} = _ref;
|
|
24
25
|
const onClick = open ? onClose : onOpen;
|
|
25
26
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
27
|
"data-test": dataTest,
|
|
@@ -35,7 +36,7 @@ export const Toggle = ({
|
|
|
35
36
|
}, /*#__PURE__*/React.createElement(ArrowDown, null)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
36
37
|
id: "486382662",
|
|
37
38
|
dynamic: [colors.grey400, colors.grey700]
|
|
38
|
-
}, ["div.__jsx-style-dynamic-selector{width:24px;position:relative;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}",
|
|
39
|
+
}, ["div.__jsx-style-dynamic-selector{width:24px;position:relative;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}", "div.__jsx-style-dynamic-selector:after{background:".concat(colors.grey400, ";height:calc(100% - 24px);left:12px;position:absolute;top:15px;width:1px;z-index:1;}"), ".open.__jsx-style-dynamic-selector:after{content:'';}", "span.__jsx-style-dynamic-selector{display:block;position:relative;z-index:2;fill:".concat(colors.grey700, ";}"), "div.__jsx-style-dynamic-selector svg{vertical-align:top;-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);}", ".open.__jsx-style-dynamic-selector svg{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);}"]));
|
|
39
40
|
};
|
|
40
41
|
Toggle.propTypes = {
|
|
41
42
|
dataTest: PropTypes.string.isRequired,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/node",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.2",
|
|
4
4
|
"description": "UI Node",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@dhis2/prop-types": "^3.0.0-beta.1",
|
|
35
|
-
"@dhis2-ui/loader": "8.
|
|
36
|
-
"@dhis2/ui-constants": "8.
|
|
35
|
+
"@dhis2-ui/loader": "8.2.2",
|
|
36
|
+
"@dhis2/ui-constants": "8.2.2",
|
|
37
37
|
"classnames": "^2.3.1",
|
|
38
38
|
"prop-types": "^15.7.2"
|
|
39
39
|
},
|