@dhis2/ui-constants 7.1.0 → 7.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/shared-prop-types.js +14 -17
- package/build/es/shared-prop-types.js +13 -12
- package/package.json +1 -2
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.popperReferenceArgType = exports.popperReferencePropType = exports.popperPlacementArgType = exports.popperPlacementPropType = exports.insideAlignmentArgType = exports.insideAlignmentPropType = exports.sizeArgType = exports.sizePropType = exports.buttonVariantArgType = exports.buttonVariantPropType = exports.statusArgType = exports.statusPropType = void 0;
|
7
7
|
|
8
|
-
var _propTypes =
|
8
|
+
var _propTypes = require("@dhis2/prop-types");
|
9
|
+
|
10
|
+
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
9
11
|
|
10
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
13
|
|
@@ -13,8 +15,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
13
15
|
* Status propType
|
14
16
|
* @return {PropType} Mutually exclusive status: valid/warning/error
|
15
17
|
*/
|
16
|
-
const statusPropType = _propTypes.
|
17
|
-
|
18
|
+
const statusPropType = (0, _propTypes.mutuallyExclusive)(['valid', 'warning', 'error'], _propTypes2.default.bool); // Exported for storybook
|
18
19
|
|
19
20
|
exports.statusPropType = statusPropType;
|
20
21
|
const statusArgType = {
|
@@ -35,9 +36,7 @@ const statusArgType = {
|
|
35
36
|
*/
|
36
37
|
|
37
38
|
exports.statusArgType = statusArgType;
|
38
|
-
|
39
|
-
const buttonVariantPropType = _propTypes.default.mutuallyExclusive(['primary', 'secondary', 'destructive'], _propTypes.default.bool);
|
40
|
-
|
39
|
+
const buttonVariantPropType = (0, _propTypes.mutuallyExclusive)(['primary', 'secondary', 'destructive'], _propTypes2.default.bool);
|
41
40
|
exports.buttonVariantPropType = buttonVariantPropType;
|
42
41
|
const buttonVariantArgType = {
|
43
42
|
// No description because it should be set for the component description
|
@@ -58,9 +57,7 @@ const buttonVariantArgType = {
|
|
58
57
|
*/
|
59
58
|
|
60
59
|
exports.buttonVariantArgType = buttonVariantArgType;
|
61
|
-
|
62
|
-
const sizePropType = _propTypes.default.mutuallyExclusive(['small', 'large', 'extrasmall'], _propTypes.default.bool);
|
63
|
-
|
60
|
+
const sizePropType = (0, _propTypes.mutuallyExclusive)(['small', 'large', 'extrasmall'], _propTypes2.default.bool);
|
64
61
|
exports.sizePropType = sizePropType;
|
65
62
|
const sizeArgType = {
|
66
63
|
// No description because it should be set in the component description
|
@@ -81,7 +78,7 @@ const sizeArgType = {
|
|
81
78
|
|
82
79
|
exports.sizeArgType = sizeArgType;
|
83
80
|
|
84
|
-
const insideAlignmentPropType =
|
81
|
+
const insideAlignmentPropType = _propTypes2.default.oneOf(['top', 'middle', 'bottom']);
|
85
82
|
|
86
83
|
exports.insideAlignmentPropType = insideAlignmentPropType;
|
87
84
|
const insideAlignmentArgType = {
|
@@ -103,7 +100,7 @@ const insideAlignmentArgType = {
|
|
103
100
|
|
104
101
|
exports.insideAlignmentArgType = insideAlignmentArgType;
|
105
102
|
|
106
|
-
const popperPlacementPropType =
|
103
|
+
const popperPlacementPropType = _propTypes2.default.oneOf(['auto', 'auto-start', 'auto-end', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end']);
|
107
104
|
|
108
105
|
exports.popperPlacementPropType = popperPlacementPropType;
|
109
106
|
const popperPlacementArgType = {
|
@@ -127,13 +124,13 @@ const popperPlacementArgType = {
|
|
127
124
|
|
128
125
|
exports.popperPlacementArgType = popperPlacementArgType;
|
129
126
|
|
130
|
-
const popperReferencePropType =
|
131
|
-
|
132
|
-
|
133
|
-
current:
|
127
|
+
const popperReferencePropType = _propTypes2.default.oneOfType([// DOM node
|
128
|
+
_propTypes2.default.instanceOf(Element), // React ref - React.useRef() or React.createRef()
|
129
|
+
_propTypes2.default.shape({
|
130
|
+
current: _propTypes2.default.instanceOf(Element)
|
134
131
|
}), // Virtual element
|
135
|
-
|
136
|
-
getBoundingClientRect:
|
132
|
+
_propTypes2.default.shape({
|
133
|
+
getBoundingClientRect: _propTypes2.default.func
|
137
134
|
})]);
|
138
135
|
|
139
136
|
exports.popperReferencePropType = popperReferencePropType;
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import
|
1
|
+
import { mutuallyExclusive } from '@dhis2/prop-types';
|
2
|
+
import PropTypes from 'prop-types';
|
2
3
|
/**
|
3
4
|
* Status propType
|
4
5
|
* @return {PropType} Mutually exclusive status: valid/warning/error
|
5
6
|
*/
|
6
7
|
|
7
|
-
export const statusPropType =
|
8
|
+
export const statusPropType = mutuallyExclusive(['valid', 'warning', 'error'], PropTypes.bool); // Exported for storybook
|
8
9
|
|
9
10
|
export const statusArgType = {
|
10
11
|
table: {
|
@@ -23,7 +24,7 @@ export const statusArgType = {
|
|
23
24
|
* primary/secondary/destructive
|
24
25
|
*/
|
25
26
|
|
26
|
-
export const buttonVariantPropType =
|
27
|
+
export const buttonVariantPropType = mutuallyExclusive(['primary', 'secondary', 'destructive'], PropTypes.bool);
|
27
28
|
export const buttonVariantArgType = {
|
28
29
|
// No description because it should be set for the component description
|
29
30
|
table: {
|
@@ -42,7 +43,7 @@ export const buttonVariantArgType = {
|
|
42
43
|
* small/large
|
43
44
|
*/
|
44
45
|
|
45
|
-
export const sizePropType =
|
46
|
+
export const sizePropType = mutuallyExclusive(['small', 'large', 'extrasmall'], PropTypes.bool);
|
46
47
|
export const sizeArgType = {
|
47
48
|
// No description because it should be set in the component description
|
48
49
|
table: {
|
@@ -60,7 +61,7 @@ export const sizeArgType = {
|
|
60
61
|
* @return {PropType} PropType that validates the inside alignment.
|
61
62
|
*/
|
62
63
|
|
63
|
-
export const insideAlignmentPropType =
|
64
|
+
export const insideAlignmentPropType = PropTypes.oneOf(['top', 'middle', 'bottom']);
|
64
65
|
export const insideAlignmentArgType = {
|
65
66
|
description: 'Inside alignment of the component',
|
66
67
|
table: {
|
@@ -78,7 +79,7 @@ export const insideAlignmentArgType = {
|
|
78
79
|
* @return {PropType} PropType that validates placements.
|
79
80
|
*/
|
80
81
|
|
81
|
-
export const popperPlacementPropType =
|
82
|
+
export const popperPlacementPropType = PropTypes.oneOf(['auto', 'auto-start', 'auto-end', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end']);
|
82
83
|
export const popperPlacementArgType = {
|
83
84
|
description: 'Placement properties relative to reference element',
|
84
85
|
table: {
|
@@ -98,13 +99,13 @@ export const popperPlacementArgType = {
|
|
98
99
|
* instance of an Element.
|
99
100
|
*/
|
100
101
|
|
101
|
-
export const popperReferencePropType =
|
102
|
-
|
103
|
-
|
104
|
-
current:
|
102
|
+
export const popperReferencePropType = PropTypes.oneOfType([// DOM node
|
103
|
+
PropTypes.instanceOf(Element), // React ref - React.useRef() or React.createRef()
|
104
|
+
PropTypes.shape({
|
105
|
+
current: PropTypes.instanceOf(Element)
|
105
106
|
}), // Virtual element
|
106
|
-
|
107
|
-
getBoundingClientRect:
|
107
|
+
PropTypes.shape({
|
108
|
+
getBoundingClientRect: PropTypes.func
|
108
109
|
})]);
|
109
110
|
export const popperReferenceArgType = {
|
110
111
|
description: 'A reference to the element to position against: either a DOM node, React ref, \
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dhis2/ui-constants",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.2.2",
|
4
4
|
"description": "Constants used in the UI libs",
|
5
5
|
"main": "./build/cjs/index.js",
|
6
6
|
"module": "./build/es/index.js",
|
@@ -26,7 +26,6 @@
|
|
26
26
|
"build": "d2-app-scripts build"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@dhis2/prop-types": "^1.6.4",
|
30
29
|
"prop-types": "^15.7.2"
|
31
30
|
},
|
32
31
|
"files": [
|