@dhis2-ui/organisation-unit-tree 8.2.0 → 8.2.1

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.
Files changed (125) hide show
  1. package/build/cjs/__e2e__/children_as_child_nodes.stories.e2e.js +11 -8
  2. package/build/cjs/__e2e__/common.js +53 -43
  3. package/build/cjs/__e2e__/controlled_expanded.stories.e2e.js +10 -7
  4. package/build/cjs/__e2e__/displaying_loading_error.stories.e2e.js +5 -1
  5. package/build/cjs/__e2e__/expanded.stories.e2e.js +35 -26
  6. package/build/cjs/__e2e__/force_reload.stories.e2e.js +21 -14
  7. package/build/cjs/__e2e__/highlight.stories.e2e.js +10 -7
  8. package/build/cjs/__e2e__/loading_state.stories.e2e.js +14 -7
  9. package/build/cjs/__e2e__/multi_selection.stories.e2e.js +11 -8
  10. package/build/cjs/__e2e__/no_selection.stories.e2e.js +21 -15
  11. package/build/cjs/__e2e__/path_based_filtering.stories.e2e.js +23 -17
  12. package/build/cjs/__e2e__/single_selection.stories.e2e.js +17 -10
  13. package/build/cjs/__e2e__/sub_unit_as_root.stories.e2e.js +6 -5
  14. package/build/cjs/__e2e__/tree_api.stories.e2e.js +22 -15
  15. package/build/cjs/__stories__/custom-expanded-imperative-open.js +9 -6
  16. package/build/cjs/__stories__/custom-node-label.js +6 -4
  17. package/build/cjs/__stories__/development-stories.js +7 -6
  18. package/build/cjs/__stories__/loading-error-grandchild.js +5 -1
  19. package/build/cjs/__stories__/loading.js +5 -1
  20. package/build/cjs/__stories__/multiple-roots.js +12 -9
  21. package/build/cjs/__stories__/root-error.js +5 -1
  22. package/build/cjs/__stories__/root-loading.js +5 -1
  23. package/build/cjs/__stories__/shared.js +82 -45
  24. package/build/cjs/features/controlled_expanded/index.js +8 -5
  25. package/build/cjs/features/expanded/index.js +1 -7
  26. package/build/cjs/features/path_based_filtering/index.js +2 -2
  27. package/build/cjs/features/sub_unit_as_root/index.js +1 -7
  28. package/build/cjs/get-all-expanded-paths/get-all-expanded-paths.js +1 -1
  29. package/build/cjs/helpers/is-path-included.js +1 -1
  30. package/build/cjs/helpers/left-trim-to-root-id.js +1 -1
  31. package/build/cjs/organisation-unit-node/compute-child-nodes.js +1 -1
  32. package/build/cjs/organisation-unit-node/error-message.js +13 -10
  33. package/build/cjs/organisation-unit-node/has-descendant-selected-paths.js +1 -1
  34. package/build/cjs/organisation-unit-node/label/disabled-selection-label.js +12 -9
  35. package/build/cjs/organisation-unit-node/label/icon-empty.js +22 -19
  36. package/build/cjs/organisation-unit-node/label/icon-folder-closed.js +28 -25
  37. package/build/cjs/organisation-unit-node/label/icon-folder-open.js +37 -34
  38. package/build/cjs/organisation-unit-node/label/icon-single.js +31 -28
  39. package/build/cjs/organisation-unit-node/label/icon.js +8 -6
  40. package/build/cjs/organisation-unit-node/label/iconized-checkbox.js +14 -12
  41. package/build/cjs/organisation-unit-node/label/label-container.js +16 -13
  42. package/build/cjs/organisation-unit-node/label/label.js +31 -27
  43. package/build/cjs/organisation-unit-node/label/single-selection-label.js +21 -18
  44. package/build/cjs/organisation-unit-node/organisation-unit-node-children.js +32 -29
  45. package/build/cjs/organisation-unit-node/organisation-unit-node.js +26 -25
  46. package/build/cjs/organisation-unit-node/use-open-state.js +9 -8
  47. package/build/cjs/organisation-unit-node/use-org-children.js +13 -9
  48. package/build/cjs/organisation-unit-node/use-org-children.test.js +69 -46
  49. package/build/cjs/organisation-unit-node/use-org-data/use-org-data.js +22 -14
  50. package/build/cjs/organisation-unit-node/use-org-data/use-org-data.test.js +30 -18
  51. package/build/cjs/organisation-unit-tree/default-render-node-label/default-render-node-label.js +6 -3
  52. package/build/cjs/organisation-unit-tree/filter-root-ids.js +1 -1
  53. package/build/cjs/organisation-unit-tree/organisation-unit-tree.js +23 -22
  54. package/build/cjs/organisation-unit-tree/root-error.js +12 -9
  55. package/build/cjs/organisation-unit-tree/root-loading.js +13 -10
  56. package/build/cjs/organisation-unit-tree/use-expanded/create-expand-handlers.js +19 -14
  57. package/build/cjs/organisation-unit-tree/use-expanded/use-expanded.js +9 -8
  58. package/build/cjs/organisation-unit-tree/use-root-org-data/patch-missing-display-name.js +2 -1
  59. package/build/cjs/organisation-unit-tree/use-root-org-data/use-root-org-data.js +14 -10
  60. package/build/cjs/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +37 -20
  61. package/build/cjs/organisation-unit-tree.stories.js +32 -57
  62. package/build/cjs/prop-types.js +5 -5
  63. package/build/es/__e2e__/children_as_child_nodes.stories.e2e.js +11 -8
  64. package/build/es/__e2e__/common.js +52 -42
  65. package/build/es/__e2e__/controlled_expanded.stories.e2e.js +9 -6
  66. package/build/es/__e2e__/displaying_loading_error.stories.e2e.js +5 -1
  67. package/build/es/__e2e__/expanded.stories.e2e.js +34 -25
  68. package/build/es/__e2e__/force_reload.stories.e2e.js +21 -14
  69. package/build/es/__e2e__/highlight.stories.e2e.js +10 -7
  70. package/build/es/__e2e__/loading_state.stories.e2e.js +14 -7
  71. package/build/es/__e2e__/multi_selection.stories.e2e.js +11 -8
  72. package/build/es/__e2e__/no_selection.stories.e2e.js +21 -15
  73. package/build/es/__e2e__/path_based_filtering.stories.e2e.js +23 -17
  74. package/build/es/__e2e__/single_selection.stories.e2e.js +17 -10
  75. package/build/es/__e2e__/sub_unit_as_root.stories.e2e.js +5 -4
  76. package/build/es/__e2e__/tree_api.stories.e2e.js +22 -15
  77. package/build/es/__stories__/custom-expanded-imperative-open.js +9 -6
  78. package/build/es/__stories__/custom-node-label.js +6 -4
  79. package/build/es/__stories__/development-stories.js +6 -5
  80. package/build/es/__stories__/loading-error-grandchild.js +5 -1
  81. package/build/es/__stories__/loading.js +5 -1
  82. package/build/es/__stories__/multiple-roots.js +12 -9
  83. package/build/es/__stories__/root-error.js +5 -1
  84. package/build/es/__stories__/root-loading.js +5 -1
  85. package/build/es/__stories__/shared.js +82 -45
  86. package/build/es/features/controlled_expanded/index.js +8 -5
  87. package/build/es/features/expanded/index.js +1 -7
  88. package/build/es/features/path_based_filtering/index.js +2 -2
  89. package/build/es/features/sub_unit_as_root/index.js +1 -7
  90. package/build/es/get-all-expanded-paths/get-all-expanded-paths.js +1 -1
  91. package/build/es/helpers/is-path-included.js +1 -1
  92. package/build/es/helpers/left-trim-to-root-id.js +1 -1
  93. package/build/es/organisation-unit-node/compute-child-nodes.js +1 -1
  94. package/build/es/organisation-unit-node/error-message.js +13 -10
  95. package/build/es/organisation-unit-node/has-descendant-selected-paths.js +1 -1
  96. package/build/es/organisation-unit-node/label/disabled-selection-label.js +12 -9
  97. package/build/es/organisation-unit-node/label/icon-empty.js +22 -19
  98. package/build/es/organisation-unit-node/label/icon-folder-closed.js +28 -25
  99. package/build/es/organisation-unit-node/label/icon-folder-open.js +37 -34
  100. package/build/es/organisation-unit-node/label/icon-single.js +31 -28
  101. package/build/es/organisation-unit-node/label/icon.js +8 -6
  102. package/build/es/organisation-unit-node/label/iconized-checkbox.js +13 -12
  103. package/build/es/organisation-unit-node/label/label-container.js +16 -13
  104. package/build/es/organisation-unit-node/label/label.js +31 -27
  105. package/build/es/organisation-unit-node/label/single-selection-label.js +21 -18
  106. package/build/es/organisation-unit-node/organisation-unit-node-children.js +32 -29
  107. package/build/es/organisation-unit-node/organisation-unit-node.js +26 -25
  108. package/build/es/organisation-unit-node/use-open-state.js +9 -8
  109. package/build/es/organisation-unit-node/use-org-children.js +13 -9
  110. package/build/es/organisation-unit-node/use-org-children.test.js +69 -46
  111. package/build/es/organisation-unit-node/use-org-data/use-org-data.js +22 -14
  112. package/build/es/organisation-unit-node/use-org-data/use-org-data.test.js +30 -18
  113. package/build/es/organisation-unit-tree/default-render-node-label/default-render-node-label.js +6 -3
  114. package/build/es/organisation-unit-tree/filter-root-ids.js +1 -1
  115. package/build/es/organisation-unit-tree/organisation-unit-tree.js +23 -22
  116. package/build/es/organisation-unit-tree/root-error.js +12 -9
  117. package/build/es/organisation-unit-tree/root-loading.js +13 -10
  118. package/build/es/organisation-unit-tree/use-expanded/create-expand-handlers.js +19 -14
  119. package/build/es/organisation-unit-tree/use-expanded/use-expanded.js +9 -8
  120. package/build/es/organisation-unit-tree/use-root-org-data/patch-missing-display-name.js +2 -1
  121. package/build/es/organisation-unit-tree/use-root-org-data/use-root-org-data.js +14 -10
  122. package/build/es/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +37 -20
  123. package/build/es/organisation-unit-tree.stories.js +2 -27
  124. package/build/es/prop-types.js +4 -4
  125. package/package.json +5 -5
