@synerise/ds-autocomplete 0.4.50 → 0.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,31 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.5.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-autocomplete@0.5.0...@synerise/ds-autocomplete@0.5.1) (2023-09-19)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-autocomplete
9
+
10
+
11
+
12
+
13
+
14
+ # [0.5.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-autocomplete@0.4.50...@synerise/ds-autocomplete@0.5.0) (2023-09-18)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **input:** deps missing in autocomplete + input exports ([4a1439b](https://github.com/Synerise/synerise-design/commit/4a1439b70856f24b1c4500c97956c7ff8b97468a))
20
+ * **input:** fixed autosize imports/exports ([4fbebfa](https://github.com/Synerise/synerise-design/commit/4fbebfa9b5c13dc92b81cf1e6ee3639f54d3145b))
21
+
22
+
23
+ ### Features
24
+
25
+ * **input:** autosize input, filter ([c507a67](https://github.com/Synerise/synerise-design/commit/c507a672b2705da82e8bebe589495caf5d509e71))
26
+
27
+
28
+
29
+
30
+
6
31
  ## [0.4.50](https://github.com/Synerise/synerise-design/compare/@synerise/ds-autocomplete@0.4.49...@synerise/ds-autocomplete@0.4.50) (2023-09-08)
7
32
 
8
33
  **Note:** Version bump only for package @synerise/ds-autocomplete
@@ -1,6 +1,9 @@
1
- import * as React from 'react';
1
+ /// <reference types="react" />
2
2
  import '@synerise/ds-core/dist/js/style';
3
3
  import './style/index.less';
4
- import { AutocompleteProps, StaticComponents } from './Autocomplete.types';
5
- declare const Autocomplete: React.FC<AutocompleteProps> & StaticComponents;
4
+ import { AutocompleteProps } from './Autocomplete.types';
5
+ declare const Autocomplete: {
6
+ (props: AutocompleteProps): JSX.Element;
7
+ Option: import("rc-select/lib/Option").OptionFC;
8
+ };
6
9
  export default Autocomplete;
@@ -1,17 +1,11 @@
1
- var _excluded = ["className", "label", "description", "errorText", "disabled", "error", "handleInputRef", "autoResize"];
2
-
3
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
2
 
5
- 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; }
6
-
7
- import * as React from 'react';
3
+ import React, { useRef, useEffect } from 'react';
8
4
  import '@synerise/ds-core/dist/js/style';
9
5
  import "./style/index.css";
10
6
  import AntdAutoComplete from 'antd/lib/auto-complete';
11
7
  import { ErrorText, Description, Label } from '@synerise/ds-typography';
12
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
13
- // @ts-ignore
14
- import { AutoResize, WrapperAutoResize } from '@synerise/ds-input';
8
+ import { AutosizeInput } from '@synerise/ds-input';
15
9
  import * as S from './Autocomplete.styles';
16
10
 
17
11
  var Autocomplete = function Autocomplete(props) {
@@ -22,11 +16,9 @@ var Autocomplete = function Autocomplete(props) {
22
16
  disabled = props.disabled,
23
17
  error = props.error,
24
18
  handleInputRef = props.handleInputRef,
25
- autoResize = props.autoResize,
26
- antdAutocompleteProps = _objectWithoutPropertiesLoose(props, _excluded);
27
-
28
- var inputRef = React.useRef(undefined);
29
- React.useEffect(function () {
19
+ autoResize = props.autoResize;
20
+ var inputRef = useRef(undefined);
21
+ useEffect(function () {
30
22
  handleInputRef && handleInputRef(inputRef);
31
23
  }, [inputRef, handleInputRef]);
32
24
 
@@ -35,13 +27,23 @@ var Autocomplete = function Autocomplete(props) {
35
27
  };
36
28
 
37
29
  var renderAutoCompleteComponent = function renderAutoCompleteComponent() {
38
- return /*#__PURE__*/React.createElement(AntdAutoComplete // eslint-disable-next-line react/jsx-props-no-spreading
39
- , _extends({}, props, {
30
+ var Component = autoResize ? AutosizeInput : AntdAutoComplete;
31
+ var autosizeProps = autoResize ? {
32
+ transformRef: function transformRef(el) {
33
+ return el.querySelector('input');
34
+ },
35
+ refPropName: 'inputRef',
36
+ extraWidth: 24
37
+ } : {};
38
+ return /*#__PURE__*/React.createElement(Component, _extends({}, autoResize ? {
39
+ renderInput: AntdAutoComplete,
40
+ autoResize: autoResize,
41
+ autosizeProps: autosizeProps
42
+ } : {}, props, {
40
43
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
41
44
  // @ts-ignore
42
45
  ref: inputRef,
43
46
  dropdownClassName: "ds-autocomplete-dropdown ps__child--consume",
44
- className: !!errorText || error ? 'error' : undefined,
45
47
  getPopupContainer: getParentNode
46
48
  }));
47
49
  };
@@ -49,11 +51,9 @@ var Autocomplete = function Autocomplete(props) {
49
51
  return /*#__PURE__*/React.createElement(S.AutocompleteWrapper, {
50
52
  autoResize: autoResize,
51
53
  className: "ds-autocomplete " + (className || '')
52
- }, label && /*#__PURE__*/React.createElement(S.LabelWrapper, null, /*#__PURE__*/React.createElement(Label, null, label)), autoResize ? /*#__PURE__*/React.createElement(WrapperAutoResize, {
53
- autoResize: autoResize
54
- }, renderAutoCompleteComponent(), /*#__PURE__*/React.createElement(AutoResize, {
55
- autoResize: autoResize
56
- }, antdAutocompleteProps.value)) : renderAutoCompleteComponent(), errorText && /*#__PURE__*/React.createElement(S.ErrorWrapper, null, /*#__PURE__*/React.createElement(ErrorText, null, errorText)), description && /*#__PURE__*/React.createElement(S.DescWrapper, null, description && /*#__PURE__*/React.createElement(Description, {
54
+ }, label && /*#__PURE__*/React.createElement(S.LabelWrapper, null, /*#__PURE__*/React.createElement(Label, null, label)), /*#__PURE__*/React.createElement(S.ComponentWrapper, {
55
+ error: !!errorText || error
56
+ }, renderAutoCompleteComponent()), errorText && /*#__PURE__*/React.createElement(S.ErrorWrapper, null, /*#__PURE__*/React.createElement(ErrorText, null, errorText)), description && /*#__PURE__*/React.createElement(S.DescWrapper, null, description && /*#__PURE__*/React.createElement(Description, {
57
57
  disabled: disabled
58
58
  }, description)));
59
59
  };
@@ -14,3 +14,6 @@ export declare const AutocompleteWrapper: import("styled-components").StyledComp
14
14
  maxWidth: string;
15
15
  } | undefined;
16
16
  }, never>;
17
+ export declare const ComponentWrapper: import("styled-components").StyledComponent<"div", any, {
18
+ error?: boolean | undefined;
19
+ }, never>;
@@ -50,12 +50,22 @@ function autoresizeConfObjToCss(_ref) {
50
50
  export var AutocompleteWrapper = styled.div.withConfig({
51
51
  displayName: "Autocompletestyles__AutocompleteWrapper",
52
52
  componentId: "sc-10de6ms-4"
53
- })([".ant-select-auto-complete{width:", ";", ";grid-area:1 / 1;}.ant-select > span{position:absolute;left:0;top:0;}.ant-select-dropdown{&.ant-select{.ant-input{transition:ease-in-out all 0.3s;&:focus{", " &:hover{", "}}}}&.error{.ant-select-selector{&:hover{", "}", "}}.ant-select-selection__rendered{margin:0;}.ant-select-selection:hover .ant-select-selection__rendered{margin-right:10px;}&.ant-select .ant-input{padding:8px 12px;}.ant-select-selection__clear{font-size:15px;color:", ";width:16px;height:16px;margin-top:-7px;}&.ant-select:not(.ant-select-no-arrow) .ant-select-selection__clear{right:12px;&:hover{color:", ";}}.ant-select-selection-placeholder{padding-left:3px;}.ant-select-dropdown{padding:8px;}.ant-select-dropdown-menu-item{font-weight:normal;strong{font-weight:500;}}}.ant-select-selection-search-input{padding:0;}"], function (props) {
53
+ })([".ant-select-auto-complete{width:", ";", ";grid-area:1 / 1;}.ant-select > span{position:absolute;left:0;top:0;}.ant-select-dropdown{.ant-select-selection__rendered{margin:0;}.ant-select-selection:hover .ant-select-selection__rendered{margin-right:10px;}.ant-select-selection__clear{font-size:15px;color:", ";width:16px;height:16px;margin-top:-7px;}&.ant-select:not(.ant-select-no-arrow) .ant-select-selection__clear{right:12px;&:hover{color:", ";}}.ant-select-dropdown-menu-item{font-weight:normal;strong{font-weight:500;}}}.ant-select-selection-search-input{padding:0;}"], function (props) {
54
54
  return props.autoResize ? '100%' : '200px';
55
55
  }, function (props) {
56
56
  return autoresizeConfObjToCss(props);
57
- }, active(), active(), error(), error(), function (props) {
57
+ }, function (props) {
58
58
  return props.theme.palette['grey-600'];
59
59
  }, function (props) {
60
60
  return props.theme.palette['grey-700'];
61
+ });
62
+ export var ComponentWrapper = styled.div.withConfig({
63
+ displayName: "Autocompletestyles__ComponentWrapper",
64
+ componentId: "sc-10de6ms-5"
65
+ })([".ant-select-auto-complete{", "}}"], function (props) {
66
+ if (props.error) {
67
+ return css([".ant-select-selector{&:hover{", "}", "}"], error(), error());
68
+ }
69
+
70
+ return css(["&.ant-select{.ant-input{transition:ease-in-out all 0.3s;&:focus{", " &:hover{", "}}}}"], active(), active());
61
71
  });
@@ -1,19 +1,16 @@
1
- import * as React from 'react';
2
- import AntdAutoComplete, { AutoCompleteProps as OriginalProps } from 'antd/lib/auto-complete';
1
+ import { ReactNode, MutableRefObject } from 'react';
2
+ import { AutoCompleteProps as OriginalProps } from 'antd/lib/auto-complete';
3
3
  import Select from 'antd/lib/select';
4
4
  export declare type OverrideProps = {
5
5
  className?: string;
6
- errorText?: React.ReactNode | string;
7
- label?: React.ReactNode | string;
8
- description?: React.ReactNode | string;
6
+ errorText?: ReactNode | string;
7
+ label?: ReactNode | string;
8
+ description?: ReactNode | string;
9
9
  error?: boolean;
10
- handleInputRef?: (ref: React.MutableRefObject<Select | undefined>) => void;
10
+ handleInputRef?: (ref: MutableRefObject<Select | undefined>) => void;
11
11
  autoResize?: boolean | {
12
12
  minWidth: string;
13
13
  maxWidth: string;
14
14
  };
15
15
  };
16
- export interface StaticComponents {
17
- Option: typeof AntdAutoComplete.Option;
18
- }
19
16
  export declare type AutocompleteProps = OverrideProps & OriginalProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-autocomplete",
3
- "version": "0.4.50",
3
+ "version": "0.5.1",
4
4
  "description": "Autocomplete UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -32,7 +32,7 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-input": "^0.18.51",
35
+ "@synerise/ds-input": "^0.19.1",
36
36
  "@synerise/ds-typography": "^0.12.10"
37
37
  },
38
38
  "peerDependencies": {
@@ -46,5 +46,5 @@
46
46
  "@testing-library/jest-dom": "5.1.1",
47
47
  "@testing-library/react": "10.0.1"
48
48
  },
49
- "gitHead": "955a885f58b3fca4caa4f879deb147fe5b9dc6d8"
49
+ "gitHead": "dcdec905a4a36109a33d28d9d31fc0b4af51567e"
50
50
  }