@decisiv/ui-components 2.0.1-alpha.176 → 2.0.1-alpha.178

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAmB,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAQvE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAA2B,MAAM,SAAS,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AAsDhC,QAAA,MAAM,YAAY,EAAE,sBAAsB,CAAC,QAAQ,EAAE,UAAU,CAE9D,CAAC;AAQF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAmB,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAA2B,MAAM,SAAS,CAAC;AAIxE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AAWhC,QAAA,MAAM,YAAY,EAAE,sBAAsB,CAAC,QAAQ,EAAE,UAAU,CAE9D,CAAC;AAQF,eAAe,YAAY,CAAC"}
@@ -19,21 +19,9 @@ exports.default = void 0;
19
19
 
20
20
  var _react = _interopRequireWildcard(require("react"));
21
21
 
22
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
-
24
- var _styledComponentsModifiers = require("styled-components-modifiers");
25
-
26
- var _color = _interopRequireDefault(require("../../modifiers/color"));
27
-
28
- var _constants = require("./constants");
29
-
30
- var _commonUIColors = require("../../utils/commonUIColors");
31
-
32
- var _utils = require("../../utils");
33
-
34
22
  var _types = require("./types");
35
23
 
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
+ var _styles = require("./styles");
37
25
 
38
26
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
39
27
 
@@ -43,57 +31,13 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
43
31
 
44
32
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
45
33
 
