@dhis2-ui/legend 9.11.0 → 9.11.1-beta.10
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/features/accepts_children/index.js +0 -1
- package/build/cjs/features/can_be_required/index.js +0 -1
- package/build/cjs/index.js +0 -1
- package/build/cjs/legend.e2e.stories.js +18 -0
- package/build/cjs/legend.js +4 -13
- package/build/cjs/legend.prod.stories.js +35 -0
- package/build/es/legend.e2e.stories.js +9 -0
- package/build/es/legend.js +3 -6
- package/build/es/{legend.stories.js → legend.prod.stories.js} +9 -3
- package/package.json +6 -6
- package/build/cjs/legend.stories.e2e.js +0 -13
- package/build/cjs/legend.stories.js +0 -36
- package/build/es/legend.stories.e2e.js +0 -6
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('a Legend with children is rendered', () => {
|
|
6
5
|
cy.visitStory('Legend', 'With children');
|
|
7
6
|
cy.get('[data-test="dhis2-uicore-legend"]').should('be.visible');
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('a Legend with content and a required flag is rendered', () => {
|
|
6
5
|
cy.visitStory('Legend', 'With content and required');
|
|
7
6
|
});
|
package/build/cjs/index.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WithContentAndRequired = exports.WithChildren = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _legend = require("./legend.js");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
var _default = exports.default = {
|
|
11
|
+
title: 'Legend'
|
|
12
|
+
};
|
|
13
|
+
const WithContentAndRequired = () => /*#__PURE__*/_react.default.createElement(_legend.Legend, {
|
|
14
|
+
required: true
|
|
15
|
+
}, "I am wrapped in a legend which has some styling");
|
|
16
|
+
exports.WithContentAndRequired = WithContentAndRequired;
|
|
17
|
+
const WithChildren = () => /*#__PURE__*/_react.default.createElement(_legend.Legend, null, "I am a child");
|
|
18
|
+
exports.WithChildren = WithChildren;
|
package/build/cjs/legend.js
CHANGED
|
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Legend = void 0;
|
|
7
|
-
|
|
8
7
|
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
-
|
|
10
|
-
var _required = require("@dhis2-ui/required");
|
|
11
|
-
|
|
12
8
|
var _uiConstants = require("@dhis2/ui-constants");
|
|
13
|
-
|
|
9
|
+
var _required = require("@dhis2-ui/required");
|
|
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 Legend = _ref => {
|
|
21
14
|
let {
|
|
22
15
|
className,
|
|
@@ -28,13 +21,12 @@ const Legend = _ref => {
|
|
|
28
21
|
"data-test": dataTest,
|
|
29
22
|
className: _style.default.dynamic([["945530629", [_uiConstants.colors.grey900]]]) + " " + (className || "")
|
|
30
23
|
}, children, required && /*#__PURE__*/_react.default.createElement(_required.Required, {
|
|
31
|
-
dataTest:
|
|
24
|
+
dataTest: `${dataTest}-required`
|
|
32
25
|
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
33
26
|
id: "945530629",
|
|
34
27
|
dynamic: [_uiConstants.colors.grey900]
|
|
35
|
-
}, [
|
|
28
|
+
}, [`legend.__jsx-style-dynamic-selector{font-size:14px;line-height:16px;color:${_uiConstants.colors.grey900};}`]));
|
|
36
29
|
};
|
|
37
|
-
|
|
38
30
|
exports.Legend = Legend;
|
|
39
31
|
Legend.defaultProps = {
|
|
40
32
|
dataTest: 'dhis2-uicore-legend'
|
|
@@ -43,7 +35,6 @@ Legend.propTypes = {
|
|
|
43
35
|
children: _propTypes.default.node,
|
|
44
36
|
className: _propTypes.default.string,
|
|
45
37
|
dataTest: _propTypes.default.string,
|
|
46
|
-
|
|
47
38
|
/** Indicates the associated field set is required */
|
|
48
39
|
required: _propTypes.default.bool
|
|
49
40
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Required = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _legend = require("./legend.js");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const description = `
|
|
11
|
+
Legends are to be used in a Field Set to describe the form fields. They may indicate that the fields are required.
|
|
12
|
+
|
|
13
|
+
See the [Field Set](../?path=/docs/forms-field-set-field-set--usage-example-a-radio-button-group-with-error-status) for a usage example.
|
|
14
|
+
|
|
15
|
+
\`\`\`js
|
|
16
|
+
import { Legend } from '@dhis2/ui'
|
|
17
|
+
\`\`\`
|
|
18
|
+
`;
|
|
19
|
+
var _default = exports.default = {
|
|
20
|
+
title: 'Legend',
|
|
21
|
+
component: _legend.Legend,
|
|
22
|
+
parameters: {
|
|
23
|
+
docs: {
|
|
24
|
+
description: {
|
|
25
|
+
component: description
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const Template = args => /*#__PURE__*/_react.default.createElement(_legend.Legend, args, "I am wrapped in a legend which has some styling");
|
|
31
|
+
const Default = exports.Default = Template.bind({});
|
|
32
|
+
const Required = exports.Required = Template.bind({});
|
|
33
|
+
Required.args = {
|
|
34
|
+
required: true
|
|
35
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Legend } from './legend.js';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Legend'
|
|
5
|
+
};
|
|
6
|
+
export const WithContentAndRequired = () => /*#__PURE__*/React.createElement(Legend, {
|
|
7
|
+
required: true
|
|
8
|
+
}, "I am wrapped in a legend which has some styling");
|
|
9
|
+
export const WithChildren = () => /*#__PURE__*/React.createElement(Legend, null, "I am a child");
|
package/build/es/legend.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { Required } from '@dhis2-ui/required';
|
|
3
2
|
import { colors } from '@dhis2/ui-constants';
|
|
3
|
+
import { Required } from '@dhis2-ui/required';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
|
|
7
6
|
const Legend = _ref => {
|
|
8
7
|
let {
|
|
9
8
|
className,
|
|
@@ -15,13 +14,12 @@ const Legend = _ref => {
|
|
|
15
14
|
"data-test": dataTest,
|
|
16
15
|
className: _JSXStyle.dynamic([["945530629", [colors.grey900]]]) + " " + (className || "")
|
|
17
16
|
}, children, required && /*#__PURE__*/React.createElement(Required, {
|
|
18
|
-
dataTest:
|
|
17
|
+
dataTest: `${dataTest}-required`
|
|
19
18
|
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20
19
|
id: "945530629",
|
|
21
20
|
dynamic: [colors.grey900]
|
|
22
|
-
}, [
|
|
21
|
+
}, [`legend.__jsx-style-dynamic-selector{font-size:14px;line-height:16px;color:${colors.grey900};}`]));
|
|
23
22
|
};
|
|
24
|
-
|
|
25
23
|
Legend.defaultProps = {
|
|
26
24
|
dataTest: 'dhis2-uicore-legend'
|
|
27
25
|
};
|
|
@@ -29,7 +27,6 @@ Legend.propTypes = {
|
|
|
29
27
|
children: PropTypes.node,
|
|
30
28
|
className: PropTypes.string,
|
|
31
29
|
dataTest: PropTypes.string,
|
|
32
|
-
|
|
33
30
|
/** Indicates the associated field set is required */
|
|
34
31
|
required: PropTypes.bool
|
|
35
32
|
};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Legend } from './legend.js';
|
|
3
|
-
const description =
|
|
3
|
+
const description = `
|
|
4
|
+
Legends are to be used in a Field Set to describe the form fields. They may indicate that the fields are required.
|
|
5
|
+
|
|
6
|
+
See the [Field Set](../?path=/docs/forms-field-set-field-set--usage-example-a-radio-button-group-with-error-status) for a usage example.
|
|
7
|
+
|
|
8
|
+
\`\`\`js
|
|
9
|
+
import { Legend } from '@dhis2/ui'
|
|
10
|
+
\`\`\`
|
|
11
|
+
`;
|
|
4
12
|
export default {
|
|
5
13
|
title: 'Legend',
|
|
6
14
|
component: Legend,
|
|
@@ -12,9 +20,7 @@ export default {
|
|
|
12
20
|
}
|
|
13
21
|
}
|
|
14
22
|
};
|
|
15
|
-
|
|
16
23
|
const Template = args => /*#__PURE__*/React.createElement(Legend, args, "I am wrapped in a legend which has some styling");
|
|
17
|
-
|
|
18
24
|
export const Default = Template.bind({});
|
|
19
25
|
export const Required = Template.bind({});
|
|
20
26
|
Required.args = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/legend",
|
|
3
|
-
"version": "9.11.
|
|
3
|
+
"version": "9.11.1-beta.10",
|
|
4
4
|
"description": "UI Legend",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,19 +22,19 @@
|
|
|
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/required": "9.11.
|
|
37
|
-
"@dhis2/ui-constants": "9.11.
|
|
36
|
+
"@dhis2-ui/required": "9.11.1-beta.10",
|
|
37
|
+
"@dhis2/ui-constants": "9.11.1-beta.10",
|
|
38
38
|
"classnames": "^2.3.1",
|
|
39
39
|
"prop-types": "^15.7.2"
|
|
40
40
|
},
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = require("@storybook/react");
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
|
-
var _legend = require("./legend.js");
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
(0, _react.storiesOf)('Legend', module).add('With content and required', () => /*#__PURE__*/_react2.default.createElement(_legend.Legend, {
|
|
12
|
-
required: true
|
|
13
|
-
}, "I am wrapped in a legend which has some styling")).add('With children', () => /*#__PURE__*/_react2.default.createElement(_legend.Legend, null, "I am a child"));
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.Required = exports.Default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _legend = require("./legend.js");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
const description = "\nLegends are to be used in a Field Set to describe the form fields. They may indicate that the fields are required.\n\nSee the [Field Set](../?path=/docs/forms-field-set-field-set--usage-example-a-radio-button-group-with-error-status) for a usage example.\n\n```js\nimport { Legend } from '@dhis2/ui'\n```\n";
|
|
15
|
-
var _default = {
|
|
16
|
-
title: 'Legend',
|
|
17
|
-
component: _legend.Legend,
|
|
18
|
-
parameters: {
|
|
19
|
-
docs: {
|
|
20
|
-
description: {
|
|
21
|
-
component: description
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.default = _default;
|
|
27
|
-
|
|
28
|
-
const Template = args => /*#__PURE__*/_react.default.createElement(_legend.Legend, args, "I am wrapped in a legend which has some styling");
|
|
29
|
-
|
|
30
|
-
const Default = Template.bind({});
|
|
31
|
-
exports.Default = Default;
|
|
32
|
-
const Required = Template.bind({});
|
|
33
|
-
exports.Required = Required;
|
|
34
|
-
Required.args = {
|
|
35
|
-
required: true
|
|
36
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { storiesOf } from '@storybook/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Legend } from './legend.js';
|
|
4
|
-
storiesOf('Legend', module).add('With content and required', () => /*#__PURE__*/React.createElement(Legend, {
|
|
5
|
-
required: true
|
|
6
|
-
}, "I am wrapped in a legend which has some styling")).add('With children', () => /*#__PURE__*/React.createElement(Legend, null, "I am a child"));
|