@dhis2-ui/input 10.0.0-alpha.5 → 10.0.0-alpha.7

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.
@@ -9,4 +9,11 @@ Object.defineProperty(exports, "Input", {
9
9
  return _input.Input;
10
10
  }
11
11
  });
12
- var _input = require("./input.js");
12
+ Object.defineProperty(exports, "inputTypes", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _inputTypes.inputTypes;
16
+ }
17
+ });
18
+ var _input = require("./input.js");
19
+ var _inputTypes = require("./inputTypes.js");
@@ -10,6 +10,7 @@ var _statusIcon = require("@dhis2-ui/status-icon");
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _react = _interopRequireWildcard(require("react"));
13
+ var _inputTypes = require("./inputTypes.js");
13
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -58,7 +59,7 @@ class Input extends _react.Component {
58
59
  const {
59
60
  role,
60
61
  className,
61
- type,
62
+ type = 'text',
62
63
  dense,
63
64
  disabled,
64
65
  readOnly,
@@ -74,7 +75,7 @@ class Input extends _react.Component {
74
75
  min,
75
76
  step,
76
77
  autoComplete,
77
- dataTest
78
+ dataTest = 'dhis2-uicore-input'
78
79
  } = this.props;
79
80
  return /*#__PURE__*/_react.default.createElement("div", {
80
81
  "data-test": dataTest,
@@ -119,10 +120,10 @@ class Input extends _react.Component {
119
120
  }
120
121
  }
121
122
  exports.Input = Input;
122
- Input.defaultProps = {
123
+ _defineProperty(Input, "defaultProps", {
123
124
  type: 'text',
124
125
  dataTest: 'dhis2-uicore-input'
125
- };
126
+ });
126
127
  Input.propTypes = {
127
128
  /** The [native `autocomplete` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autocomplete) */
128
129
  autoComplete: _propTypes.default.string,
@@ -154,7 +155,7 @@ Input.propTypes = {
154
155
  step: _propTypes.default.string,
155
156
  tabIndex: _propTypes.default.string,
156
157
  /** The native input `type` attribute */
157
- type: _propTypes.default.oneOf(['text', 'number', 'password', 'email', 'url', 'tel', 'date', 'datetime', 'datetime-local', 'month', 'week', 'time', 'search']),
158
+ type: _propTypes.default.oneOf(_inputTypes.inputTypes),
158
159
  /** Applies 'valid' appearance for validation feedback. Mutually exclusive with `error` and `warning` props */
159
160
  valid: _uiConstants.sharedPropTypes.statusPropType,
160
161
  /** Value in the input. Can be used to control the component (recommended). Passed to event handler callbacks in object */
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.inputTypes = void 0;
7
+ const inputTypes = exports.inputTypes = ['text', 'number', 'password', 'email', 'url', 'tel', 'date', 'datetime', 'datetime-local', 'month', 'week', 'time', 'search'];
@@ -11,6 +11,9 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _react = _interopRequireDefault(require("react"));
12
12
  var _index = require("../input/index.js");
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
16
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
17
  class InputField extends _react.default.Component {
15
18
  render() {
16
19
  const {
@@ -41,7 +44,7 @@ class InputField extends _react.default.Component {
41
44
  validationText,
42
45
  inputWidth,
43
46
  autoComplete,
44
- dataTest
47
+ dataTest = 'dhis2-uiwidgets-inputfield'
45
48
  } = this.props;
46
49
  return /*#__PURE__*/_react.default.createElement(_field.Field, {
47
50
  className: className,
@@ -84,9 +87,9 @@ class InputField extends _react.default.Component {
84
87
  }
85
88
  }
86
89
  exports.InputField = InputField;
87
- InputField.defaultProps = {
90
+ _defineProperty(InputField, "defaultProps", {
88
91
  dataTest: 'dhis2-uiwidgets-inputfield'
89
- };
92
+ });
90
93
  const InputFieldProps = exports.InputFieldProps = {
91
94
  /** The [native `autocomplete` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autocomplete) */
92
95
  autoComplete: _propTypes.default.string,
@@ -124,7 +127,7 @@ const InputFieldProps = exports.InputFieldProps = {
124
127
  step: _propTypes.default.string,
125
128
  tabIndex: _propTypes.default.string,
126
129
  /** Type of input */
127
- type: _index.Input.propTypes.type,
130
+ type: _propTypes.default.oneOf(_index.inputTypes),
128
131
  /** Applies 'valid' appearance for validation feedback. Mutually exclusive with `error` and `warning` props */
129
132
  valid: _uiConstants.sharedPropTypes.statusPropType,
130
133
  /** Text below input for validation feedback. Receives styles depending on validation status */
@@ -1 +1,2 @@
1
- export { Input } from './input.js';
1
+ export { Input } from './input.js';
2
+ export { inputTypes } from './inputTypes.js';
@@ -7,6 +7,7 @@ import { StatusIcon } from '@dhis2-ui/status-icon';
7
7
  import cx from 'classnames';
8
8
  import PropTypes from 'prop-types';
9
9
  import React, { Component } from 'react';
10
+ import { inputTypes } from './inputTypes.js';
10
11
  const styles = [`.input.jsx-31445346{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;gap:${spacers.dp8};}`, `input.jsx-31445346{box-sizing:border-box;font-size:14px;line-height:16px;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;color:${colors.grey900};background-color:white;padding:11px 12px;max-height:40px;outline:0;border:1px solid ${colors.grey500};border-radius:3px;box-shadow:inset 0 0 1px 0 rgba(48,54,60,0.1);text-overflow:ellipsis;}`, "input.dense.jsx-31445346{max-height:32px;padding:7px 8px;}", `input.jsx-31445346:focus{outline:none;box-shadow:inset 0 0 0 2px ${theme.focus};border-color:${theme.focus};}`, `input.jsx-31445346::-webkit-input-placeholder{color:${colors.grey600};opacity:1;}`, `input.jsx-31445346::-moz-placeholder{color:${colors.grey600};opacity:1;}`, `input.jsx-31445346:-ms-input-placeholder{color:${colors.grey600};opacity:1;}`, `input.jsx-31445346::placeholder{color:${colors.grey600};opacity:1;}`, "input[type='date'].jsx-31445346::-webkit-inner-spin-button,input[type='date'].jsx-31445346::-webkit-calendar-picker-indicator,input[type='time'].jsx-31445346::-webkit-inner-spin-button,input[type='time'].jsx-31445346::-webkit-calendar-picker-indicator,input[type='datetime-local'].jsx-31445346::-webkit-inner-spin-button,input[type='datetime-local'].jsx-31445346::-webkit-calendar-picker-indicator{height:14px;padding-top:1px;padding-bottom:1px;}", "input[type='date'].jsx-31445346::-webkit-datetime-edit-fields-wrapper,input[type='datetime-local'].jsx-31445346::-webkit-datetime-edit-fields-wrapper,input[type='time'].jsx-31445346::-webkit-datetime-edit-fields-wrapper{padding:0;}", `input.warning.jsx-31445346{border-color:${theme.warning};}`, `input.error.jsx-31445346{border-color:${theme.error};}`, `input.read-only.jsx-31445346{background-color:${colors.grey050};border-color:${colors.grey300};box-shadow:none;cursor:text;}`, `input.disabled.jsx-31445346{background-color:${colors.grey100};border-color:${colors.grey500};color:${theme.disabled};cursor:not-allowed;}`];
11
12
  styles.__hash = "31445346";
12
13
  export class Input extends Component {
@@ -49,7 +50,7 @@ export class Input extends Component {
49
50
  const {
50
51
  role,
51
52
  className,
52
- type,
53
+ type = 'text',
53
54
  dense,
54
55
  disabled,
55
56
  readOnly,
@@ -65,7 +66,7 @@ export class Input extends Component {
65
66
  min,
66
67
  step,
67
68
  autoComplete,
68
- dataTest
69
+ dataTest = 'dhis2-uicore-input'
69
70
  } = this.props;
70
71
  return /*#__PURE__*/React.createElement("div", {
71
72
  "data-test": dataTest,
@@ -109,10 +110,10 @@ export class Input extends Component {
109
110
  }, ["input.jsx-3353877153{width:100%;}"]));
110
111
  }
111
112
  }
112
- Input.defaultProps = {
113
+ _defineProperty(Input, "defaultProps", {
113
114
  type: 'text',
114
115
  dataTest: 'dhis2-uicore-input'
115
- };
116
+ });
116
117
  Input.propTypes = {
117
118
  /** The [native `autocomplete` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autocomplete) */
118
119
  autoComplete: PropTypes.string,
@@ -144,7 +145,7 @@ Input.propTypes = {
144
145
  step: PropTypes.string,
145
146
  tabIndex: PropTypes.string,
146
147
  /** The native input `type` attribute */
147
- type: PropTypes.oneOf(['text', 'number', 'password', 'email', 'url', 'tel', 'date', 'datetime', 'datetime-local', 'month', 'week', 'time', 'search']),
148
+ type: PropTypes.oneOf(inputTypes),
148
149
  /** Applies 'valid' appearance for validation feedback. Mutually exclusive with `error` and `warning` props */
149
150
  valid: sharedPropTypes.statusPropType,
150
151
  /** Value in the input. Can be used to control the component (recommended). Passed to event handler callbacks in object */
@@ -0,0 +1 @@
1
+ export const inputTypes = ['text', 'number', 'password', 'email', 'url', 'tel', 'date', 'datetime', 'datetime-local', 'month', 'week', 'time', 'search'];
@@ -1,9 +1,12 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
4
  import { sharedPropTypes } from '@dhis2/ui-constants';
2
5
  import { Box } from '@dhis2-ui/box';
3
6
  import { Field } from '@dhis2-ui/field';
4
7
  import PropTypes from 'prop-types';
5
8
  import React from 'react';
6
- import { Input } from '../input/index.js';
9
+ import { Input, inputTypes } from '../input/index.js';
7
10
  class InputField extends React.Component {
8
11
  render() {
9
12
  const {
@@ -34,7 +37,7 @@ class InputField extends React.Component {
34
37
  validationText,
35
38
  inputWidth,
36
39
  autoComplete,
37
- dataTest
40
+ dataTest = 'dhis2-uiwidgets-inputfield'
38
41
  } = this.props;
39
42
  return /*#__PURE__*/React.createElement(Field, {
40
43
  className: className,
@@ -76,9 +79,9 @@ class InputField extends React.Component {
76
79
  })));
77
80
  }
78
81
  }
79
- InputField.defaultProps = {
82
+ _defineProperty(InputField, "defaultProps", {
80
83
  dataTest: 'dhis2-uiwidgets-inputfield'
81
- };
84
+ });
82
85
  const InputFieldProps = {
83
86
  /** The [native `autocomplete` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autocomplete) */
84
87
  autoComplete: PropTypes.string,
@@ -116,7 +119,7 @@ const InputFieldProps = {
116
119
  step: PropTypes.string,
117
120
  tabIndex: PropTypes.string,
118
121
  /** Type of input */
119
- type: Input.propTypes.type,
122
+ type: PropTypes.oneOf(inputTypes),
120
123
  /** Applies 'valid' appearance for validation feedback. Mutually exclusive with `error` and `warning` props */
121
124
  valid: sharedPropTypes.statusPropType,
122
125
  /** Text below input for validation feedback. Receives styles depending on validation status */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/input",
3
- "version": "10.0.0-alpha.5",
3
+ "version": "10.0.0-alpha.7",
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.0.0-alpha.5",
37
- "@dhis2-ui/field": "10.0.0-alpha.5",
38
- "@dhis2-ui/input": "10.0.0-alpha.5",
39
- "@dhis2-ui/loader": "10.0.0-alpha.5",
40
- "@dhis2-ui/status-icon": "10.0.0-alpha.5",
41
- "@dhis2/ui-constants": "10.0.0-alpha.5",
42
- "@dhis2/ui-icons": "10.0.0-alpha.5",
36
+ "@dhis2-ui/box": "10.0.0-alpha.7",
37
+ "@dhis2-ui/field": "10.0.0-alpha.7",
38
+ "@dhis2-ui/input": "10.0.0-alpha.7",
39
+ "@dhis2-ui/loader": "10.0.0-alpha.7",
40
+ "@dhis2-ui/status-icon": "10.0.0-alpha.7",
41
+ "@dhis2/ui-constants": "10.0.0-alpha.7",
42
+ "@dhis2/ui-icons": "10.0.0-alpha.7",
43
43
  "classnames": "^2.3.1",
44
44
  "prop-types": "^15.7.2"
45
45
  },