@pingux/astro 2.46.0-alpha.1 → 2.46.0-alpha.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.
@@ -9,16 +9,15 @@ _Object$defineProperty(exports, "__esModule", {
9
9
  value: true
10
10
  });
11
11
  exports["default"] = void 0;
12
+ var _isInteger = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/number/is-integer"));
12
13
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
13
14
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
14
- var _base = _interopRequireDefault(require("@emotion/styled/base"));
15
15
  var _react = _interopRequireWildcard(require("react"));
16
- var _styledSystem = require("styled-system");
16
+ var _propTypes = _interopRequireDefault(require("prop-types"));
17
17
  var _themeUi = require("theme-ui");
18
+ var _isValidPositiveInt = _interopRequireDefault(require("../../utils/devUtils/props/isValidPositiveInt"));
18
19
  var _react2 = require("@emotion/react");
19
20
  var _excluded = ["name", "placeholder", "maxLength"];
20
- function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
21
  /**
23
22
  * Base input component.
24
23
  *
@@ -29,25 +28,34 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
29
28
  * We instead encourage developers to utilize our Field components wherever possible.
30
29
  * If this component is used, accessibility is left to the developer.
31
30
  */
32
-
33
- var ExtendedInput = /*#__PURE__*/(0, _base["default"])(_themeUi.Input, process.env.NODE_ENV === "production" ? {
34
- target: "e1lpwkt50"
35
- } : {
36
- target: "e1lpwkt50",
37
- label: "ExtendedInput"
38
- })(_styledSystem.layout, _styledSystem.flexbox, _styledSystem.typography, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0lucHV0L0lucHV0LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFpQnNCIiwiZmlsZSI6Ii4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0lucHV0L0lucHV0LnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCwgeyBmb3J3YXJkUmVmIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgZmxleGJveCwgbGF5b3V0LCB0eXBvZ3JhcGh5IH0gZnJvbSAnc3R5bGVkLXN5c3RlbSc7XG5pbXBvcnQgeyBJbnB1dCBhcyBUaGVtZVVJSW5wdXQgfSBmcm9tICd0aGVtZS11aSc7XG5cbmltcG9ydCB7IElucHV0UHJvcHMgfSBmcm9tICcuLi8uLi90eXBlcyc7XG4vKipcbiAqIEJhc2UgaW5wdXQgY29tcG9uZW50LlxuICpcbiAqIEFjY2VwdHMgcmVsZXZhbnQgc3R5bGluZyBwcm9w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cblxuSW5wdXQuZGlzcGxheU5hbWUgPSAnSW5wdXQnO1xuXG5leHBvcnQgZGVmYXVsdCBJbnB1dDtcbiJdfQ== */");
31
+ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
32
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
39
33
  var Input = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
40
34
  var name = props.name,
41
35
  placeholder = props.placeholder,
42
36
  maxLength = props.maxLength,
43
37
  others = (0, _objectWithoutProperties2["default"])(props, _excluded);
44
- return (0, _react2.jsx)(ExtendedInput, (0, _extends2["default"])({
38
+ return (0, _react2.jsx)(_themeUi.Input, (0, _extends2["default"])({
45
39
  ref: ref,
46
40
  name: name,
47
41
  placeholder: placeholder,
48
- maxLength: maxLength && maxLength
42
+ maxLength: (0, _isInteger["default"])(maxLength) && maxLength > 0 ? maxLength : undefined
49
43
  }, others));
50
44
  });
51
45
  Input.displayName = 'Input';
46
+ Input.propTypes = {
47
+ /** Defines a string value that labels the current element. */
48
+ 'aria-label': _propTypes["default"].string,
49
+ /** Id of input. */
50
+ id: _propTypes["default"].string,
51
+ /** Name of input. */
52
+ name: _propTypes["default"].string,
53
+ /** Max length of input value */
54
+ maxLength: _isValidPositiveInt["default"],
55
+ /** Type of input. Accepts most [HTML input types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types) */
56
+ type: _propTypes["default"].string,
57
+ /** Placeholder for the input */
58
+ placeholder: _propTypes["default"].string
59
+ };
52
60
  var _default = Input;
53
61
  exports["default"] = _default;
@@ -31,6 +31,7 @@ var defaultFocus = {
31
31
  outlineColor: 'accent.60',
32
32
  outlineOffset: '0px'
33
33
  };
34
+
34
35
  // Default input styling
35
36
  exports.defaultFocus = defaultFocus;
36
37
  var input = _objectSpread(_objectSpread({}, _Text.text.inputValue), {}, {
@@ -45,9 +45,17 @@ test('maxlength field with a set maxlength', function () {
45
45
  _userEvent["default"].type(input, 'banana');
46
46
  expect(input.value.length).toBe(3);
47
47
  });
48
- test('maxlength field is not set as undefined', function () {
48
+ test('maxlength field is not set as null', function () {
49
49
  getComponent({
50
- maxLength: undefined
50
+ maxLength: null
51
+ });
52
+ var input = _react2.screen.getByTestId(testId);
53
+ _userEvent["default"].type(input, 'banana');
54
+ expect(input.value.length).toBe(6);
55
+ });
56
+ test('maxlength field is not set as zero', function () {
57
+ getComponent({
58
+ maxLength: 0
51
59
  });
52
60
  var input = _react2.screen.getByTestId(testId);
53
61
  _userEvent["default"].type(input, 'banana');
@@ -8,7 +8,6 @@ export * from './fieldHelperText';
8
8
  export * from './icon';
9
9
  export * from './iconBadge';
10
10
  export * from './iconButton';
11
- export * from './input';
12
11
  export * from './item';
13
12
  export * from './link';
14
13
  export * from './listItem';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23;
3
+ var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22;
4
4
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
5
5
  var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
6
6
  var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
@@ -117,19 +117,8 @@ _forEachInstanceProperty(_context10 = _Object$keys(_iconButton)).call(_context10
117
117
  }
118
118
  });
119
119
  });
120
- var _input = require("./input");
121
- _forEachInstanceProperty(_context11 = _Object$keys(_input)).call(_context11, function (key) {
122
- if (key === "default" || key === "__esModule") return;
123
- if (key in exports && exports[key] === _input[key]) return;
124
- _Object$defineProperty(exports, key, {
125
- enumerable: true,
126
- get: function get() {
127
- return _input[key];
128
- }
129
- });
130
- });
131
120
  var _item = require("./item");
132
- _forEachInstanceProperty(_context12 = _Object$keys(_item)).call(_context12, function (key) {
121
+ _forEachInstanceProperty(_context11 = _Object$keys(_item)).call(_context11, function (key) {
133
122
  if (key === "default" || key === "__esModule") return;
134
123
  if (key in exports && exports[key] === _item[key]) return;
135
124
  _Object$defineProperty(exports, key, {
@@ -140,7 +129,7 @@ _forEachInstanceProperty(_context12 = _Object$keys(_item)).call(_context12, func
140
129
  });
141
130
  });
142
131
  var _link = require("./link");
143
- _forEachInstanceProperty(_context13 = _Object$keys(_link)).call(_context13, function (key) {
132
+ _forEachInstanceProperty(_context12 = _Object$keys(_link)).call(_context12, function (key) {
144
133
  if (key === "default" || key === "__esModule") return;
145
134
  if (key in exports && exports[key] === _link[key]) return;
146
135
  _Object$defineProperty(exports, key, {
@@ -151,7 +140,7 @@ _forEachInstanceProperty(_context13 = _Object$keys(_link)).call(_context13, func
151
140
  });
152
141
  });
153
142
  var _listItem = require("./listItem");
154
- _forEachInstanceProperty(_context14 = _Object$keys(_listItem)).call(_context14, function (key) {
143
+ _forEachInstanceProperty(_context13 = _Object$keys(_listItem)).call(_context13, function (key) {
155
144
  if (key === "default" || key === "__esModule") return;
156
145
  if (key in exports && exports[key] === _listItem[key]) return;
157
146
  _Object$defineProperty(exports, key, {
@@ -162,7 +151,7 @@ _forEachInstanceProperty(_context14 = _Object$keys(_listItem)).call(_context14,
162
151
  });
163
152
  });
164
153
  var _loader = require("./loader");
165
- _forEachInstanceProperty(_context15 = _Object$keys(_loader)).call(_context15, function (key) {
154
+ _forEachInstanceProperty(_context14 = _Object$keys(_loader)).call(_context14, function (key) {
166
155
  if (key === "default" || key === "__esModule") return;
167
156
  if (key in exports && exports[key] === _loader[key]) return;
168
157
  _Object$defineProperty(exports, key, {
@@ -173,7 +162,7 @@ _forEachInstanceProperty(_context15 = _Object$keys(_loader)).call(_context15, fu
173
162
  });
174
163
  });
175
164
  var _overlayPanel = require("./overlayPanel");
176
- _forEachInstanceProperty(_context16 = _Object$keys(_overlayPanel)).call(_context16, function (key) {
165
+ _forEachInstanceProperty(_context15 = _Object$keys(_overlayPanel)).call(_context15, function (key) {
177
166
  if (key === "default" || key === "__esModule") return;
178
167
  if (key in exports && exports[key] === _overlayPanel[key]) return;
179
168
  _Object$defineProperty(exports, key, {
@@ -184,7 +173,7 @@ _forEachInstanceProperty(_context16 = _Object$keys(_overlayPanel)).call(_context
184
173
  });
185
174
  });
186
175
  var _popoverContainer = require("./popoverContainer");
187
- _forEachInstanceProperty(_context17 = _Object$keys(_popoverContainer)).call(_context17, function (key) {
176
+ _forEachInstanceProperty(_context16 = _Object$keys(_popoverContainer)).call(_context16, function (key) {
188
177
  if (key === "default" || key === "__esModule") return;
189
178
  if (key in exports && exports[key] === _popoverContainer[key]) return;
190
179
  _Object$defineProperty(exports, key, {
@@ -195,7 +184,7 @@ _forEachInstanceProperty(_context17 = _Object$keys(_popoverContainer)).call(_con
195
184
  });
196
185
  });
197
186
  var _popoverMenu = require("./popoverMenu");
198
- _forEachInstanceProperty(_context18 = _Object$keys(_popoverMenu)).call(_context18, function (key) {
187
+ _forEachInstanceProperty(_context17 = _Object$keys(_popoverMenu)).call(_context17, function (key) {
199
188
  if (key === "default" || key === "__esModule") return;
200
189
  if (key in exports && exports[key] === _popoverMenu[key]) return;
201
190
  _Object$defineProperty(exports, key, {
@@ -206,7 +195,7 @@ _forEachInstanceProperty(_context18 = _Object$keys(_popoverMenu)).call(_context1
206
195
  });
207
196
  });
208
197
  var _separator = require("./separator");
209
- _forEachInstanceProperty(_context19 = _Object$keys(_separator)).call(_context19, function (key) {
198
+ _forEachInstanceProperty(_context18 = _Object$keys(_separator)).call(_context18, function (key) {
210
199
  if (key === "default" || key === "__esModule") return;
211
200
  if (key in exports && exports[key] === _separator[key]) return;
212
201
  _Object$defineProperty(exports, key, {
@@ -217,7 +206,7 @@ _forEachInstanceProperty(_context19 = _Object$keys(_separator)).call(_context19,
217
206
  });
218
207
  });
219
208
  var _shared = require("./shared");
220
- _forEachInstanceProperty(_context20 = _Object$keys(_shared)).call(_context20, function (key) {
209
+ _forEachInstanceProperty(_context19 = _Object$keys(_shared)).call(_context19, function (key) {
221
210
  if (key === "default" || key === "__esModule") return;
222
211
  if (key in exports && exports[key] === _shared[key]) return;
223
212
  _Object$defineProperty(exports, key, {
@@ -228,7 +217,7 @@ _forEachInstanceProperty(_context20 = _Object$keys(_shared)).call(_context20, fu
228
217
  });
229
218
  });
230
219
  var _table = require("./table");
231
- _forEachInstanceProperty(_context21 = _Object$keys(_table)).call(_context21, function (key) {
220
+ _forEachInstanceProperty(_context20 = _Object$keys(_table)).call(_context20, function (key) {
232
221
  if (key === "default" || key === "__esModule") return;
233
222
  if (key in exports && exports[key] === _table[key]) return;
234
223
  _Object$defineProperty(exports, key, {
@@ -239,7 +228,7 @@ _forEachInstanceProperty(_context21 = _Object$keys(_table)).call(_context21, fun
239
228
  });
240
229
  });
241
230
  var _text = require("./text");
242
- _forEachInstanceProperty(_context22 = _Object$keys(_text)).call(_context22, function (key) {
231
+ _forEachInstanceProperty(_context21 = _Object$keys(_text)).call(_context21, function (key) {
243
232
  if (key === "default" || key === "__esModule") return;
244
233
  if (key in exports && exports[key] === _text[key]) return;
245
234
  _Object$defineProperty(exports, key, {
@@ -250,7 +239,7 @@ _forEachInstanceProperty(_context22 = _Object$keys(_text)).call(_context22, func
250
239
  });
251
240
  });
252
241
  var _tooltipTrigger = require("./tooltipTrigger");
253
- _forEachInstanceProperty(_context23 = _Object$keys(_tooltipTrigger)).call(_context23, function (key) {
242
+ _forEachInstanceProperty(_context22 = _Object$keys(_tooltipTrigger)).call(_context22, function (key) {
254
243
  if (key === "default" || key === "__esModule") return;
255
244
  if (key in exports && exports[key] === _tooltipTrigger[key]) return;
256
245
  _Object$defineProperty(exports, key, {
@@ -3,4 +3,3 @@ export * from './events';
3
3
  export * from './orientation';
4
4
  export * from './style';
5
5
  export * from './utils';
6
- export * from './validPositiveInteger';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _context, _context2, _context3, _context4, _context5, _context6;
3
+ var _context, _context2, _context3, _context4, _context5;
4
4
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
5
5
  var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
6
6
  var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
@@ -61,15 +61,4 @@ _forEachInstanceProperty(_context5 = _Object$keys(_utils)).call(_context5, funct
61
61
  return _utils[key];
62
62
  }
63
63
  });
64
- });
65
- var _validPositiveInteger = require("./validPositiveInteger");
66
- _forEachInstanceProperty(_context6 = _Object$keys(_validPositiveInteger)).call(_context6, function (key) {
67
- if (key === "default" || key === "__esModule") return;
68
- if (key in exports && exports[key] === _validPositiveInteger[key]) return;
69
- _Object$defineProperty(exports, key, {
70
- enumerable: true,
71
- get: function get() {
72
- return _validPositiveInteger[key];
73
- }
74
- });
75
64
  });
@@ -1,11 +1,11 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
- import _styled from "@emotion/styled/base";
4
3
  var _excluded = ["name", "placeholder", "maxLength"];
4
+ import _Number$isInteger from "@babel/runtime-corejs3/core-js-stable/number/is-integer";
5
5
  import React, { forwardRef } from 'react';
6
- import { flexbox, layout, typography } from 'styled-system';
6
+ import PropTypes from 'prop-types';
7
7
  import { Input as ThemeUIInput } from 'theme-ui';
8
- import { jsx as ___EmotionJSX } from "@emotion/react";
8
+ import isValidPositiveInt from '../../utils/devUtils/props/isValidPositiveInt';
9
9
  /**
10
10
  * Base input component.
11
11
  *
@@ -16,24 +16,32 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
16
16
  * We instead encourage developers to utilize our Field components wherever possible.
17
17
  * If this component is used, accessibility is left to the developer.
18
18
  */
19
-
20
- var ExtendedInput = /*#__PURE__*/_styled(ThemeUIInput, process.env.NODE_ENV === "production" ? {
21
- target: "e1lpwkt50"
22
- } : {
23
- target: "e1lpwkt50",
24
- label: "ExtendedInput"
25
- })(layout, flexbox, typography, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0lucHV0L0lucHV0LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFpQnNCIiwiZmlsZSI6Ii4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0lucHV0L0lucHV0LnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCwgeyBmb3J3YXJkUmVmIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgZmxleGJveCwgbGF5b3V0LCB0eXBvZ3JhcGh5IH0gZnJvbSAnc3R5bGVkLXN5c3RlbSc7XG5pbXBvcnQgeyBJbnB1dCBhcyBUaGVtZVVJSW5wdXQgfSBmcm9tICd0aGVtZS11aSc7XG5cbmlt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ICAgICBwbGFjZWhvbGRlcj17cGxhY2Vob2xkZXJ9XG4gICAgICBtYXhMZW5ndGg9e21heExlbmd0aCAmJiBtYXhMZW5ndGh9XG4gICAgICB7Li4ub3RoZXJzfVxuICAgIC8+XG4gICk7XG59KTtcblxuSW5wdXQuZGlzcGxheU5hbWUgPSAnSW5wdXQnO1xuXG5leHBvcnQgZGVmYXVsdCBJbnB1dDtcbiJdfQ== */");
19
+ import { jsx as ___EmotionJSX } from "@emotion/react";
26
20
  var Input = /*#__PURE__*/forwardRef(function (props, ref) {
27
21
  var name = props.name,
28
22
  placeholder = props.placeholder,
29
23
  maxLength = props.maxLength,
30
24
  others = _objectWithoutProperties(props, _excluded);
31
- return ___EmotionJSX(ExtendedInput, _extends({
25
+ return ___EmotionJSX(ThemeUIInput, _extends({
32
26
  ref: ref,
33
27
  name: name,
34
28
  placeholder: placeholder,
35
- maxLength: maxLength && maxLength
29
+ maxLength: _Number$isInteger(maxLength) && maxLength > 0 ? maxLength : undefined
36
30
  }, others));
37
31
  });
38
32
  Input.displayName = 'Input';
33
+ Input.propTypes = {
34
+ /** Defines a string value that labels the current element. */
35
+ 'aria-label': PropTypes.string,
36
+ /** Id of input. */
37
+ id: PropTypes.string,
38
+ /** Name of input. */
39
+ name: PropTypes.string,
40
+ /** Max length of input value */
41
+ maxLength: isValidPositiveInt,
42
+ /** Type of input. Accepts most [HTML input types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types) */
43
+ type: PropTypes.string,
44
+ /** Placeholder for the input */
45
+ placeholder: PropTypes.string
46
+ };
39
47
  export default Input;
@@ -25,6 +25,7 @@ export var defaultFocus = {
25
25
  outlineColor: 'accent.60',
26
26
  outlineOffset: '0px'
27
27
  };
28
+
28
29
  // Default input styling
29
30
  export var input = _objectSpread(_objectSpread({}, text.inputValue), {}, {
30
31
  appearance: 'none',
@@ -42,9 +42,17 @@ test('maxlength field with a set maxlength', function () {
42
42
  userEvent.type(input, 'banana');
43
43
  expect(input.value.length).toBe(3);
44
44
  });
45
- test('maxlength field is not set as undefined', function () {
45
+ test('maxlength field is not set as null', function () {
46
46
  getComponent({
47
- maxLength: undefined
47
+ maxLength: null
48
+ });
49
+ var input = screen.getByTestId(testId);
50
+ userEvent.type(input, 'banana');
51
+ expect(input.value.length).toBe(6);
52
+ });
53
+ test('maxlength field is not set as zero', function () {
54
+ getComponent({
55
+ maxLength: 0
48
56
  });
49
57
  var input = screen.getByTestId(testId);
50
58
  userEvent.type(input, 'banana');
@@ -8,7 +8,6 @@ export * from './fieldHelperText';
8
8
  export * from './icon';
9
9
  export * from './iconBadge';
10
10
  export * from './iconButton';
11
- export * from './input';
12
11
  export * from './item';
13
12
  export * from './link';
14
13
  export * from './listItem';
@@ -2,5 +2,4 @@ export * from './dom';
2
2
  export * from './events';
3
3
  export * from './orientation';
4
4
  export * from './style';
5
- export * from './utils';
6
- export * from './validPositiveInteger';
5
+ export * from './utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.46.0-alpha.1",
3
+ "version": "2.46.0-alpha.2",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { InputProps } from '../../types';
3
- declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
4
- export default Input;
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { StoryFn } from '@storybook/react';
3
- import { InputProps } from '../../types';
4
- declare const _default: {
5
- title: string;
6
- component: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
7
- argTypes: {
8
- placeholder: {};
9
- type: {};
10
- name: {};
11
- id: {};
12
- };
13
- args: {
14
- placeholder: string;
15
- };
16
- };
17
- export default _default;
18
- export declare const Default: StoryFn<InputProps>;
19
- export declare const Password: StoryFn;
20
- export declare const LargeInput: StoryFn;
@@ -1,8 +0,0 @@
1
- import { ThemeUICSSObject } from 'theme-ui';
2
- export declare const defaultFocus: {
3
- borderColor: string;
4
- outline: string;
5
- outlineColor: string;
6
- outlineOffset: string;
7
- };
8
- export declare const input: ThemeUICSSObject;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { default } from './Input';
@@ -1,18 +0,0 @@
1
- import { TestingAttributes } from './shared/test';
2
- import { DOMAttributes, StyleProps, ValidPositiveInteger } from './shared';
3
- export interface InputProps extends StyleProps, DOMAttributes, TestingAttributes {
4
- /** Defines a string value that labels the current element. */
5
- 'aria-label'?: string;
6
- /** Id of input. */
7
- id?: string;
8
- /** Name of input. */
9
- name?: string;
10
- /** Max length of input value */
11
- maxLength?: ValidPositiveInteger;
12
- /** Type of input. Accepts most [HTML input types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types) */
13
- type?: string;
14
- /** Placeholder for the input */
15
- placeholder?: string;
16
- /** Styling variant for the input */
17
- variant?: string;
18
- }
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
- _Object$defineProperty(exports, "__esModule", {
5
- value: true
6
- });
@@ -1,4 +0,0 @@
1
- type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
2
- type Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
3
- export type ValidPositiveInteger = Range<1, 999>;
4
- export {};
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
- _Object$defineProperty(exports, "__esModule", {
5
- value: true
6
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};