@dhis2-ui/tab 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.
@@ -17,27 +17,30 @@ var _react = _interopRequireDefault(require("react"));
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
- const Tab = ({
21
- icon,
22
- onClick,
23
- selected,
24
- disabled,
25
- children,
26
- className,
27
- dataTest
28
- }) => /*#__PURE__*/_react.default.createElement("button", {
29
- onClick: disabled ? undefined : event => onClick({}, event),
30
- "data-test": dataTest,
31
- className: _style.default.dynamic([["1619053260", [_uiConstants.colors.grey400, _uiConstants.colors.grey600, _uiConstants.theme.focus, _uiConstants.colors.grey600, _uiConstants.colors.grey100, _uiConstants.colors.grey200, _uiConstants.theme.primary700, _uiConstants.theme.primary700, _uiConstants.theme.primary700, _uiConstants.colors.grey500, _uiConstants.colors.grey500]]]) + " " + `${(0, _classnames.default)('tab', className, {
20
+ const Tab = _ref => {
21
+ let {
22
+ icon,
23
+ onClick,
32
24
  selected,
33
- disabled
34
- })}`
35
- }, icon, /*#__PURE__*/_react.default.createElement("span", {
36
- className: _style.default.dynamic([["1619053260", [_uiConstants.colors.grey400, _uiConstants.colors.grey600, _uiConstants.theme.focus, _uiConstants.colors.grey600, _uiConstants.colors.grey100, _uiConstants.colors.grey200, _uiConstants.theme.primary700, _uiConstants.theme.primary700, _uiConstants.theme.primary700, _uiConstants.colors.grey500, _uiConstants.colors.grey500]]])
37
- }, children), /*#__PURE__*/_react.default.createElement(_style.default, {
38
- id: "1619053260",
39
- dynamic: [_uiConstants.colors.grey400, _uiConstants.colors.grey600, _uiConstants.theme.focus, _uiConstants.colors.grey600, _uiConstants.colors.grey100, _uiConstants.colors.grey200, _uiConstants.theme.primary700, _uiConstants.theme.primary700, _uiConstants.theme.primary700, _uiConstants.colors.grey500, _uiConstants.colors.grey500]
40
- }, [`button.__jsx-style-dynamic-selector{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;vertical-align:bottom;height:100%;padding:16px 16px 11px;background-color:transparent;outline:none;border:none;border-bottom:1px solid ${_uiConstants.colors.grey400};color:${_uiConstants.colors.grey600};font-size:14px;line-height:20px;-webkit-transition:all 150ms ease-in-out;transition:all 150ms ease-in-out;-webkit-transition-property:color,background-color;transition-property:color,background-color;cursor:pointer;}`, ".fixed>button.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", "button.__jsx-style-dynamic-selector::after{content:' ';display:block;position:absolute;bottom:-1px;left:0;height:4px;width:100%;-webkit-transition:background-color 150ms ease-in-out;transition:background-color 150ms ease-in-out;background-color:transparent;}", "span.__jsx-style-dynamic-selector{max-width:320px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-webkit-transition:fill 150ms ease-in-out;transition:fill 150ms ease-in-out;}", `button.__jsx-style-dynamic-selector:focus{outline:3px solid ${_uiConstants.theme.focus};outline-offset:-3px;}`, "button.__jsx-style-dynamic-selector:focus.__jsx-style-dynamic-selector:not(:focus-visible){outline:none;}", `button.__jsx-style-dynamic-selector>svg{fill:${_uiConstants.colors.grey600};width:14px;height:14px;margin:0 4px 0 0;}`, `button.__jsx-style-dynamic-selector:hover{background-color:${_uiConstants.colors.grey100};}`, `button.__jsx-style-dynamic-selector:active{background-color:${_uiConstants.colors.grey200};}`, `button.selected.__jsx-style-dynamic-selector{color:${_uiConstants.theme.primary700};}`, `button.selected.__jsx-style-dynamic-selector::after{background-color:${_uiConstants.theme.primary700};}`, `button.selected.__jsx-style-dynamic-selector>svg{fill:${_uiConstants.theme.primary700};}`, `button.disabled.__jsx-style-dynamic-selector{color:${_uiConstants.colors.grey500};cursor:not-allowed;}`, "button.disabled.__jsx-style-dynamic-selector:hover,button.selected.__jsx-style-dynamic-selector:hover{background-color:transparent;}", `button.disabled.__jsx-style-dynamic-selector>svg{fill:${_uiConstants.colors.grey500};}`]));
25
+ disabled,
26
+ children,
27
+ className,
28
+ dataTest
29
+ } = _ref;
30
+ return /*#__PURE__*/_react.default.createElement("button", {
31
+ onClick: disabled ? undefined : event => onClick({}, event),
32
+ "data-test": dataTest,
33
+ className: _style.default.dynamic([["1619053260", [_uiConstants.colors.grey400, _uiConstants.colors.grey600, _uiConstants.theme.focus, _uiConstants.colors.grey600, _uiConstants.colors.grey100, _uiConstants.colors.grey200, _uiConstants.theme.primary700, _uiConstants.theme.primary700, _uiConstants.theme.primary700, _uiConstants.colors.grey500, _uiConstants.colors.grey500]]]) + " " + "".concat((0, _classnames.default)('tab', className, {
34
+ selected,
35
+ disabled
36
+ }))
37
+ }, icon, /*#__PURE__*/_react.default.createElement("span", {
38
+ className: _style.default.dynamic([["1619053260", [_uiConstants.colors.grey400, _uiConstants.colors.grey600, _uiConstants.theme.focus, _uiConstants.colors.grey600, _uiConstants.colors.grey100, _uiConstants.colors.grey200, _uiConstants.theme.primary700, _uiConstants.theme.primary700, _uiConstants.theme.primary700, _uiConstants.colors.grey500, _uiConstants.colors.grey500]]])
39
+ }, children), /*#__PURE__*/_react.default.createElement(_style.default, {
40
+ id: "1619053260",
41
+ dynamic: [_uiConstants.colors.grey400, _uiConstants.colors.grey600, _uiConstants.theme.focus, _uiConstants.colors.grey600, _uiConstants.colors.grey100, _uiConstants.colors.grey200, _uiConstants.theme.primary700, _uiConstants.theme.primary700, _uiConstants.theme.primary700, _uiConstants.colors.grey500, _uiConstants.colors.grey500]
42
+ }, ["button.__jsx-style-dynamic-selector{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;vertical-align:bottom;height:100%;padding:16px 16px 11px;background-color:transparent;outline:none;border:none;border-bottom:1px solid ".concat(_uiConstants.colors.grey400, ";color:").concat(_uiConstants.colors.grey600, ";font-size:14px;line-height:20px;-webkit-transition:all 150ms ease-in-out;transition:all 150ms ease-in-out;-webkit-transition-property:color,background-color;transition-property:color,background-color;cursor:pointer;}"), ".fixed>button.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", "button.__jsx-style-dynamic-selector::after{content:' ';display:block;position:absolute;bottom:-1px;left:0;height:4px;width:100%;-webkit-transition:background-color 150ms ease-in-out;transition:background-color 150ms ease-in-out;background-color:transparent;}", "span.__jsx-style-dynamic-selector{max-width:320px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-webkit-transition:fill 150ms ease-in-out;transition:fill 150ms ease-in-out;}", "button.__jsx-style-dynamic-selector:focus{outline:3px solid ".concat(_uiConstants.theme.focus, ";outline-offset:-3px;}"), "button.__jsx-style-dynamic-selector:focus.__jsx-style-dynamic-selector:not(:focus-visible){outline:none;}", "button.__jsx-style-dynamic-selector>svg{fill:".concat(_uiConstants.colors.grey600, ";width:14px;height:14px;margin:0 4px 0 0;}"), "button.__jsx-style-dynamic-selector:hover{background-color:".concat(_uiConstants.colors.grey100, ";}"), "button.__jsx-style-dynamic-selector:active{background-color:".concat(_uiConstants.colors.grey200, ";}"), "button.selected.__jsx-style-dynamic-selector{color:".concat(_uiConstants.theme.primary700, ";}"), "button.selected.__jsx-style-dynamic-selector::after{background-color:".concat(_uiConstants.theme.primary700, ";}"), "button.selected.__jsx-style-dynamic-selector>svg{fill:".concat(_uiConstants.theme.primary700, ";}"), "button.disabled.__jsx-style-dynamic-selector{color:".concat(_uiConstants.colors.grey500, ";cursor:not-allowed;}"), "button.disabled.__jsx-style-dynamic-selector:hover,button.selected.__jsx-style-dynamic-selector:hover{background-color:transparent;}", "button.disabled.__jsx-style-dynamic-selector>svg{fill:".concat(_uiConstants.colors.grey500, ";}")]));
43
+ };
41
44
 