@@ -2,16 +2,19 @@ import _JSXStyle from "styled-jsx/style";
2
2
  import { colors, spacers, theme } from '@dhis2/ui-constants';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
- export const ErrorMessage = ({
6
- children,
7
- dataTest
8
- }) => /*#__PURE__*/React.createElement("span", {
9
- "data-test": `${dataTest}-error`,
10
- className: _JSXStyle.dynamic([["3198585030", [colors.grey800, spacers.dp4, theme.error]]])
11
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
12
- id: "3198585030",
13
- dynamic: [colors.grey800, spacers.dp4, theme.error]
14
- }, [`span.__jsx-style-dynamic-selector{font-size:14px;color:${colors.grey800};margin:${spacers.dp4};color:${theme.error};}`]));
5
+ export const ErrorMessage = _ref => {
6
+ let {
7
+ children,
8
+ dataTest
9
+ } = _ref;
10
+ return /*#__PURE__*/React.createElement("span", {
11
+ "data-test": "".concat(dataTest, "-error"),
12
+ className: _JSXStyle.dynamic([["3198585030", [colors.grey800, spacers.dp4, theme.error]]])
13
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
14
+ id: "3198585030",
15
+ dynamic: [colors.grey800, spacers.dp4, theme.error]
16
+ }, ["span.__jsx-style-dynamic-selector{font-size:14px;color:".concat(colors.grey800, ";margin:").concat(spacers.dp4, ";color:").concat(theme.error, ";}")]));
17
+ };
15
18
  ErrorMessage.propTypes = {
16
19
  children: PropTypes.any.isRequired,
17
20
  dataTest: PropTypes.string.isRequired
@@ -8,7 +8,7 @@
8
8
  */
9
9
  export const hasDescendantSelectedPaths = (path, selected) => {
10
10
  return selected.some(selectedPath => {
11
- const isNotPath = !selectedPath.match(new RegExp(`${path}$`));
11
+ const isNotPath = !selectedPath.match(new RegExp("".concat(path, "$")));
12
12
  const isSubPath = selectedPath.match(new RegExp(path));
13
13
  return isNotPath && isSubPath;
14
14
  });
@@ -9,15 +9,18 @@ import { SingleSelectionLabel } from './single-selection-label.js';
9
9
  * @returns {React.Component}
10
10
  */
11
11
 
12
- export const DisabledSelectionLabel = ({
13
- children,
14
- loading,
15
- onToggleOpen
16
- }) => /*#__PURE__*/React.createElement(SingleSelectionLabel, {
17
- checked: false,
18
- loading: loading,
19
- onChange: onToggleOpen
20
- }, children);
12
+ export const DisabledSelectionLabel = _ref => {
13
+ let {
14
+ children,
15
+ loading,
16
+ onToggleOpen
17
+ } = _ref;
18
+ return /*#__PURE__*/React.createElement(SingleSelectionLabel, {
19
+ checked: false,
20
+ loading: loading,
21
+ onChange: onToggleOpen
22
+ }, children);
23
+ };
21
24
  DisabledSelectionLabel.propTypes = {
22
25
  children: PropTypes.any.isRequired,
23
26
  onToggleOpen: PropTypes.func.isRequired,
@@ -1,25 +1,28 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
- export const IconEmpty = ({
5
- dataTest
6
- }) => /*#__PURE__*/React.createElement("svg", {
7
- height: "18px",
8
- version: "1.1",
9
- viewBox: "0 0 18 18",
10
- width: "18px",
11
- "data-test": `${dataTest}-iconempty`,
12
- className: "jsx-3201893673"
13
- }, /*#__PURE__*/React.createElement("g", {
14
- fill: "none",
15
- fillRule: "evenodd",
16
- id: "icon/empty",
17
- stroke: "none",
18
- strokeWidth: "1",
19
- className: "jsx-3201893673"
20
- }), /*#__PURE__*/React.createElement(_JSXStyle, {
21
- id: "3201893673"
22
- }, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
4
+ export const IconEmpty = _ref => {
5
+ let {
6
+ dataTest
7
+ } = _ref;
8
+ return /*#__PURE__*/React.createElement("svg", {
9
+ height: "18px",
10
+ version: "1.1",
11
+ viewBox: "0 0 18 18",
12
+ width: "18px",
13
+ "data-test": "".concat(dataTest, "-iconempty"),
14
+ className: "jsx-3201893673"
15
+ }, /*#__PURE__*/React.createElement("g", {
16
+ fill: "none",
17
+ fillRule: "evenodd",
18
+ id: "icon/empty",
19
+ stroke: "none",
20
+ strokeWidth: "1",
21
+ className: "jsx-3201893673"
22
+ }), /*#__PURE__*/React.createElement(_JSXStyle, {
23
+ id: "3201893673"
24
+ }, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
25
+ };
23
26
  IconEmpty.propTypes = {
24
27
  dataTest: PropTypes.string.isRequired
25
28
  };
@@ -1,31 +1,34 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
- export const IconFolderClosed = ({
5
- dataTest
6
- }) => /*#__PURE__*/React.createElement("svg", {
7
- width: "18px",
8
- height: "18px",
9
- viewBox: "0 0 18 18",
10
- version: "1.1",
11
- "data-test": `${dataTest}-iconfolderclosed`,
12
- className: "jsx-3201893673"
13
- }, /*#__PURE__*/React.createElement("g", {
14
- id: "icon/folder/closed",
15
- stroke: "none",
16
- strokeWidth: "1",
17
- fill: "none",
18
- fillRule: "evenodd",
19
- className: "jsx-3201893673"
20
- }, /*#__PURE__*/React.createElement("path", {
21
- d: "M2,3.5 C1.17157288,3.5 0.5,4.17157288 0.5,5 L0.5,13 C0.5,13.8284271 1.17157288,14.5 2,14.5 L12,14.5 C12.8284271,14.5 13.5,13.8284271 13.5,13 L13.5,7 C13.5,6.17157288 12.8284271,5.5 12,5.5 L6.69098301,5.5 L5.82917961,3.7763932 C5.7444836,3.60700119 5.57135204,3.5 5.38196601,3.5 L2,3.5 Z",
22
- id: "Path-2",
23
- stroke: "#6E7A8A",
24
- fill: "#D5DDE5",
25
- className: "jsx-3201893673"
26
- })), /*#__PURE__*/React.createElement(_JSXStyle, {
27
- id: "3201893673"
28
- }, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
4
+ export const IconFolderClosed = _ref => {
5
+ let {
6
+ dataTest
7
+ } = _ref;
8
+ return /*#__PURE__*/React.createElement("svg", {
9
+ width: "18px",
10
+ height: "18px",
11
+ viewBox: "0 0 18 18",
12
+ version: "1.1",
13
+ "data-test": "".concat(dataTest, "-iconfolderclosed"),
14
+ className: "jsx-3201893673"
15
+ }, /*#__PURE__*/React.createElement("g", {
16
+ id: "icon/folder/closed",
17
+ stroke: "none",
18
+ strokeWidth: "1",
19
+ fill: "none",
20
+ fillRule: "evenodd",
21
+ className: "jsx-3201893673"
22
+ }, /*#__PURE__*/React.createElement("path", {
23
+ d: "M2,3.5 C1.17157288,3.5 0.5,4.17157288 0.5,5 L0.5,13 C0.5,13.8284271 1.17157288,14.5 2,14.5 L12,14.5 C12.8284271,14.5 13.5,13.8284271 13.5,13 L13.5,7 C13.5,6.17157288 12.8284271,5.5 12,5.5 L6.69098301,5.5 L5.82917961,3.7763932 C5.7444836,3.60700119 5.57135204,3.5 5.38196601,3.5 L2,3.5 Z",
24
+ id: "Path-2",
25
+ stroke: "#6E7A8A",
26
+ fill: "#D5DDE5",
27
+ className: "jsx-3201893673"
28
+ })), /*#__PURE__*/React.createElement(_JSXStyle, {
29
+ id: "3201893673"
30
+ }, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
31
+ };
29
32
  IconFolderClosed.propTypes = {
30
33
  dataTest: PropTypes.string.isRequired
31
34
  };
@@ -1,40 +1,43 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
- export const IconFolderOpen = ({
5
- dataTest
6
- }) => /*#__PURE__*/React.createElement("svg", {
7
- width: "18px",
8
- height: "18px",
9
- viewBox: "0 0 18 18",
10
- version: "1.1",
11
- "data-test": `${dataTest}-iconfolderopen`,
12
- className: "jsx-2091325045"
13
- }, /*#__PURE__*/React.createElement("g", {
14
- id: "icon/folder/open",
15
- stroke: "none",
16
- strokeWidth: "1",
17
- fill: "none",
18
- fillRule: "evenodd",
19
- className: "jsx-2091325045"
20
- }, /*#__PURE__*/React.createElement("g", {
21
- id: "Group",
22
- transform: "translate(0.000000, 3.000000)",
23
- stroke: "#6E7A8A",
24
- className: "jsx-2091325045"
25
- }, /*#__PURE__*/React.createElement("path", {
26
- d: "M2,0.5 C1.17157288,0.5 0.5,1.17157288 0.5,2 L0.5,10 C0.5,10.8284271 1.17157288,11.5 2,11.5 L12,11.5 C12.8284271,11.5 13.5,10.8284271 13.5,10 L13.5,4 C13.5,3.17157288 12.8284271,2.5 12,2.5 L6.69098301,2.5 L5.82917961,0.776393202 C5.7444836,0.607001188 5.57135204,0.5 5.38196601,0.5 L2,0.5 Z",
27
- id: "Path-2",
28
- fill: "#A0ADBA",
29
- className: "jsx-2091325045"
30
- }), /*#__PURE__*/React.createElement("path", {
31
- d: "M1.53632259,10.7093809 C1.47575089,10.7941813 1.44318932,10.8957885 1.44318932,11 C1.44318932,11.2761424 1.66704695,11.5 1.94318932,11.5 L12.4853821,11.5 C12.6468577,11.5 12.7983931,11.4220172 12.8922488,11.2906191 L16.4636774,6.2906191 C16.5242491,6.20581872 16.5568107,6.10421149 16.5568107,6 C16.5568107,5.72385763 16.3329531,5.5 16.0568107,5.5 L5.5146179,5.5 C5.35314234,5.5 5.20160692,5.57798284 5.10775116,5.7093809 L1.53632259,10.7093809 Z",
32
- id: "Path-3",
33
- fill: "#FBFCFD",
34
- className: "jsx-2091325045"
35
- }))), /*#__PURE__*/React.createElement(_JSXStyle, {
36
- id: "2091325045"
37
- }, ["svg.jsx-2091325045{margin:3px 0;display:block;}"]));
4
+ export const IconFolderOpen = _ref => {
5
+ let {
6
+ dataTest
7
+ } = _ref;
8
+ return /*#__PURE__*/React.createElement("svg", {
9
+ width: "18px",
10
+ height: "18px",
11
+ viewBox: "0 0 18 18",
12
+ version: "1.1",
13
+ "data-test": "".concat(dataTest, "-iconfolderopen"),
14
+ className: "jsx-2091325045"
15
+ }, /*#__PURE__*/React.createElement("g", {
16
+ id: "icon/folder/open",
17
+ stroke: "none",
18
+ strokeWidth: "1",
19
+ fill: "none",
20
+ fillRule: "evenodd",
21
+ className: "jsx-2091325045"
22
+ }, /*#__PURE__*/React.createElement("g", {
23
+ id: "Group",
24
+ transform: "translate(0.000000, 3.000000)",
25
+ stroke: "#6E7A8A",
26
+ className: "jsx-2091325045"
27
+ }, /*#__PURE__*/React.createElement("path", {
28
+ d: "M2,0.5 C1.17157288,0.5 0.5,1.17157288 0.5,2 L0.5,10 C0.5,10.8284271 1.17157288,11.5 2,11.5 L12,11.5 C12.8284271,11.5 13.5,10.8284271 13.5,10 L13.5,4 C13.5,3.17157288 12.8284271,2.5 12,2.5 L6.69098301,2.5 L5.82917961,0.776393202 C5.7444836,0.607001188 5.57135204,0.5 5.38196601,0.5 L2,0.5 Z",
29
+ id: "Path-2",
30
+ fill: "#A0ADBA",
31
+ className: "jsx-2091325045"
32
+ }), /*#__PURE__*/React.createElement("path", {
33
+ d: "M1.53632259,10.7093809 C1.47575089,10.7941813 1.44318932,10.8957885 1.44318932,11 C1.44318932,11.2761424 1.66704695,11.5 1.94318932,11.5 L12.4853821,11.5 C12.6468577,11.5 12.7983931,11.4220172 12.8922488,11.2906191 L16.4636774,6.2906191 C16.5242491,6.20581872 16.5568107,6.10421149 16.5568107,6 C16.5568107,5.72385763 16.3329531,5.5 16.0568107,5.5 L5.5146179,5.5 C5.35314234,5.5 5.20160692,5.57798284 5.10775116,5.7093809 L1.53632259,10.7093809 Z",
34
+ id: "Path-3",
35
+ fill: "#FBFCFD",
36
+ className: "jsx-2091325045"
37
+ }))), /*#__PURE__*/React.createElement(_JSXStyle, {
38
+ id: "2091325045"
39
+ }, ["svg.jsx-2091325045{margin:3px 0;display:block;}"]));
40
+ };
38
41
  IconFolderOpen.propTypes = {
39
42
  dataTest: PropTypes.string.isRequired
40
43
  };
@@ -1,34 +1,37 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
- export const IconSingle = ({
5
- dataTest
6
- }) => /*#__PURE__*/React.createElement("svg", {
7
- height: "18px",
8
- version: "1.1",
9
- viewBox: "0 0 18 18",
10
- width: "18px",
11
- "data-test": `${dataTest}-iconsingle`,
12
- className: "jsx-3201893673"
13
- }, /*#__PURE__*/React.createElement("g", {
14
- fill: "none",
15
- fillRule: "evenodd",
16
- id: "icon/single",
17
- stroke: "none",
18
- strokeWidth: "1",
19
- className: "jsx-3201893673"
20
- }, /*#__PURE__*/React.createElement("rect", {
21
- fill: "#A0ADBA",
22
- height: "4",
23
- id: "Rectangle",
24
- rx: "1",
25
- width: "4",
26
- x: "7",
27
- y: "7",
28
- className: "jsx-3201893673"
29
- })), /*#__PURE__*/React.createElement(_JSXStyle, {
30
- id: "3201893673"
31
- }, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
4
+ export const IconSingle = _ref => {
5
+ let {
6
+ dataTest
7
+ } = _ref;
8
+ return /*#__PURE__*/React.createElement("svg", {
9
+ height: "18px",
10
+ version: "1.1",
11
+ viewBox: "0 0 18 18",
12
+ width: "18px",
13
+ "data-test": "".concat(dataTest, "-iconsingle"),
14
+ className: "jsx-3201893673"
15
+ }, /*#__PURE__*/React.createElement("g", {
16
+ fill: "none",
17
+ fillRule: "evenodd",
18
+ id: "icon/single",
19
+ stroke: "none",
20
+ strokeWidth: "1",
21
+ className: "jsx-3201893673"
22
+ }, /*#__PURE__*/React.createElement("rect", {
23
+ fill: "#A0ADBA",
24
+ height: "4",
25
+ id: "Rectangle",
26
+ rx: "1",
27
+ width: "4",
28
+ x: "7",
29
+ y: "7",
30
+ className: "jsx-3201893673"
31
+ })), /*#__PURE__*/React.createElement(_JSXStyle, {
32
+ id: "3201893673"
33
+ }, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
34
+ };
32
35
  IconSingle.propTypes = {
33
36
  dataTest: PropTypes.string.isRequired
34
37
  };
@@ -11,12 +11,14 @@ import { IconSingle } from './icon-single.js';
11
11
  * @returns {React.Component}
12
12
  */
13
13
 
14
- export const Icon = ({
15
- loading,
16
- hasChildren,
17
- open,
18
- dataTest
19
- }) => {
14
+ export const Icon = _ref => {
15
+ let {
16
+ loading,
17
+ hasChildren,
18
+ open,
19
+ dataTest
20
+ } = _ref;
21
+
20
22
  if (loading) {
21
23
  return /*#__PURE__*/React.createElement(IconEmpty, {
22
24
  dataTest: dataTest
@@ -3,18 +3,19 @@ import { Checkbox } from '@dhis2-ui/checkbox';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
5
  import { Icon } from './icon.js';
6
- export const IconizedCheckbox = ({
7
- checked,
8
- dataTest,
9
- hasChildren,
10
- indeterminate,
11
- children,
12
- loading,
13
- name,
14
- open,
15
- value,
16
- onChange
17
- }) => {
6
+ export const IconizedCheckbox = _ref => {
7
+ let {
8
+ checked,
9
+ dataTest,
10
+ hasChildren,
11
+ indeterminate,
12
+ children,
13
+ loading,
14
+ name,
15
+ open,
16
+ value,
17
+ onChange
18
+ } = _ref;
18
19
  const icon = /*#__PURE__*/React.createElement(Icon, {
19
20
  loading: loading,
20
21
  open: open,
@@ -10,19 +10,22 @@ import React from 'react';
10
10
  * @returns {React.Component}
11
11
  */
12
12
 
13
- export const LabelContainer = ({
14
- highlighted,
15
- children
16
- }) => /*#__PURE__*/React.createElement("div", {
17
- className: _JSXStyle.dynamic([["495975020", [colors.teal200]]]) + " " + (cx({
18
- highlighted
19
- }) || "")
20
- }, /*#__PURE__*/React.createElement("span", {
21
- className: _JSXStyle.dynamic([["495975020", [colors.teal200]]])
22
- }, children), /*#__PURE__*/React.createElement(_JSXStyle, {
23
- id: "495975020",
24
- dynamic: [colors.teal200]
25
- }, ["div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", "span.__jsx-style-dynamic-selector{display:block;}", `.highlighted.__jsx-style-dynamic-selector{background:${colors.teal200};padding-right:4px;}`]));
13
+ export const LabelContainer = _ref => {
14
+ let {
15
+ highlighted,
16
+ children
17
+ } = _ref;
18
+ return /*#__PURE__*/React.createElement("div", {
19
+ className: _JSXStyle.dynamic([["495975020", [colors.teal200]]]) + " " + (cx({
20
+ highlighted
21
+ }) || "")
22
+ }, /*#__PURE__*/React.createElement("span", {
23
+ className: _JSXStyle.dynamic([["495975020", [colors.teal200]]])
24
+ }, children), /*#__PURE__*/React.createElement(_JSXStyle, {
25
+ id: "495975020",
26
+ dynamic: [colors.teal200]
27
+ }, ["div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", "span.__jsx-style-dynamic-selector{display:block;}", ".highlighted.__jsx-style-dynamic-selector{background:".concat(colors.teal200, ";padding-right:4px;}")]));
28
+ };
26
29
  LabelContainer.propTypes = {
27
30
  children: PropTypes.node,
28
31
  highlighted: PropTypes.bool
@@ -6,12 +6,13 @@ import { IconizedCheckbox } from './iconized-checkbox.js';
6
6
  import { LabelContainer } from './label-container.js';
7
7
  import { SingleSelectionLabel } from './single-selection-label.js';
8
8
 
9
- const createNewSelected = ({
10
- selected,
11
- path,
12
- checked,
13
- singleSelection
14
- }) => {
9
+ const createNewSelected = _ref => {
10
+ let {
11
+ selected,
12
+ path,
13
+ checked,
14
+ singleSelection
15
+ } = _ref;
15
16
  const pathIndex = selected.indexOf(path);
16
17
 
17
18
  if (checked && pathIndex !== -1) {
@@ -43,27 +44,30 @@ const createNewSelected = ({
43
44
  return [...prevSlice, ...nextSlice];
44
45
  };
45
46
 
46
- const Label = ({
47
- checked,
48
- children,
49
- dataTest,
50
- disableSelection,
51
- fullPath,
52
- hasChildren,
53
- hasSelectedDescendants,
54
- highlighted,
55
- loading,
56
- node,
57
- onChange,
58
- onToggleOpen,
59
- open,
60
- rootId,
61
- selected,
62
- singleSelection
63
- }) => {
64
- const onClick = ({
65
- checked
66
- }, event) => {
47
+ const Label = _ref2 => {
48
+ let {
49
+ checked,
50
+ children,
51
+ dataTest,
52
+ disableSelection,
53
+ fullPath,
54
+ hasChildren,
55
+ hasSelectedDescendants,
56
+ highlighted,
57
+ loading,
58
+ node,
59
+ onChange,
60
+ onToggleOpen,
61
+ open,
62
+ rootId,
63
+ selected,
64
+ singleSelection
65
+ } = _ref2;
66
+
67
+ const onClick = (_ref3, event) => {
68
+ let {
69
+ checked
70
+ } = _ref3;
67
71
  const newSelected = createNewSelected({
68
72
  path: fullPath,
69
73
  selected,
@@ -12,26 +12,29 @@ import React from 'react';
12
12
  * @returns {React.Component}
13
13
  */
14
14
 
15
- export const SingleSelectionLabel = ({
16
- checked,
17
- children,
18
- onChange,
19
- loading
20
- }) => /*#__PURE__*/React.createElement("span", {
21
- onClick: event => {
22
- const payload = {
23
- checked: !checked
24
- };
25
- onChange(payload, event);
26
- },
27
- className: _JSXStyle.dynamic([["321503310", [colors.grey900, colors.teal700]]]) + " " + (cx({
15
+ export const SingleSelectionLabel = _ref => {
16
+ let {
28
17
  checked,
18
+ children,
19
+ onChange,
29
20
  loading
30
- }) || "")
31
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
32
- id: "321503310",
33
- dynamic: [colors.grey900, colors.teal700]
34
- }, [`span.__jsx-style-dynamic-selector{background:transparent;border-radius:3px;color:${colors.grey900};cursor:pointer;display:inline-block;font-size:14px;line-height:24px;padding:0 5px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;}`, `.checked.__jsx-style-dynamic-selector{background:${colors.teal700};color:white;}`, ".loading.__jsx-style-dynamic-selector{cursor:auto;}"]));
21
+ } = _ref;
22
+ return /*#__PURE__*/React.createElement("span", {
23
+ onClick: event => {
24
+ const payload = {
25
+ checked: !checked
26
+ };
27
+ onChange(payload, event);
28
+ },
29
+ className: _JSXStyle.dynamic([["321503310", [colors.grey900, colors.teal700]]]) + " " + (cx({
30
+ checked,
31
+ loading
32
+ }) || "")
33
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
34
+ id: "321503310",
35
+ dynamic: [colors.grey900, colors.teal700]
36
+ }, ["span.__jsx-style-dynamic-selector{background:transparent;border-radius:3px;color:".concat(colors.grey900, ";cursor:pointer;display:inline-block;font-size:14px;line-height:24px;padding:0 5px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;}"), ".checked.__jsx-style-dynamic-selector{background:".concat(colors.teal700, ";color:white;}"), ".loading.__jsx-style-dynamic-selector{cursor:auto;}"]));
37
+ };
35
38
  SingleSelectionLabel.propTypes = {
36
39
  children: PropTypes.any.isRequired,
37
40
  checked: PropTypes.bool,
@@ -6,41 +6,44 @@ import { orgUnitPathPropType } from '../prop-types.js';
6
6
  import { LoadingSpinner } from './loading-spinner.js';
7
7
  import { useOrgChildren } from './use-org-children.js';
8
8
 
9
- const getFilteredChildren = ({
10
- orgChildren,
11
- filter,
12
- node
13
- }) => {
9
+ const getFilteredChildren = _ref => {
10
+ let {
11
+ orgChildren,
12
+ filter,
13
+ node
14
+ } = _ref;
15
+
14
16
  if (!(filter !== null && filter !== void 0 && filter.length)) {
15
17
  return orgChildren;
16
18
  }
17
19
 
18
20
  return orgChildren.filter(child => {
19
- return isPathIncluded(filter, `${node.path}/${child.id}`);
21
+ return isPathIncluded(filter, "".concat(node.path, "/").concat(child.id));
20
22
  });
21
23
  };
22
24
 
23
- export const OrganisationUnitNodeChildren = ({
24
- node,
25
- autoExpandLoadingError,
26
- dataTest,
27
- disableSelection,
28
- expanded,
29
- filter,
30
- highlighted,
31
- isUserDataViewFallback,
32
- onChange,
33
- onChildrenLoaded,
34
- onCollapse,
35
- onExpand,
36
- parentPath,
37
- renderNodeLabel,
38
- rootId,
39
- selected,
40
- singleSelection,
41
- suppressAlphabeticalSorting,
42
- OrganisationUnitNode
43
- }) => {
25
+ export const OrganisationUnitNodeChildren = _ref2 => {
26
+ let {
27
+ node,
28
+ autoExpandLoadingError,
29
+ dataTest,
30
+ disableSelection,
31
+ expanded,
32
+ filter,
33
+ highlighted,
34
+ isUserDataViewFallback,
35
+ onChange,
36
+ onChildrenLoaded,
37
+ onCollapse,
38
+ onExpand,
39
+ parentPath,
40
+ renderNodeLabel,
41
+ rootId,
42
+ selected,
43
+ singleSelection,
44
+ suppressAlphabeticalSorting,
45
+ OrganisationUnitNode
46
+ } = _ref2;
44
47
  const orgChildren = useOrgChildren({
45
48
  node,
46
49
  isUserDataViewFallback,
@@ -53,8 +56,8 @@ export const OrganisationUnitNodeChildren = ({
53
56
  filter,
54
57
  node
55
58
  }) : [];
56
- return /*#__PURE__*/React.createElement(React.Fragment, null, orgChildren.loading && /*#__PURE__*/React.createElement(LoadingSpinner, null), orgChildren.error && `Error: ${orgChildren.error}`, displayChildren && !filteredChildren.length && i18n.t('No children match filter'), !!filteredChildren.length && filteredChildren.map(child => {
57
- const childPath = `${parentPath}/${child.id}`;
59
+ return /*#__PURE__*/React.createElement(React.Fragment, null, orgChildren.loading && /*#__PURE__*/React.createElement(LoadingSpinner, null), orgChildren.error && "Error: ".concat(orgChildren.error), displayChildren && !filteredChildren.length && i18n.t('No children match filter'), !!filteredChildren.length && filteredChildren.map(child => {
60
+ const childPath = "".concat(parentPath, "/").concat(child.id);
58
61
  return /*#__PURE__*/React.createElement(OrganisationUnitNode, {
59
62
  autoExpandLoadingError: autoExpandLoadingError,
60
63
  dataTest: dataTest,