glints-aries 4.0.245 → 4.0.246

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.
@@ -7,6 +7,7 @@ export declare const WithErrorNonSearchable: any;
7
7
  export declare const NonSearchableDisabled: any;
8
8
  export declare const SearchableMultiSelect: any;
9
9
  export declare const SearchableSingleSelect: any;
10
+ export declare const SearchableSingleWithInputState: any;
10
11
  export declare const MultiSelectScrollable: any;
11
12
  export declare const WithInlineError: any;
12
13
  export declare const SearchableDisabled: any;
@@ -71,6 +71,7 @@ export var ActivatorTextInput = function ActivatorTextInput(_ref) {
71
71
  prefix: prefix,
72
72
  filterOptions: filterOptions,
73
73
  onFocus: onFocus,
74
+ onInputChange: onChange,
74
75
  onSelect: onSelect,
75
76
  error: hasError,
76
77
  disabled: disabled,
@@ -9,6 +9,7 @@ export interface SearchableSelectState {
9
9
  export declare type SearchableSelectInputProps = Omit<InputProps, 'type' | 'onChange' | 'onSelect'> & {
10
10
  canClear?: boolean;
11
11
  filterOptions?: (str: string) => Option[];
12
+ onInputChange?(value: string): void;
12
13
  onSelect?({ value }: {
13
14
  value: string;
14
15
  }): void;
@@ -23,6 +24,7 @@ export declare type SearchableSelectInputProps = Omit<InputProps, 'type' | 'onCh
23
24
  export declare const SearchableSelectInput: React.ForwardRefExoticComponent<Omit<InputProps, "type" | "onChange" | "onSelect"> & {
24
25
  canClear?: boolean;
25
26
  filterOptions?: (str: string) => Option[];
27
+ onInputChange?(value: string): void;
26
28
  onSelect?({ value }: {
27
29
  value: string;
28
30
  }): void;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["disabled", "error", "filterOptions", "onSelect", "placeholder", "prefix", "selectedValue", "width", "inputValue", "updateInputValue", "onFocus", "searchableSelectState", "updateSearchableSelectState", "options", "updateMenuOptions"];
3
+ var _excluded = ["disabled", "error", "filterOptions", "onSelect", "placeholder", "prefix", "selectedValue", "width", "inputValue", "updateInputValue", "onInputChange", "onFocus", "searchableSelectState", "updateSearchableSelectState", "options", "updateMenuOptions"];
4
4
  import React, { forwardRef, useEffect, useRef, useState } from 'react';
5
5
  import { StyledInput, StyledPrefixContainer } from '../../../Input/InputStyle';
6
6
  import { ClearSelected } from './ClearSelected';
@@ -17,6 +17,7 @@ export var SearchableSelectInput = /*#__PURE__*/forwardRef(function SearchableSe
17
17
  width = _ref.width,
18
18
  inputValue = _ref.inputValue,
19
19
  updateInputValue = _ref.updateInputValue,
20
+ onInputChange = _ref.onInputChange,
20
21
  onFocus = _ref.onFocus,
21
22
  _ref$searchableSelect = _ref.searchableSelectState,
22
23
  showInput = _ref$searchableSelect.showInput,
@@ -49,6 +50,9 @@ export var SearchableSelectInput = /*#__PURE__*/forwardRef(function SearchableSe
49
50
  };
50
51
  var handleInputChange = function handleInputChange(e) {
51
52
  var str = e.currentTarget.value;
53
+ if (onInputChange) {
54
+ onInputChange(str);
55
+ }
52
56
  updateInputValue(str);
53
57
  var filteredOptions = filterOptions(str);
54
58
  updateMenuOptions(filteredOptions);
@@ -4,4 +4,5 @@ interface SearchableSingleSelectProps {
4
4
  data?: Option[];
5
5
  }
6
6
  export declare const SearchableSingle: ({ data, ...args }: SearchableSingleSelectProps) => JSX.Element;
7
+ export declare const SearchableSingleWithInputState: ({ data, ...args }: SearchableSingleSelectProps) => JSX.Element;
7
8
  export {};
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["data"];
3
+ var _excluded = ["data"],
4
+ _excluded2 = ["data"];
4
5
  import React, { useState } from 'react';
5
6
  import { Select } from '../Select';
6
7
  export var SearchableSingle = function SearchableSingle(_ref) {
@@ -21,4 +22,34 @@ export var SearchableSingle = function SearchableSingle(_ref) {
21
22
  searchable: true,
22
23
  label: "Label"
23
24
  }));
25
+ };
26
+ export var SearchableSingleWithInputState = function SearchableSingleWithInputState(_ref3) {
27
+ var data = _ref3.data,
28
+ args = _objectWithoutPropertiesLoose(_ref3, _excluded2);
29
+ var _useState2 = useState(''),
30
+ inputValue = _useState2[0],
31
+ setInputValue = _useState2[1];
32
+ var _useState3 = useState(''),
33
+ selected = _useState3[0],
34
+ setSelected = _useState3[1];
35
+ var handleInputChange = function handleInputChange(value) {
36
+ setInputValue(value);
37
+ };
38
+ var handleSelect = function handleSelect(_ref4) {
39
+ var value = _ref4.value;
40
+ setSelected(value);
41
+ };
42
+ return /*#__PURE__*/React.createElement(Select, _extends({}, args, {
43
+ onSelect: handleSelect,
44
+ options: data,
45
+ selectedValues: [selected],
46
+ searchableProps: {
47
+ inputValue: inputValue,
48
+ onInputChange: function onInputChange(value) {
49
+ return handleInputChange(value);
50
+ }
51
+ },
52
+ width: "600px",
53
+ label: "Label"
54
+ }));
24
55
  };
@@ -7,6 +7,7 @@ export declare const WithErrorNonSearchable: any;
7
7
  export declare const NonSearchableDisabled: any;
8
8
  export declare const SearchableMultiSelect: any;
9
9
  export declare const SearchableSingleSelect: any;
10
+ export declare const SearchableSingleWithInputState: any;
10
11
  export declare const MultiSelectScrollable: any;
11
12
  export declare const WithInlineError: any;
12
13
  export declare const SearchableDisabled: any;
@@ -78,6 +78,7 @@ var ActivatorTextInput = function ActivatorTextInput(_ref) {
78
78
  prefix: prefix,
79
79
  filterOptions: filterOptions,
80
80
  onFocus: onFocus,
81
+ onInputChange: onChange,
81
82
  onSelect: onSelect,
82
83
  error: hasError,
83
84
  disabled: disabled,
@@ -9,6 +9,7 @@ export interface SearchableSelectState {
9
9
  export declare type SearchableSelectInputProps = Omit<InputProps, 'type' | 'onChange' | 'onSelect'> & {
10
10
  canClear?: boolean;
11
11
  filterOptions?: (str: string) => Option[];
12
+ onInputChange?(value: string): void;
12
13
  onSelect?({ value }: {
13
14
  value: string;
14
15
  }): void;
@@ -23,6 +24,7 @@ export declare type SearchableSelectInputProps = Omit<InputProps, 'type' | 'onCh
23
24
  export declare const SearchableSelectInput: React.ForwardRefExoticComponent<Omit<InputProps, "type" | "onChange" | "onSelect"> & {
24
25
  canClear?: boolean;
25
26
  filterOptions?: (str: string) => Option[];
27
+ onInputChange?(value: string): void;
26
28
  onSelect?({ value }: {
27
29
  value: string;
28
30
  }): void;
@@ -9,7 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
9
9
  var _InputStyle = require("../../../Input/InputStyle");
10
10
  var _ClearSelected = require("./ClearSelected");
11
11
  var _SearchableSelectInputStyle = require("./SearchableSelectInputStyle");
12
- var _excluded = ["disabled", "error", "filterOptions", "onSelect", "placeholder", "prefix", "selectedValue", "width", "inputValue", "updateInputValue", "onFocus", "searchableSelectState", "updateSearchableSelectState", "options", "updateMenuOptions"];
12
+ var _excluded = ["disabled", "error", "filterOptions", "onSelect", "placeholder", "prefix", "selectedValue", "width", "inputValue", "updateInputValue", "onInputChange", "onFocus", "searchableSelectState", "updateSearchableSelectState", "options", "updateMenuOptions"];
13
13
  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); }
14
14
  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; }
15
15
  var SearchableSelectInput = /*#__PURE__*/(0, _react.forwardRef)(function SearchableSelectInput(_ref, ref) {
@@ -24,6 +24,7 @@ var SearchableSelectInput = /*#__PURE__*/(0, _react.forwardRef)(function Searcha
24
24
  width = _ref.width,
25
25
  inputValue = _ref.inputValue,
26
26
  updateInputValue = _ref.updateInputValue,
27
+ onInputChange = _ref.onInputChange,
27
28
  onFocus = _ref.onFocus,
28
29
  _ref$searchableSelect = _ref.searchableSelectState,
29
30
  showInput = _ref$searchableSelect.showInput,
@@ -56,6 +57,9 @@ var SearchableSelectInput = /*#__PURE__*/(0, _react.forwardRef)(function Searcha
56
57
  };
57
58
  var handleInputChange = function handleInputChange(e) {
58
59
  var str = e.currentTarget.value;
60
+ if (onInputChange) {
61
+ onInputChange(str);
62
+ }
59
63
  updateInputValue(str);
60
64
  var filteredOptions = filterOptions(str);
61
65
  updateMenuOptions(filteredOptions);
@@ -4,4 +4,5 @@ interface SearchableSingleSelectProps {
4
4
  data?: Option[];
5
5
  }
6
6
  export declare const SearchableSingle: ({ data, ...args }: SearchableSingleSelectProps) => JSX.Element;
7
+ export declare const SearchableSingleWithInputState: ({ data, ...args }: SearchableSingleSelectProps) => JSX.Element;
7
8
  export {};
@@ -2,12 +2,13 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.__esModule = true;
5
- exports.SearchableSingle = void 0;
5
+ exports.SearchableSingleWithInputState = exports.SearchableSingle = void 0;
6
6
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
7
7
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _Select = require("../Select");
10
- var _excluded = ["data"];
10
+ var _excluded = ["data"],
11
+ _excluded2 = ["data"];
11
12
  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); }
12
13
  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; }
13
14
  var SearchableSingle = function SearchableSingle(_ref) {
@@ -29,4 +30,35 @@ var SearchableSingle = function SearchableSingle(_ref) {
29
30
  label: "Label"
30
31
  }));
31
32
  };
32
- exports.SearchableSingle = SearchableSingle;
33
+ exports.SearchableSingle = SearchableSingle;
34
+ var SearchableSingleWithInputState = function SearchableSingleWithInputState(_ref3) {
35
+ var data = _ref3.data,
36
+ args = (0, _objectWithoutPropertiesLoose2["default"])(_ref3, _excluded2);
37
+ var _useState2 = (0, _react.useState)(''),
38
+ inputValue = _useState2[0],
39
+ setInputValue = _useState2[1];
40
+ var _useState3 = (0, _react.useState)(''),
41
+ selected = _useState3[0],
42
+ setSelected = _useState3[1];
43
+ var handleInputChange = function handleInputChange(value) {
44
+ setInputValue(value);
45
+ };
46
+ var handleSelect = function handleSelect(_ref4) {
47
+ var value = _ref4.value;
48
+ setSelected(value);
49
+ };
50
+ return /*#__PURE__*/_react["default"].createElement(_Select.Select, (0, _extends2["default"])({}, args, {
51
+ onSelect: handleSelect,
52
+ options: data,
53
+ selectedValues: [selected],
54
+ searchableProps: {
55
+ inputValue: inputValue,
56
+ onInputChange: function onInputChange(value) {
57
+ return handleInputChange(value);
58
+ }
59
+ },
60
+ width: "600px",
61
+ label: "Label"
62
+ }));
63
+ };
64
+ exports.SearchableSingleWithInputState = SearchableSingleWithInputState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glints-aries",
3
- "version": "4.0.245",
3
+ "version": "4.0.246",
4
4
  "description": "Glints ui-kit for frontend",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",