@dhis2-ui/tag 10.16.3-alpha.1 → 10.16.4

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.
@@ -12,8 +12,7 @@ var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preproces
12
12
  cy.get('[data-test="dhis2-uicore-tag"]').should('be.visible');
13
13
  });
14
14
  (0, _cypressCucumberPreprocessor.Then)('the width of the tag should be exactly the max width', () => {
15
- cy.all(() => cy.get('@maxWidth'), () => cy.get('[data-test="dhis2-uicore-tag"]')).then(_ref => {
16
- let [maxWidth, tag] = _ref;
15
+ cy.all(() => cy.get('@maxWidth'), () => cy.get('[data-test="dhis2-uicore-tag"]')).then(([maxWidth, tag]) => {
17
16
  expect(tag).to.have.css('width', maxWidth);
18
17
  });
19
18
  });
@@ -8,18 +8,15 @@ var _style = _interopRequireDefault(require("styled-jsx/style"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- const TagIcon = _ref => {
12
- let {
13
- children,
14
- dataTest
15
- } = _ref;
16
- return /*#__PURE__*/_react.default.createElement("div", {
17
- "data-test": dataTest,
18
- className: "jsx-1638813748"
19
- }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
20
- id: "1638813748"
21
- }, [".jsx-1638813748{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-inline-end:4px;max-height:16px;max-width:16px;}"]));
22
- };
11
+ const TagIcon = ({
12
+ children,
13
+ dataTest
14
+ }) => /*#__PURE__*/_react.default.createElement("div", {
15
+ "data-test": dataTest,
16
+ className: "jsx-1638813748"
17
+ }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
18
+ id: "1638813748"
19
+ }, [".jsx-1638813748{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-inline-end:4px;max-height:16px;max-width:16px;}"]));
23
20
  exports.TagIcon = TagIcon;
24
21
  TagIcon.propTypes = {
25
22
  dataTest: _propTypes.default.string.isRequired,
@@ -8,18 +8,15 @@ var _style = _interopRequireDefault(require("styled-jsx/style"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- const TagText = _ref => {
12
- let {
13
- children,
14
- dataTest
15
- } = _ref;
16
- return /*#__PURE__*/_react.default.createElement("span", {
17
- "data-test": dataTest,
18
- className: "jsx-1110058759"
19
- }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
20
- id: "1110058759"
21
- }, [".jsx-1110058759{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}"]));
22
- };
11
+ const TagText = ({
12
+ children,
13
+ dataTest
14
+ }) => /*#__PURE__*/_react.default.createElement("span", {
15
+ "data-test": dataTest,
16
+ className: "jsx-1110058759"
17
+ }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
18
+ id: "1110058759"
19
+ }, [".jsx-1110058759{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}"]));
23
20
  exports.TagText = TagText;
