@majoo-ui/react 1.57.11 → 1.57.12

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.
@@ -587,7 +587,7 @@ export declare const SelectItem: import("@stitches/react/types/styled-component"
587
587
  backgroundColor: string;
588
588
  };
589
589
  }>>;
590
- export declare const SelectInputSearch: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<HTMLInputElement | HTMLButtonElement>>;
590
+ export declare const SelectInputSearch: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
591
591
  export declare type Option = {
592
592
  value: string;
593
593
  name: string;
@@ -713,5 +713,5 @@ interface InputSelectProps extends Omit<DownshiftProps<Option>, 'initialSelected
713
713
  */
714
714
  renderFooter?: () => React.ReactNode;
715
715
  }
716
- declare const InputSelect: React.ForwardRefExoticComponent<InputSelectProps & React.RefAttributes<HTMLInputElement | HTMLButtonElement>>;
716
+ export declare function InputSelect({ option, onChange, value, placeholder, searchPlaceholder, embedSearch, size, disabled, search, iconColor, hideArrowicon, showLeadingIcon, placement, disabledOptions, textSelector, valueSelector, readOnly, isInvalid, noOptionIcon, fetchData, onSearch, isLoading, showTooltip, css, renderFooter, optionCss, ...props }: InputSelectProps): JSX.Element;
717
717
  export default InputSelect;
package/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { useState, useEffect, createContext, useContext, useRef, useCallback, cloneElement, forwardRef, createElement as createElement$2, useLayoutEffect, useReducer, useMemo, memo } from 'react';
2
+ import React__default, { useState, useEffect, createContext, useContext, useRef, useCallback, cloneElement, createElement as createElement$2, forwardRef, useLayoutEffect, useReducer, useMemo, memo } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { createStitches, styled as styled$1 } from '@stitches/react';
5
5
  import { foundations } from '@majoo-ui/core';
@@ -7187,7 +7187,6 @@ const InputNumber = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
7187
7187
  props = _objectWithoutPropertiesLoose(_ref, _excluded$i);
7188
7188
  return /*#__PURE__*/React__default.createElement(StyledInput, _extends({
7189
7189
  ref: ref,
7190
- getInputRef: ref,
7191
7190
  placeholder: placeholder,
7192
7191
  value: value,
7193
7192
  size: size,
@@ -9101,7 +9100,7 @@ const SelectInputSearch = /*#__PURE__*/React.forwardRef((_a, forwardedRef) => {
9101
9100
  }, void 0)]
9102
9101
  }), void 0);
9103
9102
  });