46
- var colorModifiers = (0, _utils.applyDynamicModifiers)('color', function (_ref) {
47
- var color = _ref.color;
48
- return (0, _styledComponents.css)(["", ""], color && color in _commonUIColors.commonUIColors && (0, _color.default)(_commonUIColors.commonUIColors[color]));
49
- });
50
-
51
- var getSizeStyles = function getSizeStyles(key) {
52
- return (0, _styledComponents.css)(_constants.sizeStyles[key] || '');
53
- };
54
-
55
- var sizeModifiers = (0, _styledComponentsModifiers.applyStyleModifiers)({
56
- small: function small(_ref2) {
57
- var v = _ref2.variant;
58
- return getSizeStyles("small.".concat(v));
59
- },
60
- medium: function medium(_ref3) {
61
- var v = _ref3.variant;
62
- return getSizeStyles("medium.".concat(v));
63
- },
64
- large: function large(_ref4) {
65
- var v = _ref4.variant;
66
- return getSizeStyles("large.".concat(v));
67
- }
68
- }, 'size');
69
- var variantModifiers = (0, _styledComponentsModifiers.applyStyleModifiers)({
70
- round: function round() {
71
- return (0, _styledComponents.css)({
72
- borderRadius: '50%'
73
- });
74
- },
75
- square: function square() {
76
- return (0, _styledComponents.css)({
77
- borderRadius: '2px'
78
- });
79
- }
80
- }, 'variant'); // The default coloring is explicitly set instead of relying on the
81
- // `visualInterest.licoriceMousse.medium` colors. The "default" badge is
82
- // intended to be used in “empty” and/or “no results” messages, the snowWhite
83
- // fg color and lower contrast help convey “emptiness”.
84
-
85
- var BadgeContainer = _styledComponents.default.div.withConfig({
86
- displayName: "Badge__BadgeContainer",
87
- componentId: "sc-1y6oxgp-0"
88
- })(["align-items:center;display:inline-flex;justify-content:center;", ";", ";", ";", ";"], (0, _color.default)(_commonUIColors.commonUIColors.information), colorModifiers, sizeModifiers, variantModifiers);
89
-
90
34
  function Badge(props, containerRef) {
91
35
  var ariaLabel = props['aria-label'],
92
36
  Icon = props.icon,
93
37
  size = props.size,
94
38
  rest = _objectWithoutProperties(props, ["aria-label", "icon", "size"]);
95
39
 
96
- return _react.default.createElement(BadgeContainer, _extends({
40
+ return _react.default.createElement(_styles.BadgeContainer, _extends({
97
41
  ref: containerRef,
98
42
  size: size
99
43
  }, rest), _react.default.createElement(Icon, {
@@ -55,12 +55,23 @@ describe('Badge', function () {
55
55
  expect(container).toMatchSnapshot();
56
56
  });
57
57
  });
58
+ ['bright', 'pastel'].forEach(function (palette) {
59
+ it("renders correctly with palette=\"".concat(palette, "\""), function () {
60
+ var _renderBadge3 = renderBadge({
61
+ palette: palette,
62
+ color: 'carrotCake'
63
+ }),
64
+ container = _renderBadge3.container;
65
+
66
+ expect(container).toMatchSnapshot();
67
+ });
68
+ });
58
69
  it("renders correctly with size=\"small\" and variant=\"square\"", function () {
59
- var _renderBadge3 = renderBadge({
70
+ var _renderBadge4 = renderBadge({
60
71
  size: 'small',
61
72
  variant: 'square'
62
73
  }),
63
- container = _renderBadge3.container;
74
+ container = _renderBadge4.container;
64
75
 
65
76
  expect(container).toMatchSnapshot();
66
77
  });
@@ -70,10 +81,10 @@ describe('Badge', function () {
70
81
  key = _ref2[0],
71
82
  value = _ref2[1];
72
83
 
73
- var _renderBadge4 = renderBadge({
84
+ var _renderBadge5 = renderBadge({
74
85
  color: key
75
86
  }),
76
- container = _renderBadge4.container;
87
+ container = _renderBadge5.container;
77
88
 
78
89
  expect(container.firstChild).toHaveStyleRule('background-color', (0, _toColorString.default)(value));
79
90
  });
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAAqC,CAAC;AAwBlD,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAAqC,CAAC;AA4BlD,eAAe,MAAM,CAAC"}
@@ -15,6 +15,7 @@ schema.propTypes = {
15
15
  'aria-label': _reactDesc.PropTypes.string.description('Descriptive text for accessibility purposes').isRequired,
16
16
  color: _reactDesc.PropTypes.string.description('(See note) Sets the color for the background and the icon').defaultValue('information'),
17
17
  icon: _reactDesc.PropTypes.element.description('Must be an icon component from `@decisiv/iconix`').isRequired,
18
+ palette: _reactDesc.PropTypes.oneOf(['bright', 'pastel']).description('What color variant to render').defaultValue('bright'),
18
19
  size: _reactDesc.PropTypes.oneOf(['small', 'medium', 'large']).description('(See note) Sets the size of the badge').defaultValue('medium'),
19
20
  variant: _reactDesc.PropTypes.oneOf(['round', 'square']).description('(See note) Controls primary style variations of the badge').defaultValue('round')
20
21
  };
@@ -0,0 +1,3 @@
1
+ import { BadgeProps } from './types';
2
+ export declare const BadgeContainer: import("styled-components").StyledComponent<"div", any, Pick<BadgeProps, "variant" | "size" | "color" | "palette">, never>;
3
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/styles.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AA+DrC,eAAO,MAAM,cAAc,4HAQ1B,CAAC"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BadgeContainer = void 0;
7
+
8
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
+
10
+ var _styledComponentsModifiers = require("styled-components-modifiers");
11
+
12
+ var _designTokens = require("@decisiv/design-tokens");
13
+
14
+ var _color = _interopRequireDefault(require("../../modifiers/color"));
15
+
16
+ var _constants = require("./constants");
17
+
18
+ var _commonUIColors = require("../../utils/commonUIColors");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
23
+
24
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
25
+
26
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
27
+
28
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
29
+
30
+ var FG_COLOR = {
31
+ pastel: 'dark'
32
+ };
33
+ var PALETTE_MAPPER = {
34
+ pastel: 'light',
35
+ bright: 'medium'
36
+ };
37
+
38
+ var colorModifiers = function colorModifiers(props) {
39
+ var _props$palette = props.palette,
40
+ palette = _props$palette === void 0 ? 'bright' : _props$palette,
41
+ color = props.color;
42
+
43
+ if (color && color in _commonUIColors.commonUIColors) {
44
+ var baseColor = _commonUIColors.commonUIThreeShadeColors[color];
45
+ var fgColor = palette === 'bright' ? _designTokens.color.base.snowWhite : baseColor[FG_COLOR[palette]];
46
+ var bgColor = baseColor[PALETTE_MAPPER[palette]];
47
+ var colorPalette = palette === 'bright' ? bgColor : _objectSpread({}, bgColor, {
48
+ fg: fgColor
49
+ });
50
+ return (0, _styledComponents.css)(["", ""], (0, _color.default)(colorPalette));
51
+ }
52
+
53
+ return null;
54
+ };
55
+
56
+ var getSizeStyles = function getSizeStyles(key) {
57
+ return (0, _styledComponents.css)(_constants.sizeStyles[key] || '');
58
+ };
59
+
60
+ var sizeModifiers = (0, _styledComponentsModifiers.applyStyleModifiers)({
61
+ small: function small(_ref) {
62
+ var v = _ref.variant;
63
+ return getSizeStyles("small.".concat(v));
64
+ },
65
+ medium: function medium(_ref2) {
66
+ var v = _ref2.variant;
67
+ return getSizeStyles("medium.".concat(v));
68
+ },
69
+ large: function large(_ref3) {
70
+ var v = _ref3.variant;
71
+ return getSizeStyles("large.".concat(v));
72
+ }
73
+ }, 'size');
74
+ var variantModifiers = (0, _styledComponentsModifiers.applyStyleModifiers)({
75
+ round: function round() {
76
+ return (0, _styledComponents.css)({
77
+ borderRadius: '50%'
78
+ });
79
+ },
80
+ square: function square() {
81
+ return (0, _styledComponents.css)({
82
+ borderRadius: '2px'
83
+ });
84
+ }
85
+ }, 'variant'); // The default coloring is explicitly set instead of relying on the
86
+ // `visualInterest.licoriceMousse.medium` colors. The "default" badge is
87
+ // intended to be used in “empty” and/or “no results” messages, the snowWhite
88
+ // fg color and lower contrast help convey “emptiness”.
89
+ // eslint-disable-next-line import/prefer-default-export
90
+
91
+ var BadgeContainer = _styledComponents.default.div.withConfig({
92
+ displayName: "styles__BadgeContainer",
93
+ componentId: "sc-1lruwqa-0"
94
+ })(["align-items:center;display:inline-flex;justify-content:center;", ";", ";", ";"], colorModifiers, sizeModifiers, variantModifiers);
95
+
96
+ exports.BadgeContainer = BadgeContainer;
@@ -8,6 +8,7 @@ export interface BadgeProps {
8
8
  'aria-label': string;
9
9
  color?: CommonUIColorKeys;
10
10
  icon: IconComponent;
11
+ palette?: 'pastel' | 'bright';
11
12
  size?: 'small' | 'medium' | 'large';
12
13
  variant?: 'round' | 'square';
13
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/types.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EACL,iBAAiB,EAElB,MAAM,4BAA4B,CAAC;AAIpC,aAAK,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,GAAG,CAAC,OAAO,CAAC;AAEvD,oBAAY,QAAQ,GAAG,cAAc,CAAC;AAItC,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC9B;AAED,iBAAS,gBAAgB,CACvB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,SAAS,EACnB,aAAa,EAAE,OAAO,GACrB,KAAK,GAAG,IAAI,CAqBd;AAED,eAAO,MAAM,SAAS;;;;;CAKrB,CAAC;AAEF,eAAO,MAAM,YAAY;;;CAGxB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/types.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EACL,iBAAiB,EAElB,MAAM,4BAA4B,CAAC;AAIpC,aAAK,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,GAAG,CAAC,OAAO,CAAC;AAEvD,oBAAY,QAAQ,GAAG,cAAc,CAAC;AAItC,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC9B;AAED,iBAAS,gBAAgB,CACvB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,SAAS,EACnB,aAAa,EAAE,OAAO,GACrB,KAAK,GAAG,IAAI,CAqBd;AAED,eAAO,MAAM,SAAS;;;;;CAKrB,CAAC;AAEF,eAAO,MAAM,YAAY;;;CAGxB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { SearchInputProps, SearchItem, StyledFlexProps } from './types';
3
- declare function SearchInput({ onSearch, value, onChange, size, disabled, searchOn, ...props }: SearchInputProps): JSX.Element;
3
+ declare function SearchInput({ onSearch, value, onChange, size, disabled, searchDisabled, searchOn, ...props }: SearchInputProps): JSX.Element;
4
4
  declare namespace SearchInput {
5
5
  var defaultProps: {
6
6
  size: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SearchInput/index.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkExE,iBAAwB,WAAW,CAAC,EAClC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CA0GhC;kBAlHuB,WAAW;;;;;eAAX,WAAW;AAwHnC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SearchInput/index.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkExE,iBAAwB,WAAW,CAAC,EAClC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CA0GhC;kBAnHuB,WAAW;;;;;eAAX,WAAW;AAyHnC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC"}
@@ -116,14 +116,15 @@ function SearchInput(_ref7) {
116
116
  onChange = _ref7.onChange,
117
117
  size = _ref7.size,
118
118
  disabled = _ref7.disabled,
119
+ searchDisabled = _ref7.searchDisabled,
119
120
  _ref7$searchOn = _ref7.searchOn,
120
121
  searchOn = _ref7$searchOn === void 0 ? 'submit' : _ref7$searchOn,
121
- props = _objectWithoutProperties(_ref7, ["onSearch", "value", "onChange", "size", "disabled", "searchOn"]);
122
+ props = _objectWithoutProperties(_ref7, ["onSearch", "value", "onChange", "size", "disabled", "searchDisabled", "searchOn"]);
122
123
 
123
124
  var translate = (0, _useTranslations.default)();
124
125
  var handleSearch = (0, _react.useCallback)(function () {
125
- !disabled && onSearch && onSearch(value);
126
- }, [disabled, onSearch, value]);
126
+ !disabled && !searchDisabled && onSearch && onSearch(value);
127
+ }, [disabled, searchDisabled, onSearch, value]);
127
128
  var mediumSized = size === 'medium';
128
129
  var hasText = !!value && !!value.length;
129
130
  var handleClear = (0, _react.useCallback)(function () {
@@ -176,7 +177,7 @@ function SearchInput(_ref7) {
176
177
  }, translate(undefined, 'searchInput.clear')), searchOn === 'submit' && _react.default.createElement(_Button.default, {
177
178
  "aria-label": "Search",
178
179
  tabIndex: 0,
179
- disabled: disabled || !hasText,
180
+ disabled: disabled || searchDisabled || !hasText,
180
181
  text: mediumSized ? translate(undefined, 'searchInput.search') : '',
181
182
  icon: mediumSized ? undefined : _Search.default,
182
183
  size: size,
@@ -345,6 +345,66 @@ describe('Search input', function () {
345
345
  }
346
346
  }, _callee11);
347
347
  })));
348
+ it('renders only the search button as disabled when searchDisabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
349
+ var container, input, button;
350
+ return regeneratorRuntime.wrap(function _callee12$(_context12) {
351
+ while (1) {
352
+ switch (_context12.prev = _context12.next) {
353
+ case 0:
354
+ container = render(_react.default.createElement(_.default, {
355
+ value: "some value",
356
+ searchDisabled: true
357
+ }));
358
+ input = container.getByRole('textbox');
359
+ button = container.getByRole('button');
360
+ expect(button).toBeDisabled();
361
+ expect(input).toBeEnabled();
362
+
363
+ case 5:
364
+ case "end":
365
+ return _context12.stop();
366
+ }
367
+ }
368
+ }, _callee12);
369
+ })));
370
+ it('does not calls search callback when searchDisabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13() {
371
+ var container, searchInput;
372
+ return regeneratorRuntime.wrap(function _callee13$(_context13) {
373
+ while (1) {
374
+ switch (_context13.prev = _context13.next) {
375
+ case 0:
376
+ container = render(_react.default.createElement(_.default, {
377
+ searchDisabled: true,
378
+ value: "Searched value",
379
+ onChange: onChangeMock,
380
+ onSearch: onSearchMock,
381
+ size: "medium"
382
+ }));
383
+ _context13.next = 3;
384
+ return container.findByTestId('search-container');
385
+
386
+ case 3:
387
+ _context13.next = 5;
388
+ return _context13.sent.querySelector('input');
389
+
390
+ case 5:
391
+ searchInput = _context13.sent;
392
+
393
+ _react2.fireEvent.keyPress(searchInput, {
394
+ code: 'Enter',
395
+ key: 'Enter',
396
+ charCode: 13
397
+ });
398
+
399
+ expect(onSearchMock).not.toHaveBeenCalled();
400
+
401
+ case 8:
402
+ case "end":
403
+ return _context13.stop();
404
+ }
405
+ }
406
+ }, _callee13);
407
+ })));
348
408
  describe('when using the searchOn `change`', function () {
349
409
  var searchOn = 'change';
350
410
  it('renders the search icon when size is "small"', function () {
@@ -376,11 +436,11 @@ describe('Search input', function () {
376
436
 
377
437
  expect(queryByRole('button')).not.toBeInTheDocument();
378
438
  });
379
- it('triggers the onSearch function when changing the value of the component', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
439
+ it('triggers the onSearch function when changing the value of the component', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14() {
380
440
  var container, searchInput;
381
- return regeneratorRuntime.wrap(function _callee12$(_context12) {
441
+ return regeneratorRuntime.wrap(function _callee14$(_context14) {
382
442
  while (1) {
383
- switch (_context12.prev = _context12.next) {
443
+ switch (_context14.prev = _context14.next) {
384
444
  case 0:
385
445
  container = render(_react.default.createElement(_.default, {
386
446
  searchOn: searchOn,
@@ -388,15 +448,15 @@ describe('Search input', function () {
388
448
  onChange: onChangeMock,
389
449
  onSearch: onSearchMock
390
450
  }));
391
- _context12.next = 3;
451
+ _context14.next = 3;
392
452
  return container.findByTestId('search-container');
393
453
 
394
454
  case 3:
395
- _context12.next = 5;
396
- return _context12.sent.querySelector('input');
455
+ _context14.next = 5;
456
+ return _context14.sent.querySelector('input');
397
457
 
398
458
  case 5:
399
- searchInput = _context12.sent;
459
+ searchInput = _context14.sent;
400
460
 
401
461
  _react2.fireEvent.change(searchInput, {
402
462
  target: {
@@ -408,10 +468,10 @@ describe('Search input', function () {
408
468
 
409
469
  case 8:
410
470
  case "end":
411
- return _context12.stop();
471
+ return _context14.stop();
412
472
  }
413
473
  }
414
- }, _callee12);
474
+ }, _callee14);
415
475
  })));
416
476
  });
417
477
  });
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/SearchInput/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAA2C,CAAC;AAkCxD,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/SearchInput/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAA2C,CAAC;AAsCxD,eAAe,MAAM,CAAC"}
@@ -16,6 +16,7 @@ schema.propTypes = {
16
16
  debounceTimeout: _reactDesc.PropTypes.number.description('The amount of ms to wait until onSearch is called after the user has typed in the search input').defaultValue('500'),
17
17
  size: _reactDesc.PropTypes.oneOf(['medium', 'small']).description('Controls the size of the search input.').defaultValue('medium'),
18
18
  disabled: _reactDesc.PropTypes.bool.description('Boolean indicating whether the search input is disabled.'),
19
+ searchDisabled: _reactDesc.PropTypes.bool.description('Boolean indicating whether only the search button is disabled.'),
19
20
  value: _reactDesc.PropTypes.string.description('A text value to be displayed on the input field'),
20
21
  onSearch: _reactDesc.PropTypes.func.description('A callback that is invoked with the input value when the the search action is performed'),
21
22
  onChange: _reactDesc.PropTypes.func.description('A callback that is invoked when the value of the search field changes')
@@ -9,6 +9,7 @@ export declare type Size = 'medium' | 'small';
9
9
  export declare type SearchOn = 'submit' | 'change';
10
10
  export interface SearchInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'label'>, Omit<BaseInputFieldProps, 'children' | 'onClick' | 'label'> {
11
11
  zIndex?: number;
12
+ searchDisabled?: boolean;
12
13
  searchOn?: SearchOn;
13
14
  onSearch?: (value: string) => void;
14
15
  onSelectItem?: (value: any) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/SearchInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,C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MAAM,WAAW,eAAgB,SAAQ,kBAAkB;IACzD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decisiv/ui-components",
3
- "version": "2.0.1-alpha.176+0ca8bda",
3
+ "version": "2.0.1-alpha.178+7978735",
4
4
  "description": "Decisiv's design system React components",
5
5
  "author": "Decisiv UI Development Team",
6
6
  "license": "MIT",
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@decisiv/breakpoint-observer": "^1.8.8",
19
- "@decisiv/design-tokens": "^1.8.9-alpha.294+0ca8bda",
20
- "@decisiv/iconix": "^2.0.1-alpha.176+0ca8bda",
19
+ "@decisiv/design-tokens": "^1.8.8",
20
+ "@decisiv/iconix": "^2.0.0",
21
21
  "@decisiv/prop-types": "^1.6.9",
22
22
  "@seznam/compose-react-refs": "^1.0.2",
23
23
  "csstype": "^2.6.5",
@@ -71,5 +71,5 @@
71
71
  "access": "public"
72
72
  },
73
73
  "private": false,
74
- "gitHead": "0ca8bda2fe88c901881b6fb2262f99c143da7075"
74
+ "gitHead": "797873560822df50197eb9218de314ad7ad5d4f3"
75
75
  }