fis-component 0.2.0 → 0.2.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/dist/cjs/index.js CHANGED
@@ -51,10 +51,13 @@ const INHERITS = {
51
51
  ApiSelect: ["Select"],
52
52
  };
53
53
  const getDefaults = (config, name) => {
54
- const legacy = (name === "Select" || name === "ApiSelect") &&
55
- config.select?.allowClear !== undefined
56
- ? { allowClear: config.select.allowClear }
57
- : {};
54
+ const legacy = {};
55
+ if (name === "Select" || name === "ApiSelect") {
56
+ if (config.select?.allowClear !== undefined)
57
+ legacy.allowClear = config.select.allowClear;
58
+ if (config.select?.clearValue !== undefined)
59
+ legacy.clearValue = config.select.clearValue;
60
+ }
58
61
  const names = [...(INHERITS[name] ?? []), name];
59
62
  return names.reduce((acc, n) => ({ ...acc, ...config.components?.[n] }), legacy);
60
63
  };
@@ -75599,7 +75602,7 @@ function isMenuSize(value) {
75599
75602
 
75600
75603
  const FISSelect$1 = React.forwardRef(({ className, style, size = "md", options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholder, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, searchValue, onSearchChange, portal = true, maxHeight, onPopupScroll, onOpen, hideChip, tooltipTitle, tooltipVariant = "primary", noData, noResult, noDataText, noResultText, footer, searchDebounce, showSearch, onSearchInput, virtualized, virtualItemHeight, removeSelectedText, selectedGroupLabel,
75601
75604
  // Default theo dự án được gộp ở withFISDefaults (src/index.ts)
75602
- allowClear = false, onClear, ...restProps }, ref) => {
75605
+ allowClear = false, clearValue, onClear, ...restProps }, ref) => {
75603
75606
  const [isOpen, setIsOpen] = React.useState(false);
75604
75607
  const [isHovered, setIsHovered] = React.useState(false);
75605
75608
  const [referenceElement, setReferenceElement] = React.useState(null);
@@ -75703,11 +75706,11 @@ allowClear = false, onClear, ...restProps }, ref) => {
75703
75706
  onChange([]);
75704
75707
  }
75705
75708
  else {
75706
- onChange(undefined);
75709
+ onChange(clearValue);
75707
75710
  }
75708
75711
  setCachedSelectedItem(null);
75709
75712
  onClear?.();
75710
- }, [multi, onChange, onClear]);
75713
+ }, [multi, onChange, onClear, clearValue]);
75711
75714
  const handleOptionRemove = React.useCallback((option) => {
75712
75715
  if (multi && Array.isArray(value)) {
75713
75716
  const newValues = value.filter((v) => v !== option.value);