9104
- const InputSelect = /*#__PURE__*/forwardRef((_a, ref) => {
9103
+ function InputSelect(_a) {
9105
9104
  var {
9106
9105
  option,
9107
9106
  onChange,
@@ -9183,7 +9182,7 @@ const InputSelect = /*#__PURE__*/forwardRef((_a, ref) => {
9183
9182
  setItem(generatedOption);
9184
9183
  setOptions(generatedOption);
9185
9184
  }, [option, disabledOptions, valueSelector, textSelector]);
9186
- const debouncedSearch = React.useRef(debounce(query => __awaiter(void 0, void 0, void 0, function* () {
9185
+ const debouncedSearch = React.useRef(debounce(query => __awaiter(this, void 0, void 0, function* () {
9187
9186
  setQuery(query);
9188
9187
  if (onSearch) onSearch(query);
9189
9188
  }), 1000)).current;
@@ -9269,7 +9268,6 @@ const InputSelect = /*#__PURE__*/forwardRef((_a, ref) => {
9269
9268
  }
9270
9269
  }, {
9271
9270
  children: jsx(SelectInputSearch, {
9272
- ref: ref,
9273
9271
  showLeadingIcon: showLeadingIcon,
9274
9272
  showClearIcon: hideArrowicon,
9275
9273
  disabled: disabled,
@@ -9294,7 +9292,6 @@ const InputSelect = /*#__PURE__*/forwardRef((_a, ref) => {
9294
9292
  }), void 0) : jsx(Button$3, Object.assign({}, getToggleButtonProps({
9295
9293
  disabled: disabled || readOnly
9296
9294
  }), {
9297
- ref: ref,
9298
9295
  disabled: disabled,
9299
9296
  size: size,
9300
9297
  readOnly: readOnly,
@@ -9453,7 +9450,7 @@ const InputSelect = /*#__PURE__*/forwardRef((_a, ref) => {
9453
9450
  }), void 0);
9454
9451
  }
9455
9452
  }), void 0);
9456
- });
9453
+ }
9457
9454
 
9458
9455
  var tryToString$3 = tryToString$5;
9459
9456
 
@@ -11344,7 +11341,7 @@ const InputSelectCheck = /*#__PURE__*/forwardRef((_ref, ref) => {
11344
11341
  }
11345
11342
  }
11346
11343
  });
11347
- const getOption = useCallback(() => option === null || option === void 0 ? void 0 : option.map(item => {
11344
+ const getOption = maxSelectedItem ? useCallback(() => option === null || option === void 0 ? void 0 : option.map(item => {
11348
11345
  const isMaxSelectedItem = maxSelectedItem && (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.length) >= maxSelectedItem;
11349
11346
  if (isMaxSelectedItem && !(selectedValue !== null && selectedValue !== void 0 && selectedValue.includes(item.id))) {
11350
11347
  item.hideCheck = true;
@@ -11354,7 +11351,7 @@ const InputSelectCheck = /*#__PURE__*/forwardRef((_ref, ref) => {
11354
11351
  item.isDisabled = false;
11355
11352
  }
11356
11353
  return item;
11357
- }), [maxSelectedItem, option, selectedValue]);
11354
+ }), [maxSelectedItem, option, selectedValue]) : () => option;
11358
11355
  useEffect(() => {
11359
11356
  sortItems();
11360
11357
  setItems(isShowSelectAll ? [{
@@ -11365,7 +11362,7 @@ const InputSelectCheck = /*#__PURE__*/forwardRef((_ref, ref) => {
11365
11362
  id: '!all',
11366
11363
  name: selectAllLabel != null ? selectAllLabel : t('selectAllLabelText', 'Pilih Semua')
11367
11364
  }, ...getOption()] : getOption());
11368
- }, [getOption, isShowSelectAll]);
11365
+ }, [option, isShowSelectAll]);
11369
11366
  useEffect(() => {
11370
11367
  if (selectedValue.length > 0 && disabledOptions.length === 0) {
11371
11368
  setInitItems(sortValue);
package/index.umd.js CHANGED
@@ -7271,7 +7271,6 @@
7271
7271
  props = _objectWithoutPropertiesLoose(_ref, _excluded$i);
7272
7272
  return /*#__PURE__*/React__default["default"].createElement(StyledInput, _extends({
7273
7273
  ref: ref,
7274
- getInputRef: ref,
7275
7274
  placeholder: placeholder,
7276
7275
  value: value,
7277
7276
  size: size,
@@ -9183,7 +9182,8 @@
9183
9182
  }, void 0)]
9184
9183
  }), void 0);
9185
9184
  });
9186
- var InputSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
9185
+ function InputSelect(_a) {
9186
+ var _this = this;
9187
9187
  var option = _a.option,
9188
9188
  onChange = _a.onChange,
9189
9189
  value = _a.value,
@@ -9297,7 +9297,7 @@
9297
9297
  setOptions(generatedOption);
9298
9298
  }, [option, disabledOptions, valueSelector, textSelector]);
9299
9299
  var debouncedSearch = React__namespace.useRef(debounce__default["default"](function (query) {
9300
- return __awaiter(void 0, void 0, void 0, function () {
9300
+ return __awaiter(_this, void 0, void 0, function () {
9301
9301
  return __generator(this, function (_a) {
9302
9302
  setQuery(query);
9303
9303
  if (onSearch) onSearch(query);
@@ -9392,7 +9392,6 @@
9392
9392
  }
9393
9393
  }, {
9394
9394
  children: jsxRuntime.jsx(SelectInputSearch, {
9395
- ref: ref,
9396
9395
  showLeadingIcon: showLeadingIcon,
9397
9396
  showClearIcon: hideArrowicon,
9398
9397
  disabled: disabled,
@@ -9417,7 +9416,6 @@
9417
9416
  }), void 0) : jsxRuntime.jsx(Button$3, __assign({}, getToggleButtonProps({
9418
9417
  disabled: disabled || readOnly
9419
9418
  }), {
9420
- ref: ref,
9421
9419
  disabled: disabled,
9422
9420
  size: size,
9423
9421
  readOnly: readOnly,
@@ -9580,7 +9578,7 @@
9580
9578
  }), void 0);
9581
9579
  }
9582
9580
  }), void 0);
9583
- });
9581
+ }
9584
9582
 
9585
9583
  var tryToString$3 = tryToString$5;
9586
9584
 
@@ -11493,7 +11491,7 @@
11493
11491
  }
11494
11492
  }
11495
11493
  });
11496
- const getOption = React.useCallback(() => option === null || option === void 0 ? void 0 : option.map(item => {
11494
+ const getOption = maxSelectedItem ? React.useCallback(() => option === null || option === void 0 ? void 0 : option.map(item => {
11497
11495
  const isMaxSelectedItem = maxSelectedItem && (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.length) >= maxSelectedItem;
11498
11496
  if (isMaxSelectedItem && !(selectedValue !== null && selectedValue !== void 0 && selectedValue.includes(item.id))) {
11499
11497
  item.hideCheck = true;
@@ -11503,7 +11501,7 @@
11503
11501
  item.isDisabled = false;
11504
11502
  }
11505
11503
  return item;
11506
- }), [maxSelectedItem, option, selectedValue]);
11504
+ }), [maxSelectedItem, option, selectedValue]) : () => option;
11507
11505
  React.useEffect(() => {
11508
11506
  sortItems();
11509
11507
  setItems(isShowSelectAll ? [{
@@ -11514,7 +11512,7 @@
11514
11512
  id: '!all',
11515
11513
  name: selectAllLabel != null ? selectAllLabel : t('selectAllLabelText', 'Pilih Semua')
11516
11514
  }, ...getOption()] : getOption());
11517
- }, [getOption, isShowSelectAll]);
11515
+ }, [option, isShowSelectAll]);
11518
11516
  React.useEffect(() => {
11519
11517
  if (selectedValue.length > 0 && disabledOptions.length === 0) {
11520
11518
  setInitItems(sortValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@majoo-ui/react",
3
- "version": "1.57.11",
3
+ "version": "1.57.12",
4
4
  "dependencies": {
5
5
  "@majoo-ui/core": "^1.31.3",
6
6
  "@majoo-ui/helpers": "^1.30.5",