@dhis2-ui/input 10.4.0 → 10.5.1

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.
@@ -89,15 +89,17 @@ class Input extends _react.Component {
89
89
  prefixIcon,
90
90
  width
91
91
  } = this.props;
92
+ const statusIcon = error || loading || valid || warning;
93
+ const clearButtonPadding = statusIcon ? '40px' : '10px';
92
94
  return /*#__PURE__*/_react.default.createElement("div", {
93
95
  "data-test": dataTest,
94
- className: `jsx-${styles.__hash}` + " " + _style.default.dynamic([["3324859945", [width ? width : `100%`, _uiConstants.colors.grey600, _uiConstants.colors.grey500]]]) + " " + ((0, _classnames.default)('input', className, {
96
+ className: `jsx-${styles.__hash}` + " " + _style.default.dynamic([["1599465870", [width || `100%`, _uiConstants.colors.grey600, clearButtonPadding, _uiConstants.colors.grey500]]]) + " " + ((0, _classnames.default)('input', className, {
95
97
  'input-prefix-icon': prefixIcon
96
98
  }, {
97
99
  'input-clearable': clearable
98
100
  }) || "")
99
101
  }, prefixIcon && /*#__PURE__*/_react.default.createElement("span", {
100
- className: `jsx-${styles.__hash}` + " " + _style.default.dynamic([["3324859945", [width ? width : `100%`, _uiConstants.colors.grey600, _uiConstants.colors.grey500]]]) + " " + "prefix"
102
+ className: `jsx-${styles.__hash}` + " " + _style.default.dynamic([["1599465870", [width || `100%`, _uiConstants.colors.grey600, clearButtonPadding, _uiConstants.colors.grey500]]]) + " " + "prefix"
101
103
  }, prefixIcon), /*#__PURE__*/_react.default.createElement("input", {
102
104
  role: role,
103
105
  id: name,
@@ -117,7 +119,7 @@ class Input extends _react.Component {
117
119
  onBlur: this.handleBlur,
118
120
  onChange: this.handleChange,
119
121
  onKeyDown: this.handleKeyDown,
120
- className: `jsx-${styles.__hash}` + " " + _style.default.dynamic([["3324859945", [width ? width : `100%`, _uiConstants.colors.grey600, _uiConstants.colors.grey500]]]) + " " + ((0, _classnames.default)({
122
+ className: `jsx-${styles.__hash}` + " " + _style.default.dynamic([["1599465870", [width || `100%`, _uiConstants.colors.grey600, clearButtonPadding, _uiConstants.colors.grey500]]]) + " " + ((0, _classnames.default)({
121
123
  dense,
122
124
  disabled,
123
125
  error,
@@ -128,7 +130,7 @@ class Input extends _react.Component {
128
130
  }), clearable && value !== null && value !== void 0 && value.length ? /*#__PURE__*/_react.default.createElement("button", {
129
131
  type: "button",
130
132
  onClick: this.handleClear,
131
- className: `jsx-${styles.__hash}` + " " + _style.default.dynamic([["3324859945", [width ? width : `100%`, _uiConstants.colors.grey600, _uiConstants.colors.grey500]]]) + " " + "clear-button"
133
+ className: `jsx-${styles.__hash}` + " " + _style.default.dynamic([["1599465870", [width || `100%`, _uiConstants.colors.grey600, clearButtonPadding, _uiConstants.colors.grey500]]]) + " " + "clear-button"
132
134
  }, /*#__PURE__*/_react.default.createElement(_uiIcons.IconCross16, {
133
135
  color: _uiConstants.colors.white
134
136
  })) : null, /*#__PURE__*/_react.default.createElement(_statusIcon.StatusIcon, {
@@ -139,9 +141,9 @@ class Input extends _react.Component {
139
141
  }), /*#__PURE__*/_react.default.createElement(_style.default, {
140
142
  id: styles.__hash
141
143
  }, styles), /*#__PURE__*/_react.default.createElement(_style.default, {
142
- id: "3324859945",
143
- dynamic: [width ? width : `100%`, _uiConstants.colors.grey600, _uiConstants.colors.grey500]
144
- }, [`.input.__jsx-style-dynamic-selector{width:${width ? width : `100%`};}`, "input.__jsx-style-dynamic-selector{width:100%;}", ".input-prefix-icon.__jsx-style-dynamic-selector input.__jsx-style-dynamic-selector{padding-inline-start:30px;}", ".input-clearable.__jsx-style-dynamic-selector input.__jsx-style-dynamic-selector{padding-inline-end:30px;}", `.prefix.__jsx-style-dynamic-selector{position:absolute;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;pointer-events:none;left:10px;padding:0;color:${_uiConstants.colors.grey600};}`, `.clear-button.__jsx-style-dynamic-selector{position:absolute;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;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;border:none;cursor:pointer;height:16px;width:16px;border-radius:50%;right:10px;background:${_uiConstants.colors.grey500};padding:1px;}`]));
144
+ id: "1599465870",
145
+ dynamic: [width || `100%`, _uiConstants.colors.grey600, clearButtonPadding, _uiConstants.colors.grey500]
146
+ }, [`.input.__jsx-style-dynamic-selector{width:${width || `100%`};}`, "input.__jsx-style-dynamic-selector{width:100%;}", ".input-prefix-icon.__jsx-style-dynamic-selector input.__jsx-style-dynamic-selector{padding-inline-start:30px;}", ".input-clearable.__jsx-style-dynamic-selector input.__jsx-style-dynamic-selector{padding-inline-end:30px;}", `.prefix.__jsx-style-dynamic-selector{position:absolute;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;pointer-events:none;inset-inline-start:10px;padding:0;color:${_uiConstants.colors.grey600};}`, `.clear-button.__jsx-style-dynamic-selector{position:absolute;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;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;border:none;cursor:pointer;height:16px;width:16px;border-radius:50%;inset-inline-end:${clearButtonPadding};background:${_uiConstants.colors.grey500};padding:1px;}`]));
145
147
  }
146
148
  }
147
149
  exports.Input = Input;
@@ -80,15 +80,17 @@ export class Input extends Component {
80
80
  prefixIcon,
81
81
  width
82
82
  } = this.props;
83
+ const statusIcon = error || loading || valid || warning;
84
+ const clearButtonPadding = statusIcon ? '40px' : '10px';
83
85
  return /*#__PURE__*/React.createElement("div", {
84
86
  "data-test": dataTest,
85
- className: `jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([["3324859945", [width ? width : `100%`, colors.grey600, colors.grey500]]]) + " " + (cx('input', className, {
87
+ className: `jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([["1599465870", [width || `100%`, colors.grey600, clearButtonPadding, colors.grey500]]]) + " " + (cx('input', className, {
86
88
  'input-prefix-icon': prefixIcon
87
89
  }, {
88
90
  'input-clearable': clearable
89
91
  }) || "")
90
92
  }, prefixIcon && /*#__PURE__*/React.createElement("span", {
91
- className: `jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([["3324859945", [width ? width : `100%`, colors.grey600, colors.grey500]]]) + " " + "prefix"
93
+ className: `jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([["1599465870", [width || `100%`, colors.grey600, clearButtonPadding, colors.grey500]]]) + " " + "prefix"
92
94
  }, prefixIcon), /*#__PURE__*/React.createElement("input", {
93
95
  role: role,
94
96
  id: name,
@@ -108,7 +110,7 @@ export class Input extends Component {
108
110
  onBlur: this.handleBlur,
109
111
  onChange: this.handleChange,
110
112
  onKeyDown: this.handleKeyDown,
111
- className: `jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([["3324859945", [width ? width : `100%`, colors.grey600, colors.grey500]]]) + " " + (cx({
113
+ className: `jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([["1599465870", [width || `100%`, colors.grey600, clearButtonPadding, colors.grey500]]]) + " " + (cx({
112
114
  dense,
113
115
  disabled,
114
116
  error,
@@ -119,7 +121,7 @@ export class Input extends Component {
119
121
  }), clearable && value !== null && value !== void 0 && value.length ? /*#__PURE__*/React.createElement("button", {
120
122
  type: "button",
121
123
  onClick: this.handleClear,
122
- className: `jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([["3324859945", [width ? width : `100%`, colors.grey600, colors.grey500]]]) + " " + "clear-button"
124
+ className: `jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([["1599465870", [width || `100%`, colors.grey600, clearButtonPadding, colors.grey500]]]) + " " + "clear-button"
123
125
  }, /*#__PURE__*/React.createElement(IconCross16, {
124
126
  color: colors.white
125
127
  })) : null, /*#__PURE__*/React.createElement(StatusIcon, {
@@ -130,9 +132,9 @@ export class Input extends Component {
130
132
  }), /*#__PURE__*/React.createElement(_JSXStyle, {
131
133
  id: styles.__hash
132
134
  }, styles), /*#__PURE__*/React.createElement(_JSXStyle, {
133
- id: "3324859945",
134
- dynamic: [width ? width : `100%`, colors.grey600, colors.grey500]
135
- }, [`.input.__jsx-style-dynamic-selector{width:${width ? width : `100%`};}`, "input.__jsx-style-dynamic-selector{width:100%;}", ".input-prefix-icon.__jsx-style-dynamic-selector input.__jsx-style-dynamic-selector{padding-inline-start:30px;}", ".input-clearable.__jsx-style-dynamic-selector input.__jsx-style-dynamic-selector{padding-inline-end:30px;}", `.prefix.__jsx-style-dynamic-selector{position:absolute;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;pointer-events:none;left:10px;padding:0;color:${colors.grey600};}`, `.clear-button.__jsx-style-dynamic-selector{position:absolute;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;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;border:none;cursor:pointer;height:16px;width:16px;border-radius:50%;right:10px;background:${colors.grey500};padding:1px;}`]));
135
+ id: "1599465870",
136
+ dynamic: [width || `100%`, colors.grey600, clearButtonPadding, colors.grey500]
137
+ }, [`.input.__jsx-style-dynamic-selector{width:${width || `100%`};}`, "input.__jsx-style-dynamic-selector{width:100%;}", ".input-prefix-icon.__jsx-style-dynamic-selector input.__jsx-style-dynamic-selector{padding-inline-start:30px;}", ".input-clearable.__jsx-style-dynamic-selector input.__jsx-style-dynamic-selector{padding-inline-end:30px;}", `.prefix.__jsx-style-dynamic-selector{position:absolute;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;pointer-events:none;inset-inline-start:10px;padding:0;color:${colors.grey600};}`, `.clear-button.__jsx-style-dynamic-selector{position:absolute;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;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;border:none;cursor:pointer;height:16px;width:16px;border-radius:50%;inset-inline-end:${clearButtonPadding};background:${colors.grey500};padding:1px;}`]));
136
138
  }
137
139
  }
138
140
  _defineProperty(Input, "defaultProps", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/input",
3
- "version": "10.4.0",
3
+ "version": "10.5.1",
4
4
  "description": "UI Input",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,13 +33,13 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@dhis2/prop-types": "^3.1.2",
36
- "@dhis2-ui/box": "10.4.0",
37
- "@dhis2-ui/field": "10.4.0",
38
- "@dhis2-ui/input": "10.4.0",
39
- "@dhis2-ui/loader": "10.4.0",
40
- "@dhis2-ui/status-icon": "10.4.0",
41
- "@dhis2/ui-constants": "10.4.0",
42
- "@dhis2/ui-icons": "10.4.0",
36
+ "@dhis2-ui/box": "10.5.1",
37
+ "@dhis2-ui/field": "10.5.1",
38
+ "@dhis2-ui/input": "10.5.1",
39
+ "@dhis2-ui/loader": "10.5.1",
40
+ "@dhis2-ui/status-icon": "10.5.1",
41
+ "@dhis2/ui-constants": "10.5.1",
42
+ "@dhis2/ui-icons": "10.5.1",
43
43
  "classnames": "^2.3.1",
44
44
  "prop-types": "^15.7.2"
45
45
  },