42
45
  exports.Tab = Tab;
43
46
  Tab.defaultProps = {
@@ -7,7 +7,8 @@ exports.animatedSideScroll = animatedSideScroll;
7
7
  const DURATION = 250;
8
8
  const SCROLL_STEP = 0.5;
9
9
 
10
- function animatedSideScroll(scrollBox, callback, goBackwards = false) {
10
+ function animatedSideScroll(scrollBox, callback) {
11
+ let goBackwards = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
11
12
  const startValue = scrollBox.scrollLeft;
12
13
  const endValue = getEndValue(scrollBox, startValue, goBackwards);
13
14
  const change = endValue - startValue;
@@ -27,13 +28,14 @@ function getEndValue(scrollBox, startValue, goBackwards) {
27
28
  return Math.floor(startValue + scrollDistance * inverter);
28
29
  }
29
30
 
30
- function createFrameStepper({
31
- scrollBox,
32
- callback,
33
- startValue,
34
- endValue,
35
- change
36
- }) {
31
+ function createFrameStepper(_ref) {
32
+ let {
33
+ scrollBox,
34
+ callback,
35
+ startValue,
36
+ endValue,
37
+ change
38
+ } = _ref;
37
39
  let startTimestamp, elapsedTime, scrollValue;
38
40
  return function step(timestamp) {
39
41
  if (!startTimestamp) {
@@ -61,10 +63,11 @@ function createFrameStepper({
61
63
  };
62
64
  }
63
65
 
64
- function easeInOutQuad({
65
- currentTime,
66
- startValue,
67
- change
68
- }) {
66
+ function easeInOutQuad(_ref2) {
67
+ let {
68
+ currentTime,
69
+ startValue,
70
+ change
71
+ } = _ref2;
69
72
  return (currentTime /= DURATION / 2) < 1 ? change / 2 * currentTime * currentTime + startValue : -change / 2 * (--currentTime * (currentTime - 2) - 1) + startValue;
70
73
  }
@@ -6,18 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.detectHorizontalScrollbarHeight = detectHorizontalScrollbarHeight;
7
7
  let horizontalScrollbarHeight;
8
8
  const className = '__vertical-scrollbar-height-test__';
9
- const styles = `
10
- .${className} {
11
- position: absolute;
12
- top: -9999px;
13
- width: 100px;
14
- height: 100px;
15
- overflow-x: scroll;
16
- }
17
- .${className}::-webkit-scrollbar {
18
- display: none;
19
- }
20
- `;
9
+ const styles = "\n .".concat(className, " {\n position: absolute;\n top: -9999px;\n width: 100px;\n height: 100px;\n overflow-x: scroll;\n }\n .").concat(className, "::-webkit-scrollbar {\n display: none;\n }\n");
21
10
 
22
11
  function detectHorizontalScrollbarHeight() {
23
12
  if (horizontalScrollbarHeight) {
@@ -192,7 +192,7 @@ class ScrollBar extends _react.Component {
192
192
  }, /*#__PURE__*/_react.default.createElement(_uiIcons.IconChevronRight16, null)), /*#__PURE__*/_react.default.createElement(_style.default, {
193
193
  id: "4174900658",
194
194
  dynamic: [-this.horizontalScrollBarHeight]
195
- }, [`.scroll-box.__jsx-style-dynamic-selector{margin-bottom:${-this.horizontalScrollBarHeight}px;}`]), /*#__PURE__*/_react.default.createElement(_style.default, {
195
+ }, [".scroll-box.__jsx-style-dynamic-selector{margin-bottom:".concat(-this.horizontalScrollBarHeight, "px;}")]), /*#__PURE__*/_react.default.createElement(_style.default, {
196
196
  id: "191575146"
197
197
  }, [".scroll-bar.jsx-191575146{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;}", ".scroll-box-clipper.jsx-191575146{overflow-y:hidden;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".scroll-box.jsx-191575146{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;overflow-x:scroll;-webkit-overflow-scrolling:touch;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".scroll-box.jsx-191575146::-webkit-scrollbar{display:none;}", ".scroll-area.jsx-191575146{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex:1 0 auto;-ms-flex:1 0 auto;flex:1 0 auto;overflow-x:hidden;}"]));
198
198
  }
@@ -17,21 +17,24 @@ var _react = _interopRequireDefault(require("react"));
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
- const ScrollButton = ({
21
- children,
22
- disabled,
23
- hidden,
24
- onClick
25
- }) => /*#__PURE__*/_react.default.createElement("button", {
26
- onClick: disabled ? undefined : onClick,
27
- className: _style.default.dynamic([["2701682090", [_uiConstants.colors.white, _uiConstants.colors.grey400, _uiConstants.colors.grey600, _uiConstants.colors.grey100, _uiConstants.colors.grey200, _uiConstants.colors.grey500]]]) + " " + ((0, _classnames.default)('scroll-button', {
20
+ const ScrollButton = _ref => {
21
+ let {
22
+ children,
28
23
  disabled,
29
- hidden
30
- }) || "")
31
- }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
32
- id: "2701682090",
33
- dynamic: [_uiConstants.colors.white, _uiConstants.colors.grey400, _uiConstants.colors.grey600, _uiConstants.colors.grey100, _uiConstants.colors.grey200, _uiConstants.colors.grey500]
34
- }, [`.scroll-button.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:inherit;background-color:${_uiConstants.colors.white};border:none;border-bottom:1px solid ${_uiConstants.colors.grey400};outline:none;padding:16px 16px 11px 16px;cursor:pointer;}`, ".scroll-button.hidden.__jsx-style-dynamic-selector{display:none;}", `.scroll-button.__jsx-style-dynamic-selector svg{width:20px;height:20px;fill:${_uiConstants.colors.grey600};-webkit-transition:opacity 150ms ease-in-out;transition:opacity 150ms ease-in-out;opacity:1;}`, `.scroll-button.__jsx-style-dynamic-selector:hover{background-color:${_uiConstants.colors.grey100};}`, `.scroll-button.__jsx-style-dynamic-selector:active{background-color:${_uiConstants.colors.grey200};}`, ".scroll-button.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}", ".scroll-button.disabled.__jsx-style-dynamic-selector:hover{background-color:transparent;}", `.scroll-button.disabled.__jsx-style-dynamic-selector svg{fill:${_uiConstants.colors.grey500};}`]));
24
+ hidden,
25
+ onClick
26
+ } = _ref;
27
+ return /*#__PURE__*/_react.default.createElement("button", {
28
+ onClick: disabled ? undefined : onClick,
29
+ className: _style.default.dynamic([["2701682090", [_uiConstants.colors.white, _uiConstants.colors.grey400, _uiConstants.colors.grey600, _uiConstants.colors.grey100, _uiConstants.colors.grey200, _uiConstants.colors.grey500]]]) + " " + ((0, _classnames.default)('scroll-button', {
30
+ disabled,
31
+ hidden
32
+ }) || "")
33
+ }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
34
+ id: "2701682090",
35
+ dynamic: [_uiConstants.colors.white, _uiConstants.colors.grey400, _uiConstants.colors.grey600, _uiConstants.colors.grey100, _uiConstants.colors.grey200, _uiConstants.colors.grey500]
36
+ }, [".scroll-button.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:inherit;background-color:".concat(_uiConstants.colors.white, ";border:none;border-bottom:1px solid ").concat(_uiConstants.colors.grey400, ";outline:none;padding:16px 16px 11px 16px;cursor:pointer;}"), ".scroll-button.hidden.__jsx-style-dynamic-selector{display:none;}", ".scroll-button.__jsx-style-dynamic-selector svg{width:20px;height:20px;fill:".concat(_uiConstants.colors.grey600, ";-webkit-transition:opacity 150ms ease-in-out;transition:opacity 150ms ease-in-out;opacity:1;}"), ".scroll-button.__jsx-style-dynamic-selector:hover{background-color:".concat(_uiConstants.colors.grey100, ";}"), ".scroll-button.__jsx-style-dynamic-selector:active{background-color:".concat(_uiConstants.colors.grey200, ";}"), ".scroll-button.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}", ".scroll-button.disabled.__jsx-style-dynamic-selector:hover{background-color:transparent;}", ".scroll-button.disabled.__jsx-style-dynamic-selector svg{fill:".concat(_uiConstants.colors.grey500, ";}")]));
37
+ };
35
38
 
36
39
  exports.ScrollButton = ScrollButton;
37
40
  ScrollButton.displayName = 'ScrollButton';
@@ -15,22 +15,24 @@ var _tabs = require("./tabs.js");
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- const TabBar = ({
19
- fixed,
20
- children,
21
- className,
22
- scrollable,
23
- dataTest
24
- }) => {
18
+ const TabBar = _ref => {
19
+ let {
20
+ fixed,
21
+ children,
22
+ className,
23
+ scrollable,
24
+ dataTest
25
+ } = _ref;
26
+
25
27
  if (scrollable) {
26
28
  return /*#__PURE__*/_react.default.createElement("div", {
27
29
  className: className,
28
30
  "data-test": dataTest
29
31
  }, /*#__PURE__*/_react.default.createElement(_scrollBar.ScrollBar, {
30
- dataTest: `${dataTest}-scrollbar`
32
+ dataTest: "".concat(dataTest, "-scrollbar")
31
33
  }, /*#__PURE__*/_react.default.createElement(_tabs.Tabs, {
32
34
  fixed: fixed,
33
- dataTest: `${dataTest}-tabs`
35
+ dataTest: "".concat(dataTest, "-tabs")
34
36
  }, children)));
35
37
  }
36
38
 
@@ -39,7 +41,7 @@ const TabBar = ({
39
41
  "data-test": dataTest
40
42
  }, /*#__PURE__*/_react.default.createElement(_tabs.Tabs, {
41
43
  fixed: fixed,
42
- dataTest: `${dataTest}-tabs`
44
+ dataTest: "".concat(dataTest, "-tabs")
43
45
  }, children));
44
46
  };
45
47
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TabStatesWithIcon = exports.TabStates = exports.TabsWithHiddenScrollButtons = exports.TabsWithScroller = exports.FixedTabsFillContent = exports.DefaultFluid = exports.default = void 0;
6
+ exports.default = exports.TabsWithScroller = exports.TabsWithHiddenScrollButtons = exports.TabStatesWithIcon = exports.TabStates = exports.FixedTabsFillContent = exports.DefaultFluid = void 0;
7
7
 
8
8
  var _style = _interopRequireDefault(require("styled-jsx/style"));
9
9
 
@@ -17,9 +17,10 @@ var _index2 = require("./index.js");
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
- function AttachFile({
21
- className
22
- }) {
20
+ function AttachFile(_ref) {
21
+ let {
22
+ className
23
+ } = _ref;
23
24
  return /*#__PURE__*/_react.default.createElement("svg", {
24
25
  xmlns: "http://www.w3.org/2000/svg",
25
26
  viewBox: "0 0 48 48",
@@ -36,28 +37,7 @@ AttachFile.propTypes = {
36
37
  className: _propTypes.default.string
37
38
  };
38
39
  const subtitle = 'Ssed to divide content into categories and/or sections';
39
- const description = `
40
- Use tabs to split related content into separate sections.
41
-
42
- - Each tab should contain content that relates to one another, but the content should not overlap.
43
- - Tabs are especially useful for splitting up content that may be relevant to different user groups, instead of displaying overwhelming amounts of information on a single page.
44
- - Do not use tabs to compare content.
45
- - Do not use tabs for sequential content that needs to be done in order.
46
- - Do not use tabs for content that needs to be viewed at the same time.
47
- - The number of tabs is less important than splitting content into understandable, predictable groups. Do not group together unrelated content in order to reduce tab count. Users struggle more with unpredictable tabs than too many tabs.
48
-
49
- #### Naming
50
-
51
- Give tabs short, understandable names. Try to find a word or very short phrase that summarizes the content. If you cannot find a suitable word this may mean you are trying to fit too much content under a single tab. The content of a tab should be obvious from its name.
52
-
53
- For example: Do use "Legends" instead of "Set up legends", Do use "Data analysis" instead of "Options for analysis of data",
54
-
55
- Do not repeat a term across tabs. If tabs are used inside a 'Options' modal, it is enough to use tab names "Data", "Legend", "Style". Do not repeat 'options' for all, e.g. "Data options", "Legend options" etc.
56
-
57
- \`\`\`js
58
- import { TabBar, Tab } from '@dhis2/ui'
59
- \`\`\`
60
- `;
40
+ const description = "\nUse tabs to split related content into separate sections.\n\n- Each tab should contain content that relates to one another, but the content should not overlap.\n- Tabs are especially useful for splitting up content that may be relevant to different user groups, instead of displaying overwhelming amounts of information on a single page.\n- Do not use tabs to compare content.\n- Do not use tabs for sequential content that needs to be done in order.\n- Do not use tabs for content that needs to be viewed at the same time.\n- The number of tabs is less important than splitting content into understandable, predictable groups. Do not group together unrelated content in order to reduce tab count. Users struggle more with unpredictable tabs than too many tabs.\n\n#### Naming\n\nGive tabs short, understandable names. Try to find a word or very short phrase that summarizes the content. If you cannot find a suitable word this may mean you are trying to fit too much content under a single tab. The content of a tab should be obvious from its name.\n\nFor example: Do use \"Legends\" instead of \"Set up legends\", Do use \"Data analysis\" instead of \"Options for analysis of data\",\n\nDo not repeat a term across tabs. If tabs are used inside a 'Options' modal, it is enough to use tab names \"Data\", \"Legend\", \"Style\". Do not repeat 'options' for all, e.g. \"Data options\", \"Legend options\" etc.\n\n```js\nimport { TabBar, Tab } from '@dhis2/ui'\n```\n";
61
41
 
62
42
  const Wrapper = fn => /*#__PURE__*/_react.default.createElement("div", {
63
43
  style: {
@@ -70,10 +50,12 @@ window.onClick = (payload, event) => {
70
50
  console.log('onClick event', event);
71
51
  };
72
52
 
73
- const onClick = (...args) => window.onClick(...args);
53
+ const onClick = function () {
54
+ return window.onClick(...arguments);
55
+ };
74
56
 
75
57
  var _default = {
76
- title: 'Navigation/Tab Bar',
58
+ title: 'Tab Bar',
77
59
  component: _index2.TabBar,
78
60
  subcomponents: {
79
61
  Tab: _index.Tab
@@ -17,19 +17,22 @@ var _react = _interopRequireDefault(require("react"));
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
- const Tabs = ({
21
- children,
22
- fixed,
23
- dataTest
24
- }) => /*#__PURE__*/_react.default.createElement("div", {
25
- "data-test": dataTest,
26
- className: _style.default.dynamic([["2678989862", [_uiConstants.colors.grey400, _uiConstants.colors.white]]]) + " " + ((0, _classnames.default)({
27
- fixed
28
- }) || "")
29
- }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
30
- id: "2678989862",
31
- dynamic: [_uiConstants.colors.grey400, _uiConstants.colors.white]
32
- }, [`div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;position:relative;overflow:hidden;box-shadow:inset 0 -1px 0 0 ${_uiConstants.colors.grey400};-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;background:${_uiConstants.colors.white};}`]));
20
+ const Tabs = _ref => {
21
+ let {
22
+ children,
23
+ fixed,
24
+ dataTest
25
+ } = _ref;
26
+ return /*#__PURE__*/_react.default.createElement("div", {
27
+ "data-test": dataTest,
28
+ className: _style.default.dynamic([["2678989862", [_uiConstants.colors.grey400, _uiConstants.colors.white]]]) + " " + ((0, _classnames.default)({
29
+ fixed
30
+ }) || "")
31
+ }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
32
+ id: "2678989862",
33
+ dynamic: [_uiConstants.colors.grey400, _uiConstants.colors.white]
34
+ }, ["div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;position:relative;overflow:hidden;box-shadow:inset 0 -1px 0 0 ".concat(_uiConstants.colors.grey400, ";-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;background:").concat(_uiConstants.colors.white, ";}")]));
35
+ };
33
36
 
34
37
  exports.Tabs = Tabs;
35
38
  Tabs.propTypes = {
@@ -4,27 +4,30 @@ import cx from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
6
 
7
- const Tab = ({
8
- icon,
9
- onClick,
10
- selected,
11
- disabled,
12
- children,
13
- className,
14
- dataTest
15
- }) => /*#__PURE__*/React.createElement("button", {
16
- onClick: disabled ? undefined : event => onClick({}, event),
17
- "data-test": dataTest,
18
- className: _JSXStyle.dynamic([["1619053260", [colors.grey400, colors.grey600, theme.focus, colors.grey600, colors.grey100, colors.grey200, theme.primary700, theme.primary700, theme.primary700, colors.grey500, colors.grey500]]]) + " " + `${cx('tab', className, {
7
+ const Tab = _ref => {
8
+ let {
9
+ icon,
10
+ onClick,
19
11
  selected,
20
- disabled
21
- })}`
22
- }, icon, /*#__PURE__*/React.createElement("span", {
23
- className: _JSXStyle.dynamic([["1619053260", [colors.grey400, colors.grey600, theme.focus, colors.grey600, colors.grey100, colors.grey200, theme.primary700, theme.primary700, theme.primary700, colors.grey500, colors.grey500]]])
24
- }, children), /*#__PURE__*/React.createElement(_JSXStyle, {
25
- id: "1619053260",
26
- dynamic: [colors.grey400, colors.grey600, theme.focus, colors.grey600, colors.grey100, colors.grey200, theme.primary700, theme.primary700, theme.primary700, colors.grey500, colors.grey500]
27
- }, [`button.__jsx-style-dynamic-selector{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;vertical-align:bottom;height:100%;padding:16px 16px 11px;background-color:transparent;outline:none;border:none;border-bottom:1px solid ${colors.grey400};color:${colors.grey600};font-size:14px;line-height:20px;-webkit-transition:all 150ms ease-in-out;transition:all 150ms ease-in-out;-webkit-transition-property:color,background-color;transition-property:color,background-color;cursor:pointer;}`, ".fixed>button.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", "button.__jsx-style-dynamic-selector::after{content:' ';display:block;position:absolute;bottom:-1px;left:0;height:4px;width:100%;-webkit-transition:background-color 150ms ease-in-out;transition:background-color 150ms ease-in-out;background-color:transparent;}", "span.__jsx-style-dynamic-selector{max-width:320px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-webkit-transition:fill 150ms ease-in-out;transition:fill 150ms ease-in-out;}", `button.__jsx-style-dynamic-selector:focus{outline:3px solid ${theme.focus};outline-offset:-3px;}`, "button.__jsx-style-dynamic-selector:focus.__jsx-style-dynamic-selector:not(:focus-visible){outline:none;}", `button.__jsx-style-dynamic-selector>svg{fill:${colors.grey600};width:14px;height:14px;margin:0 4px 0 0;}`, `button.__jsx-style-dynamic-selector:hover{background-color:${colors.grey100};}`, `button.__jsx-style-dynamic-selector:active{background-color:${colors.grey200};}`, `button.selected.__jsx-style-dynamic-selector{color:${theme.primary700};}`, `button.selected.__jsx-style-dynamic-selector::after{background-color:${theme.primary700};}`, `button.selected.__jsx-style-dynamic-selector>svg{fill:${theme.primary700};}`, `button.disabled.__jsx-style-dynamic-selector{color:${colors.grey500};cursor:not-allowed;}`, "button.disabled.__jsx-style-dynamic-selector:hover,button.selected.__jsx-style-dynamic-selector:hover{background-color:transparent;}", `button.disabled.__jsx-style-dynamic-selector>svg{fill:${colors.grey500};}`]));
12
+ disabled,
13
+ children,
14
+ className,
15
+ dataTest
16
+ } = _ref;
17
+ return /*#__PURE__*/React.createElement("button", {
18
+ onClick: disabled ? undefined : event => onClick({}, event),
19
+ "data-test": dataTest,
20
+ className: _JSXStyle.dynamic([["1619053260", [colors.grey400, colors.grey600, theme.focus, colors.grey600, colors.grey100, colors.grey200, theme.primary700, theme.primary700, theme.primary700, colors.grey500, colors.grey500]]]) + " " + "".concat(cx('tab', className, {
21
+ selected,
22
+ disabled
23
+ }))
24
+ }, icon, /*#__PURE__*/React.createElement("span", {
25
+ className: _JSXStyle.dynamic([["1619053260", [colors.grey400, colors.grey600, theme.focus, colors.grey600, colors.grey100, colors.grey200, theme.primary700, theme.primary700, theme.primary700, colors.grey500, colors.grey500]]])
26
+ }, children), /*#__PURE__*/React.createElement(_JSXStyle, {
27
+ id: "1619053260",
28
+ dynamic: [colors.grey400, colors.grey600, theme.focus, colors.grey600, colors.grey100, colors.grey200, theme.primary700, theme.primary700, theme.primary700, colors.grey500, colors.grey500]
29
+ }, ["button.__jsx-style-dynamic-selector{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;vertical-align:bottom;height:100%;padding:16px 16px 11px;background-color:transparent;outline:none;border:none;border-bottom:1px solid ".concat(colors.grey400, ";color:").concat(colors.grey600, ";font-size:14px;line-height:20px;-webkit-transition:all 150ms ease-in-out;transition:all 150ms ease-in-out;-webkit-transition-property:color,background-color;transition-property:color,background-color;cursor:pointer;}"), ".fixed>button.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", "button.__jsx-style-dynamic-selector::after{content:' ';display:block;position:absolute;bottom:-1px;left:0;height:4px;width:100%;-webkit-transition:background-color 150ms ease-in-out;transition:background-color 150ms ease-in-out;background-color:transparent;}", "span.__jsx-style-dynamic-selector{max-width:320px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-webkit-transition:fill 150ms ease-in-out;transition:fill 150ms ease-in-out;}", "button.__jsx-style-dynamic-selector:focus{outline:3px solid ".concat(theme.focus, ";outline-offset:-3px;}"), "button.__jsx-style-dynamic-selector:focus.__jsx-style-dynamic-selector:not(:focus-visible){outline:none;}", "button.__jsx-style-dynamic-selector>svg{fill:".concat(colors.grey600, ";width:14px;height:14px;margin:0 4px 0 0;}"), "button.__jsx-style-dynamic-selector:hover{background-color:".concat(colors.grey100, ";}"), "button.__jsx-style-dynamic-selector:active{background-color:".concat(colors.grey200, ";}"), "button.selected.__jsx-style-dynamic-selector{color:".concat(theme.primary700, ";}"), "button.selected.__jsx-style-dynamic-selector::after{background-color:".concat(theme.primary700, ";}"), "button.selected.__jsx-style-dynamic-selector>svg{fill:".concat(theme.primary700, ";}"), "button.disabled.__jsx-style-dynamic-selector{color:".concat(colors.grey500, ";cursor:not-allowed;}"), "button.disabled.__jsx-style-dynamic-selector:hover,button.selected.__jsx-style-dynamic-selector:hover{background-color:transparent;}", "button.disabled.__jsx-style-dynamic-selector>svg{fill:".concat(colors.grey500, ";}")]));
30
+ };
28
31
 
29
32
  Tab.defaultProps = {
30
33
  dataTest: 'dhis2-uicore-tab'
@@ -1,6 +1,7 @@
1
1
  const DURATION = 250;
2
2
  const SCROLL_STEP = 0.5;
3
- export function animatedSideScroll(scrollBox, callback, goBackwards = false) {
3
+ export function animatedSideScroll(scrollBox, callback) {
4
+ let goBackwards = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
4
5
  const startValue = scrollBox.scrollLeft;
5
6
  const endValue = getEndValue(scrollBox, startValue, goBackwards);
6
7
  const change = endValue - startValue;
@@ -20,13 +21,14 @@ function getEndValue(scrollBox, startValue, goBackwards) {
20
21
  return Math.floor(startValue + scrollDistance * inverter);
21
22
  }
22
23
 
23
- function createFrameStepper({
24
- scrollBox,
25
- callback,
26
- startValue,
27
- endValue,
28
- change
29
- }) {
24
+ function createFrameStepper(_ref) {
25
+ let {
26
+ scrollBox,
27
+ callback,
28
+ startValue,
29
+ endValue,
30
+ change
31
+ } = _ref;
30
32
  let startTimestamp, elapsedTime, scrollValue;
31
33
  return function step(timestamp) {
32
34
  if (!startTimestamp) {
@@ -54,10 +56,11 @@ function createFrameStepper({
54
56
  };
55
57
  }
56
58
 
57
- function easeInOutQuad({
58
- currentTime,
59
- startValue,
60
- change
61
- }) {
59
+ function easeInOutQuad(_ref2) {
60
+ let {
61
+ currentTime,
62
+ startValue,
63
+ change
64
+ } = _ref2;
62
65
  return (currentTime /= DURATION / 2) < 1 ? change / 2 * currentTime * currentTime + startValue : -change / 2 * (--currentTime * (currentTime - 2) - 1) + startValue;
63
66
  }
@@ -1,17 +1,6 @@
1
1
  let horizontalScrollbarHeight;
2
2
  const className = '__vertical-scrollbar-height-test__';
3
- const styles = `
4
- .${className} {
5
- position: absolute;
6
- top: -9999px;
7
- width: 100px;
8
- height: 100px;
9
- overflow-x: scroll;
10
- }
11
- .${className}::-webkit-scrollbar {
12
- display: none;
13
- }
14
- `;
3
+ const styles = "\n .".concat(className, " {\n position: absolute;\n top: -9999px;\n width: 100px;\n height: 100px;\n overflow-x: scroll;\n }\n .").concat(className, "::-webkit-scrollbar {\n display: none;\n }\n");
15
4
  export function detectHorizontalScrollbarHeight() {
16
5
  if (horizontalScrollbarHeight) {
17
6
  return horizontalScrollbarHeight;
@@ -173,7 +173,7 @@ class ScrollBar extends Component {
173
173
  }, /*#__PURE__*/React.createElement(IconChevronRight16, null)), /*#__PURE__*/React.createElement(_JSXStyle, {
174
174
  id: "4174900658",
175
175
  dynamic: [-this.horizontalScrollBarHeight]
176
- }, [`.scroll-box.__jsx-style-dynamic-selector{margin-bottom:${-this.horizontalScrollBarHeight}px;}`]), /*#__PURE__*/React.createElement(_JSXStyle, {
176
+ }, [".scroll-box.__jsx-style-dynamic-selector{margin-bottom:".concat(-this.horizontalScrollBarHeight, "px;}")]), /*#__PURE__*/React.createElement(_JSXStyle, {
177
177
  id: "191575146"
178
178
  }, [".scroll-bar.jsx-191575146{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;}", ".scroll-box-clipper.jsx-191575146{overflow-y:hidden;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".scroll-box.jsx-191575146{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;overflow-x:scroll;-webkit-overflow-scrolling:touch;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".scroll-box.jsx-191575146::-webkit-scrollbar{display:none;}", ".scroll-area.jsx-191575146{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex:1 0 auto;-ms-flex:1 0 auto;flex:1 0 auto;overflow-x:hidden;}"]));
179
179
  }
@@ -3,21 +3,24 @@ import { colors } from '@dhis2/ui-constants';
3
3
  import cx from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
- export const ScrollButton = ({
7
- children,
8
- disabled,
9
- hidden,
10
- onClick
11
- }) => /*#__PURE__*/React.createElement("button", {
12
- onClick: disabled ? undefined : onClick,
13
- className: _JSXStyle.dynamic([["2701682090", [colors.white, colors.grey400, colors.grey600, colors.grey100, colors.grey200, colors.grey500]]]) + " " + (cx('scroll-button', {
6
+ export const ScrollButton = _ref => {
7
+ let {
8
+ children,
14
9
  disabled,
15
- hidden
16
- }) || "")
17
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
18
- id: "2701682090",
19
- dynamic: [colors.white, colors.grey400, colors.grey600, colors.grey100, colors.grey200, colors.grey500]
20
- }, [`.scroll-button.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:inherit;background-color:${colors.white};border:none;border-bottom:1px solid ${colors.grey400};outline:none;padding:16px 16px 11px 16px;cursor:pointer;}`, ".scroll-button.hidden.__jsx-style-dynamic-selector{display:none;}", `.scroll-button.__jsx-style-dynamic-selector svg{width:20px;height:20px;fill:${colors.grey600};-webkit-transition:opacity 150ms ease-in-out;transition:opacity 150ms ease-in-out;opacity:1;}`, `.scroll-button.__jsx-style-dynamic-selector:hover{background-color:${colors.grey100};}`, `.scroll-button.__jsx-style-dynamic-selector:active{background-color:${colors.grey200};}`, ".scroll-button.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}", ".scroll-button.disabled.__jsx-style-dynamic-selector:hover{background-color:transparent;}", `.scroll-button.disabled.__jsx-style-dynamic-selector svg{fill:${colors.grey500};}`]));
10
+ hidden,
11
+ onClick
12
+ } = _ref;
13
+ return /*#__PURE__*/React.createElement("button", {
14
+ onClick: disabled ? undefined : onClick,
15
+ className: _JSXStyle.dynamic([["2701682090", [colors.white, colors.grey400, colors.grey600, colors.grey100, colors.grey200, colors.grey500]]]) + " " + (cx('scroll-button', {
16
+ disabled,
17
+ hidden
18
+ }) || "")
19
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
20
+ id: "2701682090",
21
+ dynamic: [colors.white, colors.grey400, colors.grey600, colors.grey100, colors.grey200, colors.grey500]
22
+ }, [".scroll-button.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:inherit;background-color:".concat(colors.white, ";border:none;border-bottom:1px solid ").concat(colors.grey400, ";outline:none;padding:16px 16px 11px 16px;cursor:pointer;}"), ".scroll-button.hidden.__jsx-style-dynamic-selector{display:none;}", ".scroll-button.__jsx-style-dynamic-selector svg{width:20px;height:20px;fill:".concat(colors.grey600, ";-webkit-transition:opacity 150ms ease-in-out;transition:opacity 150ms ease-in-out;opacity:1;}"), ".scroll-button.__jsx-style-dynamic-selector:hover{background-color:".concat(colors.grey100, ";}"), ".scroll-button.__jsx-style-dynamic-selector:active{background-color:".concat(colors.grey200, ";}"), ".scroll-button.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}", ".scroll-button.disabled.__jsx-style-dynamic-selector:hover{background-color:transparent;}", ".scroll-button.disabled.__jsx-style-dynamic-selector svg{fill:".concat(colors.grey500, ";}")]));
23
+ };
21
24
  ScrollButton.displayName = 'ScrollButton';
22
25
  ScrollButton.propTypes = {
23
26
  children: PropTypes.any.isRequired,
@@ -3,22 +3,24 @@ import React from 'react';
3
3
  import { ScrollBar } from './scroll-bar.js';
4
4
  import { Tabs } from './tabs.js';
5
5
 
6
- const TabBar = ({
7
- fixed,
8
- children,
9
- className,
10
- scrollable,
11
- dataTest
12
- }) => {
6
+ const TabBar = _ref => {
7
+ let {
8
+ fixed,
9
+ children,
10
+ className,
11
+ scrollable,
12
+ dataTest
13
+ } = _ref;
14
+
13
15
  if (scrollable) {
14
16
  return /*#__PURE__*/React.createElement("div", {
15
17
  className: className,
16
18
  "data-test": dataTest
17
19
  }, /*#__PURE__*/React.createElement(ScrollBar, {
18
- dataTest: `${dataTest}-scrollbar`
20
+ dataTest: "".concat(dataTest, "-scrollbar")
19
21
  }, /*#__PURE__*/React.createElement(Tabs, {
20
22
  fixed: fixed,
21
- dataTest: `${dataTest}-tabs`
23
+ dataTest: "".concat(dataTest, "-tabs")
22
24
  }, children)));
23
25
  }
24
26
 
@@ -27,7 +29,7 @@ const TabBar = ({
27
29
  "data-test": dataTest
28
30
  }, /*#__PURE__*/React.createElement(Tabs, {
29
31
  fixed: fixed,
30
- dataTest: `${dataTest}-tabs`
32
+ dataTest: "".concat(dataTest, "-tabs")
31
33
  }, children));
32
34
  };
33
35
 
@@ -4,9 +4,10 @@ import React from 'react';
4
4
  import { Tab } from '../tab/index.js';
5
5
  import { TabBar } from './index.js';
6
6
 
7
- function AttachFile({
8
- className
9
- }) {
7
+ function AttachFile(_ref) {
8
+ let {
9
+ className
10
+ } = _ref;
10
11
  return /*#__PURE__*/React.createElement("svg", {
11
12
  xmlns: "http://www.w3.org/2000/svg",
12
13
  viewBox: "0 0 48 48",
@@ -23,28 +24,7 @@ AttachFile.propTypes = {
23
24
  className: PropTypes.string
24
25
  };
25
26
  const subtitle = 'Ssed to divide content into categories and/or sections';
26
- const description = `
27
- Use tabs to split related content into separate sections.
28
-
29
- - Each tab should contain content that relates to one another, but the content should not overlap.
30
- - Tabs are especially useful for splitting up content that may be relevant to different user groups, instead of displaying overwhelming amounts of information on a single page.
31
- - Do not use tabs to compare content.
32
- - Do not use tabs for sequential content that needs to be done in order.
33
- - Do not use tabs for content that needs to be viewed at the same time.
34
- - The number of tabs is less important than splitting content into understandable, predictable groups. Do not group together unrelated content in order to reduce tab count. Users struggle more with unpredictable tabs than too many tabs.
35
-
36
- #### Naming
37
-
38
- Give tabs short, understandable names. Try to find a word or very short phrase that summarizes the content. If you cannot find a suitable word this may mean you are trying to fit too much content under a single tab. The content of a tab should be obvious from its name.
39
-
40
- For example: Do use "Legends" instead of "Set up legends", Do use "Data analysis" instead of "Options for analysis of data",
41
-
42
- Do not repeat a term across tabs. If tabs are used inside a 'Options' modal, it is enough to use tab names "Data", "Legend", "Style". Do not repeat 'options' for all, e.g. "Data options", "Legend options" etc.
43
-
44
- \`\`\`js
45
- import { TabBar, Tab } from '@dhis2/ui'
46
- \`\`\`
47
- `;
27
+ const description = "\nUse tabs to split related content into separate sections.\n\n- Each tab should contain content that relates to one another, but the content should not overlap.\n- Tabs are especially useful for splitting up content that may be relevant to different user groups, instead of displaying overwhelming amounts of information on a single page.\n- Do not use tabs to compare content.\n- Do not use tabs for sequential content that needs to be done in order.\n- Do not use tabs for content that needs to be viewed at the same time.\n- The number of tabs is less important than splitting content into understandable, predictable groups. Do not group together unrelated content in order to reduce tab count. Users struggle more with unpredictable tabs than too many tabs.\n\n#### Naming\n\nGive tabs short, understandable names. Try to find a word or very short phrase that summarizes the content. If you cannot find a suitable word this may mean you are trying to fit too much content under a single tab. The content of a tab should be obvious from its name.\n\nFor example: Do use \"Legends\" instead of \"Set up legends\", Do use \"Data analysis\" instead of \"Options for analysis of data\",\n\nDo not repeat a term across tabs. If tabs are used inside a 'Options' modal, it is enough to use tab names \"Data\", \"Legend\", \"Style\". Do not repeat 'options' for all, e.g. \"Data options\", \"Legend options\" etc.\n\n```js\nimport { TabBar, Tab } from '@dhis2/ui'\n```\n";
48
28
 
49
29
  const Wrapper = fn => /*#__PURE__*/React.createElement("div", {
50
30
  style: {
@@ -57,10 +37,12 @@ window.onClick = (payload, event) => {
57
37
  console.log('onClick event', event);
58
38
  };
59
39
 
60
- const onClick = (...args) => window.onClick(...args);
40
+ const onClick = function () {
41
+ return window.onClick(...arguments);
42
+ };
61
43
 
62
44
  export default {
63
- title: 'Navigation/Tab Bar',
45
+ title: 'Tab Bar',
64
46
  component: TabBar,
65
47
  subcomponents: {
66
48
  Tab
@@ -4,19 +4,22 @@ import cx from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
6
 
7
- const Tabs = ({
8
- children,
9
- fixed,
10
- dataTest
11
- }) => /*#__PURE__*/React.createElement("div", {
12
- "data-test": dataTest,
13
- className: _JSXStyle.dynamic([["2678989862", [colors.grey400, colors.white]]]) + " " + (cx({
14
- fixed
15
- }) || "")
16
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
17
- id: "2678989862",
18
- dynamic: [colors.grey400, colors.white]
19
- }, [`div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;position:relative;overflow:hidden;box-shadow:inset 0 -1px 0 0 ${colors.grey400};-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;background:${colors.white};}`]));
7
+ const Tabs = _ref => {
8
+ let {
9
+ children,
10
+ fixed,
11
+ dataTest
12
+ } = _ref;
13
+ return /*#__PURE__*/React.createElement("div", {
14
+ "data-test": dataTest,
15
+ className: _JSXStyle.dynamic([["2678989862", [colors.grey400, colors.white]]]) + " " + (cx({
16
+ fixed
17
+ }) || "")
18
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
19
+ id: "2678989862",
20
+ dynamic: [colors.grey400, colors.white]
21
+ }, ["div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;position:relative;overflow:hidden;box-shadow:inset 0 -1px 0 0 ".concat(colors.grey400, ";-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;background:").concat(colors.white, ";}")]));
22
+ };
20
23
 
21
24
  Tabs.propTypes = {
22
25
  dataTest: PropTypes.string.isRequired,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/tab",
3
- "version": "8.1.11",
3
+ "version": "8.2.2",
4
4
  "description": "UI Tabs",
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-constants": "8.1.11",
36
- "@dhis2/ui-icons": "8.1.11",
35
+ "@dhis2/ui-constants": "8.2.2",
36
+ "@dhis2/ui-icons": "8.2.2",
37
37
  "classnames": "^2.3.1",
38
38
  "prop-types": "^15.7.2"
39
39
  },