24
21
  TagText.propTypes = {
25
22
  dataTest: _propTypes.default.string.isRequired,
package/build/cjs/tag.js CHANGED
@@ -13,35 +13,32 @@ var _react = _interopRequireDefault(require("react"));
13
13
  var _tagIcon = require("./tag-icon.js");
14
14
  var _tagText = require("./tag-text.js");
15
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
- const Tag = _ref => {
17
- let {
18
- maxWidth = '240px',
16
+ const Tag = ({
17
+ maxWidth = '240px',
18
+ neutral,
19
+ negative,
20
+ positive,
21
+ icon,
22
+ bold,
23
+ className,
24
+ dataTest = 'dhis2-uicore-tag',
25
+ children
26
+ }) => /*#__PURE__*/_react.default.createElement("div", {
27
+ "data-test": dataTest,
28
+ className: _style.default.dynamic([["2409336266", [_uiConstants.colors.grey300, _uiConstants.colors.grey700, _uiConstants.colors.grey900, maxWidth, _uiConstants.colors.red100, _uiConstants.colors.red800, _uiConstants.colors.red900, _uiConstants.colors.blue100, _uiConstants.colors.blue800, _uiConstants.colors.blue900, _uiConstants.colors.green100, _uiConstants.colors.green800, _uiConstants.colors.green900, _uiConstants.colors.grey700, _uiConstants.colors.white, _uiConstants.colors.white, _uiConstants.colors.blue800, _uiConstants.colors.blue050, _uiConstants.colors.white, _uiConstants.colors.green700, _uiConstants.colors.green050, _uiConstants.colors.white, _uiConstants.colors.red700, _uiConstants.colors.red050, _uiConstants.colors.white]]]) + " " + ((0, _classnames.default)(className, {
19
29
  neutral,
20
- negative,
21
30
  positive,
22
- icon,
23
- bold,
24
- className,
25
- dataTest = 'dhis2-uicore-tag',
26
- children
27
- } = _ref;
28
- return /*#__PURE__*/_react.default.createElement("div", {
29
- "data-test": dataTest,
30
- className: _style.default.dynamic([["2409336266", [_uiConstants.colors.grey300, _uiConstants.colors.grey700, _uiConstants.colors.grey900, maxWidth, _uiConstants.colors.red100, _uiConstants.colors.red800, _uiConstants.colors.red900, _uiConstants.colors.blue100, _uiConstants.colors.blue800, _uiConstants.colors.blue900, _uiConstants.colors.green100, _uiConstants.colors.green800, _uiConstants.colors.green900, _uiConstants.colors.grey700, _uiConstants.colors.white, _uiConstants.colors.white, _uiConstants.colors.blue800, _uiConstants.colors.blue050, _uiConstants.colors.white, _uiConstants.colors.green700, _uiConstants.colors.green050, _uiConstants.colors.white, _uiConstants.colors.red700, _uiConstants.colors.red050, _uiConstants.colors.white]]]) + " " + ((0, _classnames.default)(className, {
31
- neutral,
32
- positive,
33
- negative,
34
- bold
35
- }) || "")
36
- }, icon && /*#__PURE__*/_react.default.createElement(_tagIcon.TagIcon, {
37
- dataTest: `${dataTest}-icon`
38
- }, icon), /*#__PURE__*/_react.default.createElement(_tagText.TagText, {
39
- dataTest: `${dataTest}-text`
40
- }, children), /*#__PURE__*/_react.default.createElement(_style.default, {
41
- id: "2409336266",
42
- dynamic: [_uiConstants.colors.grey300, _uiConstants.colors.grey700, _uiConstants.colors.grey900, maxWidth, _uiConstants.colors.red100, _uiConstants.colors.red800, _uiConstants.colors.red900, _uiConstants.colors.blue100, _uiConstants.colors.blue800, _uiConstants.colors.blue900, _uiConstants.colors.green100, _uiConstants.colors.green800, _uiConstants.colors.green900, _uiConstants.colors.grey700, _uiConstants.colors.white, _uiConstants.colors.white, _uiConstants.colors.blue800, _uiConstants.colors.blue050, _uiConstants.colors.white, _uiConstants.colors.green700, _uiConstants.colors.green050, _uiConstants.colors.white, _uiConstants.colors.red700, _uiConstants.colors.red050, _uiConstants.colors.white]
43
- }, [`div.__jsx-style-dynamic-selector{padding:5px 6px;border-radius:3px;background-color:${_uiConstants.colors.grey300};fill:${_uiConstants.colors.grey700};color:${_uiConstants.colors.grey900};max-width:${maxWidth};display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-size:13px;height:23px;}`, `.negative.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.red100};fill:${_uiConstants.colors.red800};color:${_uiConstants.colors.red900};}`, `.neutral.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.blue100};fill:${_uiConstants.colors.blue800};color:${_uiConstants.colors.blue900};}`, `.positive.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.green100};fill:${_uiConstants.colors.green800};color:${_uiConstants.colors.green900};}`, `.bold.__jsx-style-dynamic-selector{font-weight:700;background-color:${_uiConstants.colors.grey700};color:${_uiConstants.colors.white};fill:${_uiConstants.colors.white};}`, `.bold.neutral.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.blue800};color:${_uiConstants.colors.blue050};fill:${_uiConstants.colors.white};}`, `.bold.positive.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.green700};color:${_uiConstants.colors.green050};fill:${_uiConstants.colors.white};}`, `.bold.negative.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.red700};color:${_uiConstants.colors.red050};fill:${_uiConstants.colors.white};}`]));
44
- };
31
+ negative,
32
+ bold
33
+ }) || "")
34
+ }, icon && /*#__PURE__*/_react.default.createElement(_tagIcon.TagIcon, {
35
+ dataTest: `${dataTest}-icon`
36
+ }, icon), /*#__PURE__*/_react.default.createElement(_tagText.TagText, {
37
+ dataTest: `${dataTest}-text`
38
+ }, children), /*#__PURE__*/_react.default.createElement(_style.default, {
39
+ id: "2409336266",
40
+ dynamic: [_uiConstants.colors.grey300, _uiConstants.colors.grey700, _uiConstants.colors.grey900, maxWidth, _uiConstants.colors.red100, _uiConstants.colors.red800, _uiConstants.colors.red900, _uiConstants.colors.blue100, _uiConstants.colors.blue800, _uiConstants.colors.blue900, _uiConstants.colors.green100, _uiConstants.colors.green800, _uiConstants.colors.green900, _uiConstants.colors.grey700, _uiConstants.colors.white, _uiConstants.colors.white, _uiConstants.colors.blue800, _uiConstants.colors.blue050, _uiConstants.colors.white, _uiConstants.colors.green700, _uiConstants.colors.green050, _uiConstants.colors.white, _uiConstants.colors.red700, _uiConstants.colors.red050, _uiConstants.colors.white]
41
+ }, [`div.__jsx-style-dynamic-selector{padding:5px 6px;border-radius:3px;background-color:${_uiConstants.colors.grey300};fill:${_uiConstants.colors.grey700};color:${_uiConstants.colors.grey900};max-width:${maxWidth};display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-size:13px;height:23px;}`, `.negative.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.red100};fill:${_uiConstants.colors.red800};color:${_uiConstants.colors.red900};}`, `.neutral.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.blue100};fill:${_uiConstants.colors.blue800};color:${_uiConstants.colors.blue900};}`, `.positive.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.green100};fill:${_uiConstants.colors.green800};color:${_uiConstants.colors.green900};}`, `.bold.__jsx-style-dynamic-selector{font-weight:700;background-color:${_uiConstants.colors.grey700};color:${_uiConstants.colors.white};fill:${_uiConstants.colors.white};}`, `.bold.neutral.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.blue800};color:${_uiConstants.colors.blue050};fill:${_uiConstants.colors.white};}`, `.bold.positive.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.green700};color:${_uiConstants.colors.green050};fill:${_uiConstants.colors.white};}`, `.bold.negative.__jsx-style-dynamic-selector{background-color:${_uiConstants.colors.red700};color:${_uiConstants.colors.red050};fill:${_uiConstants.colors.white};}`]));
45
42
  exports.Tag = Tag;
46
43
  const tagVariantPropType = (0, _propTypes.mutuallyExclusive)(['neutral', 'positive', 'negative'], _propTypes2.default.bool);
47
44
  Tag.propTypes = {
@@ -10,8 +10,7 @@ Given('a tag with a max width and enough content to fill it completely is render
10
10
  cy.get('[data-test="dhis2-uicore-tag"]').should('be.visible');
11
11
  });
12
12
  Then('the width of the tag should be exactly the max width', () => {
13
- cy.all(() => cy.get('@maxWidth'), () => cy.get('[data-test="dhis2-uicore-tag"]')).then(_ref => {
14
- let [maxWidth, tag] = _ref;
13
+ cy.all(() => cy.get('@maxWidth'), () => cy.get('[data-test="dhis2-uicore-tag"]')).then(([maxWidth, tag]) => {
15
14
  expect(tag).to.have.css('width', maxWidth);
16
15
  });
17
16
  });
@@ -1,18 +1,15 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
- export const TagIcon = _ref => {
5
- let {
6
- children,
7
- dataTest
8
- } = _ref;
9
- return /*#__PURE__*/React.createElement("div", {
10
- "data-test": dataTest,
11
- className: "jsx-1638813748"
12
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
13
- id: "1638813748"
14
- }, [".jsx-1638813748{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-inline-end:4px;max-height:16px;max-width:16px;}"]));
15
- };
4
+ export const TagIcon = ({
5
+ children,
6
+ dataTest
7
+ }) => /*#__PURE__*/React.createElement("div", {
8
+ "data-test": dataTest,
9
+ className: "jsx-1638813748"
10
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
11
+ id: "1638813748"
12
+ }, [".jsx-1638813748{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-inline-end:4px;max-height:16px;max-width:16px;}"]));
16
13
  TagIcon.propTypes = {
17
14
  dataTest: PropTypes.string.isRequired,
18
15
  children: PropTypes.node
@@ -1,18 +1,15 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
- export const TagText = _ref => {
5
- let {
6
- children,
7
- dataTest
8
- } = _ref;
9
- return /*#__PURE__*/React.createElement("span", {
10
- "data-test": dataTest,
11
- className: "jsx-1110058759"
12
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
13
- id: "1110058759"
14
- }, [".jsx-1110058759{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}"]));
15
- };
4
+ export const TagText = ({
5
+ children,
6
+ dataTest
7
+ }) => /*#__PURE__*/React.createElement("span", {
8
+ "data-test": dataTest,
9
+ className: "jsx-1110058759"
10
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
11
+ id: "1110058759"
12
+ }, [".jsx-1110058759{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}"]));
16
13
  TagText.propTypes = {
17
14
  dataTest: PropTypes.string.isRequired,
18
15
  children: PropTypes.node
package/build/es/tag.js CHANGED
@@ -6,35 +6,32 @@ import PropTypes from 'prop-types';
6
6
  import React from 'react';
7
7
  import { TagIcon } from './tag-icon.js';
8
8
  import { TagText } from './tag-text.js';
9
- export const Tag = _ref => {
10
- let {
11
- maxWidth = '240px',
9
+ export const Tag = ({
10
+ maxWidth = '240px',
11
+ neutral,
12
+ negative,
13
+ positive,
14
+ icon,
15
+ bold,
16
+ className,
17
+ dataTest = 'dhis2-uicore-tag',
18
+ children
19
+ }) => /*#__PURE__*/React.createElement("div", {
20
+ "data-test": dataTest,
21
+ className: _JSXStyle.dynamic([["2409336266", [colors.grey300, colors.grey700, colors.grey900, maxWidth, colors.red100, colors.red800, colors.red900, colors.blue100, colors.blue800, colors.blue900, colors.green100, colors.green800, colors.green900, colors.grey700, colors.white, colors.white, colors.blue800, colors.blue050, colors.white, colors.green700, colors.green050, colors.white, colors.red700, colors.red050, colors.white]]]) + " " + (cx(className, {
12
22
  neutral,
13
- negative,
14
23
  positive,
15
- icon,
16
- bold,
17
- className,
18
- dataTest = 'dhis2-uicore-tag',
19
- children
20
- } = _ref;
21
- return /*#__PURE__*/React.createElement("div", {
22
- "data-test": dataTest,
23
- className: _JSXStyle.dynamic([["2409336266", [colors.grey300, colors.grey700, colors.grey900, maxWidth, colors.red100, colors.red800, colors.red900, colors.blue100, colors.blue800, colors.blue900, colors.green100, colors.green800, colors.green900, colors.grey700, colors.white, colors.white, colors.blue800, colors.blue050, colors.white, colors.green700, colors.green050, colors.white, colors.red700, colors.red050, colors.white]]]) + " " + (cx(className, {
24
- neutral,
25
- positive,
26
- negative,
27
- bold
28
- }) || "")
29
- }, icon && /*#__PURE__*/React.createElement(TagIcon, {
30
- dataTest: `${dataTest}-icon`
31
- }, icon), /*#__PURE__*/React.createElement(TagText, {
32
- dataTest: `${dataTest}-text`
33
- }, children), /*#__PURE__*/React.createElement(_JSXStyle, {
34
- id: "2409336266",
35
- dynamic: [colors.grey300, colors.grey700, colors.grey900, maxWidth, colors.red100, colors.red800, colors.red900, colors.blue100, colors.blue800, colors.blue900, colors.green100, colors.green800, colors.green900, colors.grey700, colors.white, colors.white, colors.blue800, colors.blue050, colors.white, colors.green700, colors.green050, colors.white, colors.red700, colors.red050, colors.white]
36
- }, [`div.__jsx-style-dynamic-selector{padding:5px 6px;border-radius:3px;background-color:${colors.grey300};fill:${colors.grey700};color:${colors.grey900};max-width:${maxWidth};display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-size:13px;height:23px;}`, `.negative.__jsx-style-dynamic-selector{background-color:${colors.red100};fill:${colors.red800};color:${colors.red900};}`, `.neutral.__jsx-style-dynamic-selector{background-color:${colors.blue100};fill:${colors.blue800};color:${colors.blue900};}`, `.positive.__jsx-style-dynamic-selector{background-color:${colors.green100};fill:${colors.green800};color:${colors.green900};}`, `.bold.__jsx-style-dynamic-selector{font-weight:700;background-color:${colors.grey700};color:${colors.white};fill:${colors.white};}`, `.bold.neutral.__jsx-style-dynamic-selector{background-color:${colors.blue800};color:${colors.blue050};fill:${colors.white};}`, `.bold.positive.__jsx-style-dynamic-selector{background-color:${colors.green700};color:${colors.green050};fill:${colors.white};}`, `.bold.negative.__jsx-style-dynamic-selector{background-color:${colors.red700};color:${colors.red050};fill:${colors.white};}`]));
37
- };
24
+ negative,
25
+ bold
26
+ }) || "")
27
+ }, icon && /*#__PURE__*/React.createElement(TagIcon, {
28
+ dataTest: `${dataTest}-icon`
29
+ }, icon), /*#__PURE__*/React.createElement(TagText, {
30
+ dataTest: `${dataTest}-text`
31
+ }, children), /*#__PURE__*/React.createElement(_JSXStyle, {
32
+ id: "2409336266",
33
+ dynamic: [colors.grey300, colors.grey700, colors.grey900, maxWidth, colors.red100, colors.red800, colors.red900, colors.blue100, colors.blue800, colors.blue900, colors.green100, colors.green800, colors.green900, colors.grey700, colors.white, colors.white, colors.blue800, colors.blue050, colors.white, colors.green700, colors.green050, colors.white, colors.red700, colors.red050, colors.white]
34
+ }, [`div.__jsx-style-dynamic-selector{padding:5px 6px;border-radius:3px;background-color:${colors.grey300};fill:${colors.grey700};color:${colors.grey900};max-width:${maxWidth};display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-size:13px;height:23px;}`, `.negative.__jsx-style-dynamic-selector{background-color:${colors.red100};fill:${colors.red800};color:${colors.red900};}`, `.neutral.__jsx-style-dynamic-selector{background-color:${colors.blue100};fill:${colors.blue800};color:${colors.blue900};}`, `.positive.__jsx-style-dynamic-selector{background-color:${colors.green100};fill:${colors.green800};color:${colors.green900};}`, `.bold.__jsx-style-dynamic-selector{font-weight:700;background-color:${colors.grey700};color:${colors.white};fill:${colors.white};}`, `.bold.neutral.__jsx-style-dynamic-selector{background-color:${colors.blue800};color:${colors.blue050};fill:${colors.white};}`, `.bold.positive.__jsx-style-dynamic-selector{background-color:${colors.green700};color:${colors.green050};fill:${colors.white};}`, `.bold.negative.__jsx-style-dynamic-selector{background-color:${colors.red700};color:${colors.red050};fill:${colors.white};}`]));
38
35
  const tagVariantPropType = mutuallyExclusive(['neutral', 'positive', 'negative'], PropTypes.bool);
39
36
  Tag.propTypes = {
40
37
  /** Use bold tags where it is important that the tag is seen by the user in an information dense interface. Bold tags should be reserved for edge cases and not overused. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/tag",
3
- "version": "10.16.3-alpha.1",
3
+ "version": "10.16.4",
4
4
  "description": "UI Tag",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@dhis2/prop-types": "^3.1.2",
36
- "@dhis2/ui-constants": "10.16.3-alpha.1",
36
+ "@dhis2/ui-constants": "10.16.4",
37
37
  "classnames": "^2.3.1",
38
38
  "prop-types": "^15.7.2"
39
39
  },