@dhis2-ui/loader 9.11.0 → 9.11.1-beta.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/circular-loader/__tests__/circular-loader.test.js +1 -5
- package/build/cjs/circular-loader/circular-loader.js +2 -10
- package/build/cjs/circular-loader/circular-loader.prod.stories.js +63 -0
- package/build/cjs/circular-loader/index.js +0 -1
- package/build/cjs/index.js +0 -2
- package/build/cjs/linear-loader/__tests__/linear-loader.test.js +1 -5
- package/build/cjs/linear-loader/index.js +0 -1
- package/build/cjs/linear-loader/linear-loader.js +4 -17
- package/build/cjs/linear-loader/{linear-loader.stories.js → linear-loader.prod.stories.js} +13 -22
- package/build/es/circular-loader/circular-loader.js +1 -3
- package/build/es/circular-loader/{circular-loader.stories.js → circular-loader.prod.stories.js} +16 -7
- package/build/es/linear-loader/linear-loader.js +3 -10
- package/build/es/linear-loader/{linear-loader.stories.js → linear-loader.prod.stories.js} +11 -3
- package/package.json +5 -5
- package/build/cjs/circular-loader/circular-loader.stories.js +0 -64
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _enzyme = require("enzyme");
|
|
4
|
-
|
|
5
4
|
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
5
|
var _circularLoader = require("../circular-loader.js");
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
7
|
describe('Circular Loader', () => {
|
|
12
8
|
it('renders the circular loader with aria label', () => {
|
|
13
9
|
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_circularLoader.CircularLoader, {
|
|
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CircularLoader = void 0;
|
|
7
|
-
|
|
8
7
|
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
-
|
|
10
8
|
var _uiConstants = require("@dhis2/ui-constants");
|
|
11
|
-
|
|
12
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
13
|
const CircularLoader = _ref => {
|
|
21
14
|
let {
|
|
22
15
|
small,
|
|
@@ -40,9 +33,8 @@ const CircularLoader = _ref => {
|
|
|
40
33
|
}, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
41
34
|
id: "3803726117",
|
|
42
35
|
dynamic: [_uiConstants.colors.blue600, _uiConstants.colors.white]
|
|
43
|
-
}, [
|
|
36
|
+
}, [`div.__jsx-style-dynamic-selector{width:48px;height:48px;border:6px solid rgba(110,122,138,0.15);border-bottom-color:${_uiConstants.colors.blue600};border-radius:50%;-webkit-animation:rotation-__jsx-style-dynamic-selector 1s linear infinite;animation:rotation-__jsx-style-dynamic-selector 1s linear infinite;}`, "@-webkit-keyframes rotation-__jsx-style-dynamic-selector{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}", "@keyframes rotation-__jsx-style-dynamic-selector{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}", ".small.__jsx-style-dynamic-selector{width:24px;height:24px;border-width:4px;}", ".large.__jsx-style-dynamic-selector{width:72px;height:72px;border-width:8px;}", ".extrasmall.__jsx-style-dynamic-selector{width:16px;height:16px;border-width:2px;}", `.invert.__jsx-style-dynamic-selector{border-color:rgba(33,41,52,0.5);border-bottom-color:${_uiConstants.colors.white};}`]));
|
|
44
37
|
};
|
|
45
|
-
|
|
46
38
|
exports.CircularLoader = CircularLoader;
|
|
47
39
|
CircularLoader.defaultProps = {
|
|
48
40
|
dataTest: 'dhis2-uicore-circularloader'
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Small = exports.Large = exports.ExtraSmall = exports.Default = void 0;
|
|
7
|
+
var _uiConstants = require("@dhis2/ui-constants");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _index = require("./index.js");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const subtitle = `Used to inform the user that an element or page is in a loading state`;
|
|
12
|
+
const description = `
|
|
13
|
+
Use loading indicators whenever a component or application takes longer than 700ms to load. After this time a loader should be displayed so that the user can understand what is happening: loading is in progress. Consider that without a loading indicator a user would be unsure of their current status, so they are important UI elements.
|
|
14
|
+
|
|
15
|
+
A circular loader is used when the loading time is uncertain and cannot be displayed as a percentage. A circular loader can spin many times, and each spin does not represent any amount of completion.
|
|
16
|
+
|
|
17
|
+
\`\`\`js
|
|
18
|
+
import { CircularLoader } from '@dhis2/ui'
|
|
19
|
+
\`\`\`
|
|
20
|
+
`;
|
|
21
|
+
var _default = exports.default = {
|
|
22
|
+
title: 'Circular Loader',
|
|
23
|
+
component: _index.CircularLoader,
|
|
24
|
+
parameters: {
|
|
25
|
+
componentSubtitle: subtitle,
|
|
26
|
+
docs: {
|
|
27
|
+
description: {
|
|
28
|
+
component: description
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
argTypes: {
|
|
33
|
+
small: {
|
|
34
|
+
..._uiConstants.sharedPropTypes.sizeArgType
|
|
35
|
+
},
|
|
36
|
+
large: {
|
|
37
|
+
..._uiConstants.sharedPropTypes.sizeArgType
|
|
38
|
+
},
|
|
39
|
+
extrasmall: {
|
|
40
|
+
..._uiConstants.sharedPropTypes.sizeArgType
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const Template = args => /*#__PURE__*/_react.default.createElement(_index.CircularLoader, args);
|
|
45
|
+
const Default = exports.Default = Template.bind({});
|
|
46
|
+
Default.args = {
|
|
47
|
+
'aria-label': 'Default Loader'
|
|
48
|
+
};
|
|
49
|
+
const Small = exports.Small = Template.bind({});
|
|
50
|
+
Small.args = {
|
|
51
|
+
small: true,
|
|
52
|
+
'aria-label': 'Small Loader'
|
|
53
|
+
};
|
|
54
|
+
const Large = exports.Large = Template.bind({});
|
|
55
|
+
Large.args = {
|
|
56
|
+
large: true,
|
|
57
|
+
'aria-label': 'Large Loader'
|
|
58
|
+
};
|
|
59
|
+
const ExtraSmall = exports.ExtraSmall = Template.bind({});
|
|
60
|
+
ExtraSmall.args = {
|
|
61
|
+
extrasmall: true,
|
|
62
|
+
'aria-label': 'ExtraSmall Loader'
|
|
63
|
+
};
|
package/build/cjs/index.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _enzyme = require("enzyme");
|
|
4
|
-
|
|
5
4
|
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
5
|
var _linearLoader = require("../linear-loader.js");
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
7
|
describe('Linear Loader', () => {
|
|
12
8
|
it('renders the linear loader with provided aria attributes', () => {
|
|
13
9
|
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_linearLoader.LinearLoader, {
|
|
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.LinearLoader = void 0;
|
|
7
|
-
|
|
8
7
|
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
-
|
|
10
8
|
var _uiConstants = require("@dhis2/ui-constants");
|
|
11
|
-
|
|
12
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
13
|
const Progress = _ref => {
|
|
21
14
|
let {
|
|
22
15
|
amount,
|
|
@@ -30,18 +23,16 @@ const Progress = _ref => {
|
|
|
30
23
|
}, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
31
24
|
id: "686723300",
|
|
32
25
|
dynamic: [amount]
|
|
33
|
-
}, [
|
|
26
|
+
}, [`div.__jsx-style-dynamic-selector{width:${amount}%;}`]), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
34
27
|
id: "3392977398",
|
|
35
28
|
dynamic: [_uiConstants.theme.primary600, _uiConstants.colors.white]
|
|
36
|
-
}, [
|
|
29
|
+
}, [`div.__jsx-style-dynamic-selector{background-color:${_uiConstants.theme.primary600};-webkit-transition:width 0.3s linear;transition:width 0.3s linear;height:4px;}`, `.invert.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.white};}`]));
|
|
37
30
|
};
|
|
38
|
-
|
|
39
31
|
Progress.propTypes = {
|
|
40
32
|
amount: _propTypes.default.number.isRequired,
|
|
41
33
|
className: _propTypes.default.string,
|
|
42
34
|
invert: _propTypes.default.bool
|
|
43
35
|
};
|
|
44
|
-
|
|
45
36
|
const LinearLoader = _ref2 => {
|
|
46
37
|
let {
|
|
47
38
|
amount,
|
|
@@ -68,9 +59,8 @@ const LinearLoader = _ref2 => {
|
|
|
68
59
|
}, ["div.jsx-3127531794{display:block;overflow:hidden;overflow-x:hidden;overflow-y:hidden;background-color:rgba(110,122,138,0.15);}", ".invert.jsx-3127531794{background-color:rgba(33,41,52,0.5);}"]), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
69
60
|
id: "3224415970",
|
|
70
61
|
dynamic: [width, margin]
|
|
71
|
-
}, [
|
|
62
|
+
}, [`div.__jsx-style-dynamic-selector{width:${width};margin:${margin};}`]));
|
|
72
63
|
};
|
|
73
|
-
|
|
74
64
|
exports.LinearLoader = LinearLoader;
|
|
75
65
|
LinearLoader.defaultProps = {
|
|
76
66
|
margin: _uiConstants.spacers.dp12,
|
|
@@ -83,13 +73,10 @@ LinearLoader.propTypes = {
|
|
|
83
73
|
'aria-label': _propTypes.default.string,
|
|
84
74
|
className: _propTypes.default.string,
|
|
85
75
|
dataTest: _propTypes.default.string,
|
|
86
|
-
|
|
87
76
|
/** Use inverted color scheme */
|
|
88
77
|
invert: _propTypes.default.bool,
|
|
89
|
-
|
|
90
78
|
/** The margin around the loader, can be a full shorthand */
|
|
91
79
|
margin: _propTypes.default.string,
|
|
92
|
-
|
|
93
80
|
/** The width of the entire indicator */
|
|
94
81
|
width: _propTypes.default.string
|
|
95
82
|
};
|
|
@@ -4,24 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.RTL = exports.OverlayPage = exports.OverlayComponent = exports.Determinate = void 0;
|
|
7
|
-
|
|
7
|
+
var _uiConstants = require("@dhis2/ui-constants");
|
|
8
8
|
var _center = require("@dhis2-ui/center");
|
|
9
|
-
|
|
10
9
|
var _cover = require("@dhis2-ui/cover");
|
|
11
|
-
|
|
12
10
|
var _layer = require("@dhis2-ui/layer");
|
|
13
|
-
|
|
14
|
-
var _uiConstants = require("@dhis2/ui-constants");
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
|
|
18
12
|
var _index = require("./index.js");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const subtitle = `Used to inform the user that an element or page is in a loading state`;
|
|
15
|
+
const description = `
|
|
16
|
+
Use loading indicators whenever a component or application takes longer than 700ms to load. After this time a loader should be displayed so that the user can understand what is happening: loading is in progress. Consider that without a loading indicator a user would be unsure of their current status, so they are important UI elements.
|
|
17
|
+
|
|
18
|
+
A linear loader is used when the loading time is can be measured and displayed as a percentage.
|
|
19
|
+
|
|
20
|
+
\`\`\`js
|
|
21
|
+
import { LinearLoader } from '@dhis2/ui'
|
|
22
|
+
\`\`\`
|
|
23
|
+
`;
|
|
24
|
+
var _default = exports.default = {
|
|
25
25
|
title: 'Linear Loader',
|
|
26
26
|
component: _index.LinearLoader,
|
|
27
27
|
parameters: {
|
|
@@ -42,21 +42,16 @@ var _default = {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
exports.default = _default;
|
|
46
|
-
|
|
47
45
|
const Determinate = args => /*#__PURE__*/_react.default.createElement(_index.LinearLoader, args);
|
|
48
|
-
|
|
49
46
|
exports.Determinate = Determinate;
|
|
50
47
|
Determinate.args = {
|
|
51
48
|
amount: 60,
|
|
52
49
|
'aria-label': 'Determinate Loader'
|
|
53
50
|
};
|
|
54
|
-
|
|
55
51
|
const OverlayPage = args => /*#__PURE__*/_react.default.createElement(_layer.Layer, {
|
|
56
52
|
level: _uiConstants.layers.blocking,
|
|
57
53
|
translucent: true
|
|
58
54
|
}, /*#__PURE__*/_react.default.createElement(_center.Center, null, /*#__PURE__*/_react.default.createElement(_index.LinearLoader, args)));
|
|
59
|
-
|
|
60
55
|
exports.OverlayPage = OverlayPage;
|
|
61
56
|
OverlayPage.args = {
|
|
62
57
|
amount: 30,
|
|
@@ -67,7 +62,6 @@ OverlayPage.parameters = {
|
|
|
67
62
|
inlineStories: false
|
|
68
63
|
}
|
|
69
64
|
};
|
|
70
|
-
|
|
71
65
|
const OverlayComponent = args => /*#__PURE__*/_react.default.createElement("div", {
|
|
72
66
|
style: {
|
|
73
67
|
width: '400px',
|
|
@@ -76,17 +70,14 @@ const OverlayComponent = args => /*#__PURE__*/_react.default.createElement("div"
|
|
|
76
70
|
}, /*#__PURE__*/_react.default.createElement(_cover.Cover, {
|
|
77
71
|
translucent: true
|
|
78
72
|
}, /*#__PURE__*/_react.default.createElement(_center.Center, null, /*#__PURE__*/_react.default.createElement(_index.LinearLoader, args))));
|
|
79
|
-
|
|
80
73
|
exports.OverlayComponent = OverlayComponent;
|
|
81
74
|
OverlayComponent.args = {
|
|
82
75
|
amount: 80,
|
|
83
76
|
'aria-label': 'Loader with Overlay Component'
|
|
84
77
|
};
|
|
85
|
-
|
|
86
78
|
const RTL = args => /*#__PURE__*/_react.default.createElement("div", {
|
|
87
79
|
dir: "rtl"
|
|
88
80
|
}, /*#__PURE__*/_react.default.createElement(_index.LinearLoader, args));
|
|
89
|
-
|
|
90
81
|
exports.RTL = RTL;
|
|
91
82
|
RTL.args = {
|
|
92
83
|
amount: 60
|
|
@@ -3,7 +3,6 @@ import { colors, sharedPropTypes } from '@dhis2/ui-constants';
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
|
|
7
6
|
const CircularLoader = _ref => {
|
|
8
7
|
let {
|
|
9
8
|
small,
|
|
@@ -27,9 +26,8 @@ const CircularLoader = _ref => {
|
|
|
27
26
|
}, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
28
27
|
id: "3803726117",
|
|
29
28
|
dynamic: [colors.blue600, colors.white]
|
|
30
|
-
}, [
|
|
29
|
+
}, [`div.__jsx-style-dynamic-selector{width:48px;height:48px;border:6px solid rgba(110,122,138,0.15);border-bottom-color:${colors.blue600};border-radius:50%;-webkit-animation:rotation-__jsx-style-dynamic-selector 1s linear infinite;animation:rotation-__jsx-style-dynamic-selector 1s linear infinite;}`, "@-webkit-keyframes rotation-__jsx-style-dynamic-selector{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}", "@keyframes rotation-__jsx-style-dynamic-selector{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}", ".small.__jsx-style-dynamic-selector{width:24px;height:24px;border-width:4px;}", ".large.__jsx-style-dynamic-selector{width:72px;height:72px;border-width:8px;}", ".extrasmall.__jsx-style-dynamic-selector{width:16px;height:16px;border-width:2px;}", `.invert.__jsx-style-dynamic-selector{border-color:rgba(33,41,52,0.5);border-bottom-color:${colors.white};}`]));
|
|
31
30
|
};
|
|
32
|
-
|
|
33
31
|
CircularLoader.defaultProps = {
|
|
34
32
|
dataTest: 'dhis2-uicore-circularloader'
|
|
35
33
|
};
|
package/build/es/circular-loader/{circular-loader.stories.js → circular-loader.prod.stories.js}
RENAMED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { sharedPropTypes } from '@dhis2/ui-constants';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { CircularLoader } from './index.js';
|
|
4
|
-
const subtitle =
|
|
5
|
-
const description =
|
|
4
|
+
const subtitle = `Used to inform the user that an element or page is in a loading state`;
|
|
5
|
+
const description = `
|
|
6
|
+
Use loading indicators whenever a component or application takes longer than 700ms to load. After this time a loader should be displayed so that the user can understand what is happening: loading is in progress. Consider that without a loading indicator a user would be unsure of their current status, so they are important UI elements.
|
|
7
|
+
|
|
8
|
+
A circular loader is used when the loading time is uncertain and cannot be displayed as a percentage. A circular loader can spin many times, and each spin does not represent any amount of completion.
|
|
9
|
+
|
|
10
|
+
\`\`\`js
|
|
11
|
+
import { CircularLoader } from '@dhis2/ui'
|
|
12
|
+
\`\`\`
|
|
13
|
+
`;
|
|
6
14
|
export default {
|
|
7
15
|
title: 'Circular Loader',
|
|
8
16
|
component: CircularLoader,
|
|
@@ -15,17 +23,18 @@ export default {
|
|
|
15
23
|
}
|
|
16
24
|
},
|
|
17
25
|
argTypes: {
|
|
18
|
-
small: {
|
|
26
|
+
small: {
|
|
27
|
+
...sharedPropTypes.sizeArgType
|
|
19
28
|
},
|
|
20
|
-
large: {
|
|
29
|
+
large: {
|
|
30
|
+
...sharedPropTypes.sizeArgType
|
|
21
31
|
},
|
|
22
|
-
extrasmall: {
|
|
32
|
+
extrasmall: {
|
|
33
|
+
...sharedPropTypes.sizeArgType
|
|
23
34
|
}
|
|
24
35
|
}
|
|
25
36
|
};
|
|
26
|
-
|
|
27
37
|
const Template = args => /*#__PURE__*/React.createElement(CircularLoader, args);
|
|
28
|
-
|
|
29
38
|
export const Default = Template.bind({});
|
|
30
39
|
Default.args = {
|
|
31
40
|
'aria-label': 'Default Loader'
|
|
@@ -3,7 +3,6 @@ import { colors, theme, spacers } from '@dhis2/ui-constants';
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
|
|
7
6
|
const Progress = _ref => {
|
|
8
7
|
let {
|
|
9
8
|
amount,
|
|
@@ -17,18 +16,16 @@ const Progress = _ref => {
|
|
|
17
16
|
}, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
18
17
|
id: "686723300",
|
|
19
18
|
dynamic: [amount]
|
|
20
|
-
}, [
|
|
19
|
+
}, [`div.__jsx-style-dynamic-selector{width:${amount}%;}`]), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
21
20
|
id: "3392977398",
|
|
22
21
|
dynamic: [theme.primary600, colors.white]
|
|
23
|
-
}, [
|
|
22
|
+
}, [`div.__jsx-style-dynamic-selector{background-color:${theme.primary600};-webkit-transition:width 0.3s linear;transition:width 0.3s linear;height:4px;}`, `.invert.__jsx-style-dynamic-selector{background-color:${colors.white};}`]));
|
|
24
23
|
};
|
|
25
|
-
|
|
26
24
|
Progress.propTypes = {
|
|
27
25
|
amount: PropTypes.number.isRequired,
|
|
28
26
|
className: PropTypes.string,
|
|
29
27
|
invert: PropTypes.bool
|
|
30
28
|
};
|
|
31
|
-
|
|
32
29
|
const LinearLoader = _ref2 => {
|
|
33
30
|
let {
|
|
34
31
|
amount,
|
|
@@ -55,9 +52,8 @@ const LinearLoader = _ref2 => {
|
|
|
55
52
|
}, ["div.jsx-3127531794{display:block;overflow:hidden;overflow-x:hidden;overflow-y:hidden;background-color:rgba(110,122,138,0.15);}", ".invert.jsx-3127531794{background-color:rgba(33,41,52,0.5);}"]), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
56
53
|
id: "3224415970",
|
|
57
54
|
dynamic: [width, margin]
|
|
58
|
-
}, [
|
|
55
|
+
}, [`div.__jsx-style-dynamic-selector{width:${width};margin:${margin};}`]));
|
|
59
56
|
};
|
|
60
|
-
|
|
61
57
|
LinearLoader.defaultProps = {
|
|
62
58
|
margin: spacers.dp12,
|
|
63
59
|
width: '300px',
|
|
@@ -69,13 +65,10 @@ LinearLoader.propTypes = {
|
|
|
69
65
|
'aria-label': PropTypes.string,
|
|
70
66
|
className: PropTypes.string,
|
|
71
67
|
dataTest: PropTypes.string,
|
|
72
|
-
|
|
73
68
|
/** Use inverted color scheme */
|
|
74
69
|
invert: PropTypes.bool,
|
|
75
|
-
|
|
76
70
|
/** The margin around the loader, can be a full shorthand */
|
|
77
71
|
margin: PropTypes.string,
|
|
78
|
-
|
|
79
72
|
/** The width of the entire indicator */
|
|
80
73
|
width: PropTypes.string
|
|
81
74
|
};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import { layers } from '@dhis2/ui-constants';
|
|
1
2
|
import { Center } from '@dhis2-ui/center';
|
|
2
3
|
import { Cover } from '@dhis2-ui/cover';
|
|
3
4
|
import { Layer } from '@dhis2-ui/layer';
|
|
4
|
-
import { layers } from '@dhis2/ui-constants';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { LinearLoader } from './index.js';
|
|
7
|
-
const subtitle =
|
|
8
|
-
const description =
|
|
7
|
+
const subtitle = `Used to inform the user that an element or page is in a loading state`;
|
|
8
|
+
const description = `
|
|
9
|
+
Use loading indicators whenever a component or application takes longer than 700ms to load. After this time a loader should be displayed so that the user can understand what is happening: loading is in progress. Consider that without a loading indicator a user would be unsure of their current status, so they are important UI elements.
|
|
10
|
+
|
|
11
|
+
A linear loader is used when the loading time is can be measured and displayed as a percentage.
|
|
12
|
+
|
|
13
|
+
\`\`\`js
|
|
14
|
+
import { LinearLoader } from '@dhis2/ui'
|
|
15
|
+
\`\`\`
|
|
16
|
+
`;
|
|
9
17
|
export default {
|
|
10
18
|
title: 'Linear Loader',
|
|
11
19
|
component: LinearLoader,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/loader",
|
|
3
|
-
"version": "9.11.
|
|
3
|
+
"version": "9.11.1-beta.2",
|
|
4
4
|
"description": "UI Loaders",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
-
"start": "
|
|
25
|
+
"start": "storybook dev -c ../../storybook/config --port 5000",
|
|
26
26
|
"build": "d2-app-scripts build",
|
|
27
27
|
"test": "d2-app-scripts test --jestConfig ../../jest.config.shared.js"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"react": "^16.
|
|
31
|
-
"react-dom": "^16.
|
|
30
|
+
"react": "^16.13",
|
|
31
|
+
"react-dom": "^16.13",
|
|
32
32
|
"styled-jsx": "^4"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@dhis2/prop-types": "^3.1.2",
|
|
36
|
-
"@dhis2/ui-constants": "9.11.
|
|
36
|
+
"@dhis2/ui-constants": "9.11.1-beta.2",
|
|
37
37
|
"classnames": "^2.3.1",
|
|
38
38
|
"prop-types": "^15.7.2"
|
|
39
39
|
},
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.Small = exports.Large = exports.ExtraSmall = exports.Default = void 0;
|
|
7
|
-
|
|
8
|
-
var _uiConstants = require("@dhis2/ui-constants");
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _index = require("./index.js");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
const subtitle = "Used to inform the user that an element or page is in a loading state";
|
|
17
|
-
const description = "\nUse loading indicators whenever a component or application takes longer than 700ms to load. After this time a loader should be displayed so that the user can understand what is happening: loading is in progress. Consider that without a loading indicator a user would be unsure of their current status, so they are important UI elements.\n\nA circular loader is used when the loading time is uncertain and cannot be displayed as a percentage. A circular loader can spin many times, and each spin does not represent any amount of completion.\n\n```js\nimport { CircularLoader } from '@dhis2/ui'\n```\n";
|
|
18
|
-
var _default = {
|
|
19
|
-
title: 'Circular Loader',
|
|
20
|
-
component: _index.CircularLoader,
|
|
21
|
-
parameters: {
|
|
22
|
-
componentSubtitle: subtitle,
|
|
23
|
-
docs: {
|
|
24
|
-
description: {
|
|
25
|
-
component: description
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
argTypes: {
|
|
30
|
-
small: { ..._uiConstants.sharedPropTypes.sizeArgType
|
|
31
|
-
},
|
|
32
|
-
large: { ..._uiConstants.sharedPropTypes.sizeArgType
|
|
33
|
-
},
|
|
34
|
-
extrasmall: { ..._uiConstants.sharedPropTypes.sizeArgType
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
exports.default = _default;
|
|
39
|
-
|
|
40
|
-
const Template = args => /*#__PURE__*/_react.default.createElement(_index.CircularLoader, args);
|
|
41
|
-
|
|
42
|
-
const Default = Template.bind({});
|
|
43
|
-
exports.Default = Default;
|
|
44
|
-
Default.args = {
|
|
45
|
-
'aria-label': 'Default Loader'
|
|
46
|
-
};
|
|
47
|
-
const Small = Template.bind({});
|
|
48
|
-
exports.Small = Small;
|
|
49
|
-
Small.args = {
|
|
50
|
-
small: true,
|
|
51
|
-
'aria-label': 'Small Loader'
|
|
52
|
-
};
|
|
53
|
-
const Large = Template.bind({});
|
|
54
|
-
exports.Large = Large;
|
|
55
|
-
Large.args = {
|
|
56
|
-
large: true,
|
|
57
|
-
'aria-label': 'Large Loader'
|
|
58
|
-
};
|
|
59
|
-
const ExtraSmall = Template.bind({});
|
|
60
|
-
exports.ExtraSmall = ExtraSmall;
|
|
61
|
-
ExtraSmall.args = {
|
|
62
|
-
extrasmall: true,
|
|
63
|
-
'aria-label': 'ExtraSmall Loader'
|
|
64
|
-
};
|