bianic-ui 1.15.0 → 1.16.0-beta.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.
Files changed (36) hide show
  1. package/dist/cjs/index.js +117 -97
  2. package/dist/cjs/types/components/Forms/DatePicker/DateInputDisplay.d.ts +3 -1
  3. package/dist/cjs/types/components/Forms/DatePicker/DatePicker.d.ts +3 -1
  4. package/dist/cjs/types/components/Forms/Dropdown/DropdownContainer.d.ts +1 -1
  5. package/dist/cjs/types/components/Forms/LiveSearch/Example/CustomDropdown.d.ts +1 -2
  6. package/dist/cjs/types/components/Forms/LiveSearch/Example/DeprecatedSimulation.d.ts +4 -0
  7. package/dist/cjs/types/components/Forms/LiveSearch/hooks/useLiveSearch.d.ts +9 -0
  8. package/dist/cjs/types/components/Forms/LiveSearch/index.d.ts +2 -6
  9. package/dist/cjs/types/components/Forms/LiveSearch/types/index.d.ts +36 -0
  10. package/dist/cjs/types/components/Forms/LiveSearch/utils/dropdownUtils.d.ts +8 -0
  11. package/dist/cjs/types/components/Forms/LiveSearch/utils/searchUtils.d.ts +3 -0
  12. package/dist/cjs/types/components/InfoPanel/index.d.ts +3 -3
  13. package/dist/cjs/types/components/Tab/Tab.d.ts +2 -1
  14. package/dist/{esm/types/stories/Form/LiveSearch/LivesearchOld.stories.d.ts → cjs/types/stories/Form/LiveSearch/DeprecatedSimulation.stories.d.ts} +2 -2
  15. package/dist/cjs/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +4 -3
  16. package/dist/esm/index.js +118 -98
  17. package/dist/esm/types/components/Forms/DatePicker/DateInputDisplay.d.ts +3 -1
  18. package/dist/esm/types/components/Forms/DatePicker/DatePicker.d.ts +3 -1
  19. package/dist/esm/types/components/Forms/Dropdown/DropdownContainer.d.ts +1 -1
  20. package/dist/esm/types/components/Forms/LiveSearch/Example/CustomDropdown.d.ts +1 -2
  21. package/dist/esm/types/components/Forms/LiveSearch/Example/DeprecatedSimulation.d.ts +4 -0
  22. package/dist/esm/types/components/Forms/LiveSearch/hooks/useLiveSearch.d.ts +9 -0
  23. package/dist/esm/types/components/Forms/LiveSearch/index.d.ts +2 -6
  24. package/dist/esm/types/components/Forms/LiveSearch/types/index.d.ts +36 -0
  25. package/dist/esm/types/components/Forms/LiveSearch/utils/dropdownUtils.d.ts +8 -0
  26. package/dist/esm/types/components/Forms/LiveSearch/utils/searchUtils.d.ts +3 -0
  27. package/dist/esm/types/components/InfoPanel/index.d.ts +3 -3
  28. package/dist/esm/types/components/Tab/Tab.d.ts +2 -1
  29. package/dist/{cjs/types/stories/Form/LiveSearch/LivesearchOld.stories.d.ts → esm/types/stories/Form/LiveSearch/DeprecatedSimulation.stories.d.ts} +2 -2
  30. package/dist/esm/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +4 -3
  31. package/dist/index.d.ts +24 -21
  32. package/package.json +1 -1
  33. package/dist/cjs/types/components/Forms/LiveSearch/PropsInterface.d.ts +0 -23
  34. package/dist/cjs/types/components/Forms/LiveSearch/Simulation.d.ts +0 -4
  35. package/dist/esm/types/components/Forms/LiveSearch/PropsInterface.d.ts +0 -23
  36. package/dist/esm/types/components/Forms/LiveSearch/Simulation.d.ts +0 -4
package/dist/cjs/index.js CHANGED
@@ -2520,111 +2520,129 @@ var matchSearchTerm = function (content, term, variant) {
2520
2520
  return lowerContent.includes(lowerTerm);
2521
2521
  }
2522
2522
  };
2523
- function LiveSearch(_a) {
2524
- var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, placeholder = _a.placeholder, _d = _a.required, required = _d === void 0 ? false : _d, options = _a.options, setValue = _a.setValue, value = _a.value, _e = _a.readOnly, readOnly = _e === void 0 ? false : _e, _f = _a.onChangeText, onChangeText = _f === void 0 ? function () { } : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, _h = _a.autoComplete, autoComplete = _h === void 0 ? 'off' : _h, _j = _a.children, children = _j === void 0 ? undefined : _j, _k = _a.dropContProps, dropContProps = _k === void 0 ? { className: undefined } : _k, _l = _a.searchVariant, searchVariant = _l === void 0 ? 'include' : _l;
2525
- var _m = React.useState(false), isOpen = _m[0], setIsOpen = _m[1];
2526
- var _o = React.useState(value.label || ''), searchTerm = _o[0], setSearchTerm = _o[1];
2527
- var _p = sizeConfig$6[size], iconClass = _p.iconClass, iconSize = _p.iconSize, inputClass = _p.inputClass;
2528
- var dropContClassName = dropContProps.className, dropContOnClickItem = dropContProps.onClickItem, restDropContProps = __rest(dropContProps, ["className", "onClickItem"]);
2529
- var isValueExist = value && value.label !== undefined && value.label !== '';
2530
- var inputRef = React.useRef(null);
2531
- var dropdownContRef = React.useRef(null);
2532
- // Will be used soon
2533
- // const handleOutsideClick = (e: MouseEvent) => {
2534
- // if (inputRef.current && !inputRef.current.contains(e.target as Node)) {
2535
- // setIsOpen(false)
2536
- // }
2537
- // }
2538
- // useEffect(() => {
2539
- // document.addEventListener('mousedown', handleOutsideClick)
2540
- // return () => {
2541
- // document.removeEventListener('mousedown', handleOutsideClick)
2542
- // }
2543
- // })
2544
- // Synchronize internal searchTerm with external value prop
2545
- React.useEffect(function () {
2546
- // Only update searchTerm if the label from the value prop differs from the current searchTerm
2547
- // This prevents infinite loops if searchTerm is already the same as value.label
2548
- if (value.label !== searchTerm) {
2549
- setSearchTerm(value.label || '');
2550
- }
2551
- }, [value.label, searchTerm]);
2552
- var filteredOptions = options === null || options === void 0 ? void 0 : options.filter(function (item) {
2553
- return item.label.toLowerCase().includes(value.label.toLowerCase());
2523
+ var filterOptions = function (options, searchTerm) {
2524
+ return options === null || options === void 0 ? void 0 : options.filter(function (item) {
2525
+ return item.label.toLowerCase().includes(searchTerm.toLowerCase());
2554
2526
  });
2555
- var handleInputChange = function (e) {
2556
- var newSearchTerm = e.target.value;
2557
- setSearchTerm(newSearchTerm);
2558
- setIsOpen(true); // Ensure dropdown opens when typing
2559
- };
2560
- var handleDropdownItemClick = React.useCallback(function (clickedValue) {
2561
- setSearchTerm(clickedValue.label); // Set input text to the selected label
2562
- setValue(clickedValue); // Update the value in the parent
2563
- setIsOpen(false);
2564
- }, [setValue]);
2565
- // Recursive function to filter and clone DropdownItems, including nested items
2566
- var processDropdownChildren = function (nodes, currentSearchTerm, includeAllIfNoSearch) {
2567
- return React.Children.map(nodes, function (child) {
2568
- if (!React.isValidElement(child) || child.type !== DropdownItem) {
2569
- return child;
2570
- }
2571
- var itemProps = child.props;
2572
- // Assume content is a string for filtering; otherwise, filtering won't work well
2573
- var itemContent = typeof itemProps.content === 'string' ? itemProps.content : '';
2574
- var itemValue = itemProps.value;
2575
- var isDisabled = itemProps.disabled;
2576
- // 2. Filtering Logic (Uses Global Search Variant)
2577
- if (!includeAllIfNoSearch) {
2578
- // Use the matchSearchTerm utility with the selected searchVariant
2579
- if (currentSearchTerm && !matchSearchTerm(itemValue, currentSearchTerm, searchVariant)) {
2580
- return null; // Item does not match the search criteria
2581
- }
2527
+ };
2528
+
2529
+ var getItemLabel = function (value) {
2530
+ var _a;
2531
+ return typeof value === 'object' && value !== null && 'label' in value
2532
+ ? (_a = value.label) !== null && _a !== void 0 ? _a : ''
2533
+ : String(value !== null && value !== void 0 ? value : '');
2534
+ };
2535
+ var processDropdownChildren = function (nodes, currentSearchTerm, includeAllIfNoSearch, searchVariant, handleDropdownItemClick) {
2536
+ if (searchVariant === void 0) { searchVariant = 'include'; }
2537
+ return React.Children.map(nodes, function (child) {
2538
+ if (!React.isValidElement(child) || child.type !== DropdownItem) {
2539
+ return child;
2540
+ }
2541
+ var itemProps = child.props;
2542
+ var itemContent = typeof itemProps.content === 'string' ? itemProps.content : '';
2543
+ var itemValue = itemProps.value;
2544
+ var isDisabled = itemProps.disabled;
2545
+ // Filtering Logic
2546
+ if (!includeAllIfNoSearch) {
2547
+ var itemValueStr = typeof itemValue === 'object'
2548
+ ? itemValue.label
2549
+ : String(itemValue || '');
2550
+ if (currentSearchTerm &&
2551
+ !matchSearchTerm(itemValueStr, currentSearchTerm, searchVariant)) {
2552
+ return null;
2582
2553
  }
2583
- // 3. Process Nested Children (Recursion)
2584
- var clonedChildren = itemProps.children
2585
- ? processDropdownChildren(itemProps.children, currentSearchTerm, includeAllIfNoSearch)
2586
- : null;
2587
- // 4. Clone and Inject Click Handler
2588
- return React.cloneElement(child, {
2589
- onClick: function (e) {
2590
- if (!isDisabled) {
2591
- handleDropdownItemClick({
2592
- id: itemValue !== undefined ? itemValue : itemContent,
2593
- label: itemValue !== undefined ? itemValue : itemContent
2594
- });
2595
- }
2596
- if (dropContOnClickItem) {
2597
- dropContOnClickItem(e, itemValue !== undefined ? itemValue : itemContent);
2554
+ }
2555
+ // Process Nested Children
2556
+ var clonedChildren = itemProps.children
2557
+ ? processDropdownChildren(itemProps.children, currentSearchTerm, includeAllIfNoSearch, searchVariant, handleDropdownItemClick)
2558
+ : null;
2559
+ // Clone and Inject Click Handler
2560
+ return React.cloneElement(child, {
2561
+ onClick: function (e) {
2562
+ if (!isDisabled) {
2563
+ if (itemValue === undefined &&
2564
+ typeof itemProps.content === 'string') {
2565
+ return handleDropdownItemClick(e, itemContent);
2598
2566
  }
2599
- if (itemProps.onClickItem) {
2600
- itemProps.onClickItem(e, itemValue !== undefined ? itemValue : itemContent);
2567
+ if (typeof itemValue === 'object' || itemValue !== undefined) {
2568
+ return handleDropdownItemClick(e, itemValue);
2601
2569
  }
2602
- },
2603
- children: clonedChildren
2604
- });
2570
+ }
2571
+ if (itemProps.onClickItem) {
2572
+ itemProps.onClickItem(e, itemValue !== undefined ? itemValue : itemContent);
2573
+ }
2574
+ },
2575
+ children: clonedChildren,
2605
2576
  });
2606
- };
2607
- // Determine which children to display
2577
+ });
2578
+ };
2579
+ var processRenderedChildren = function (children, searchTerm, searchVariant, handleDropdownItemClick) {
2608
2580
  var renderedChildren = null;
2609
2581
  var hasFilteredResults = false;
2610
2582
  if (searchTerm) {
2611
- // If there's a searchTerm, filter children
2612
- renderedChildren = processDropdownChildren(children, searchTerm, false);
2583
+ renderedChildren = processDropdownChildren(children, searchTerm, false, searchVariant, handleDropdownItemClick);
2613
2584
  hasFilteredResults =
2614
2585
  React.Children.toArray(renderedChildren).filter(Boolean).length > 0;
2615
2586
  }
2616
2587
  else {
2617
- // If searchTerm is empty, display all children without filtering (but with onClick injected)
2618
- renderedChildren = processDropdownChildren(children, '', true);
2588
+ renderedChildren = processDropdownChildren(children, '', true, searchVariant, handleDropdownItemClick);
2619
2589
  hasFilteredResults =
2620
- React.Children.toArray(renderedChildren).filter(Boolean).length > 0; // Should always be true if there are initial children
2590
+ React.Children.toArray(renderedChildren).filter(Boolean).length > 0;
2621
2591
  }
2592
+ return { renderedChildren: renderedChildren, hasFilteredResults: hasFilteredResults };
2593
+ };
2594
+
2595
+ var useLiveSearch = function (_a) {
2596
+ var value = _a.value, setValue = _a.setValue, onChangeText = _a.onChangeText, dropContOnClickItem = _a.dropContOnClickItem;
2597
+ var _b = React.useState(false), isOpen = _b[0], setIsOpen = _b[1];
2598
+ var _c = React.useState(String(value.label || '')), searchTerm = _c[0], setSearchTerm = _c[1];
2599
+ React.useEffect(function () {
2600
+ if (!isOpen && searchTerm !== '') {
2601
+ setSearchTerm(getItemLabel(value));
2602
+ }
2603
+ }, [isOpen]);
2604
+ var handleInputChange = function (e) {
2605
+ var newSearchTerm = e.target.value;
2606
+ setSearchTerm(newSearchTerm);
2607
+ setIsOpen(true);
2608
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(e);
2609
+ };
2610
+ var handleDropdownItemClick = React.useCallback(function (event, clickedValue) {
2611
+ dropContOnClickItem === null || dropContOnClickItem === void 0 ? void 0 : dropContOnClickItem(event, clickedValue);
2612
+ var newLabel = getItemLabel(clickedValue);
2613
+ setSearchTerm(newLabel);
2614
+ setValue(clickedValue);
2615
+ setIsOpen(false);
2616
+ }, [setValue, dropContOnClickItem]);
2617
+ return {
2618
+ isOpen: isOpen,
2619
+ setIsOpen: setIsOpen,
2620
+ searchTerm: searchTerm,
2621
+ handleInputChange: handleInputChange,
2622
+ handleDropdownItemClick: handleDropdownItemClick,
2623
+ };
2624
+ };
2625
+
2626
+ function LiveSearch(_a) {
2627
+ var _b = _a.autoComplete, autoComplete = _b === void 0 ? 'off' : _b, _c = _a.children, children = _c === void 0 ? undefined : _c, descText = _a.descText, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.dropContProps, dropContProps = _e === void 0 ? { className: undefined } : _e, id = _a.id, label = _a.label, _f = _a.onChangeText, onChangeText = _f === void 0 ? function () { } : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, options = _a.options, placeholder = _a.placeholder, _h = _a.readOnly, readOnly = _h === void 0 ? false : _h, _j = _a.required, required = _j === void 0 ? false : _j, _k = _a.searchVariant, searchVariant = _k === void 0 ? 'include' : _k, setValue = _a.setValue, _l = _a.size, size = _l === void 0 ? 'md' : _l, value = _a.value;
2628
+ var inputRef = React.useRef(null);
2629
+ var dropdownContRef = React.useRef(null);
2630
+ var _m = useLiveSearch({
2631
+ value: value,
2632
+ setValue: setValue,
2633
+ onChangeText: onChangeText,
2634
+ dropContOnClickItem: dropContProps.onClickItem
2635
+ }), isOpen = _m.isOpen, setIsOpen = _m.setIsOpen, searchTerm = _m.searchTerm, handleInputChange = _m.handleInputChange, handleDropdownItemClick = _m.handleDropdownItemClick;
2636
+ var _o = sizeConfig$6[size], iconClass = _o.iconClass, iconSize = _o.iconSize, inputClass = _o.inputClass;
2637
+ var dropContClassName = dropContProps.className; dropContProps.onClickItem; var restDropContProps = __rest(dropContProps, ["className", "onClickItem"]);
2638
+ var isValueExist = value && value.label !== undefined && value.label !== '';
2639
+ var filteredOptions = filterOptions(options || [], value.label);
2640
+ var _p = processRenderedChildren(children, searchTerm, searchVariant, handleDropdownItemClick), renderedChildren = _p.renderedChildren, hasFilteredResults = _p.hasFilteredResults;
2622
2641
  return (React.createElement("div", { className: "bianic-livesearch field-group group/form flex w-full flex-col gap-y-2 " },
2623
2642
  label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
2624
2643
  React.createElement("div", { className: "group relative w-full" },
2625
2644
  React.createElement("input", { className: "bianic-livesearch-input field peer w-full rounded border border-bia-grey-dark-10 bg-primary-white read-only:pointer-events-none read-only:border-bia-grey-disabled focus-visible:outline-none enabled:hover:rounded-b-none enabled:hover:border-b-bia-blue enabled:focus:rounded-b-none enabled:focus:border-b-bia-blue disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-10 disabled:text-bia-coolgrey ".concat(inputClass), onClick: function () { return setIsOpen(!isOpen); }, value: searchTerm, required: required, disabled: disabled, id: id, placeholder: placeholder, ref: inputRef, onChange: function (e) {
2626
2645
  onChangeText(e);
2627
- setValue({ id: null, label: e.target.value });
2628
2646
  handleInputChange(e);
2629
2647
  }, type: "text", readOnly: readOnly, autoComplete: autoComplete }),
2630
2648
  React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconClass) },
@@ -3070,7 +3088,7 @@ var monthMap = [
3070
3088
  'December',
3071
3089
  ];
3072
3090
  var DateInputDisplay = function (_a) {
3073
- var value = _a.value, setValue = _a.setValue, _b = _a.placeholder, placeholder = _b === void 0 ? 'YYYY-MM-DD' : _b, label = _a.label, required = _a.required, id = _a.id, _c = _a.size, size = _c === void 0 ? 'sm' : _c, className = _a.className, _d = _a.disabled, disabled = _d === void 0 ? false : _d, buttonAction = _a.buttonAction, props = __rest(_a, ["value", "setValue", "placeholder", "label", "required", "id", "size", "className", "disabled", "buttonAction"]);
3091
+ var value = _a.value, setValue = _a.setValue, _b = _a.placeholder, placeholder = _b === void 0 ? 'YYYY-MM-DD' : _b, label = _a.label, required = _a.required, id = _a.id, _c = _a.size, size = _c === void 0 ? 'sm' : _c, className = _a.className, _d = _a.disabled, disabled = _d === void 0 ? false : _d, buttonAction = _a.buttonAction, nullDisplay = _a.nullDisplay, props = __rest(_a, ["value", "setValue", "placeholder", "label", "required", "id", "size", "className", "disabled", "buttonAction", "nullDisplay"]);
3074
3092
  var _e = React.useState(false), isEditing = _e[0], setIsEditing = _e[1];
3075
3093
  var _f = React.useState(value), dateString = _f[0], setDateString = _f[1];
3076
3094
  var _g = styleConfig['text'], fieldStyle = _g.fieldStyle;
@@ -3099,11 +3117,13 @@ var DateInputDisplay = function (_a) {
3099
3117
  setIsEditing(false);
3100
3118
  setDateString(value);
3101
3119
  };
3102
- var input = isEditing ? (React.createElement(TextInput, { type: "text", value: dateString !== null && dateString !== void 0 ? dateString : '', onChange: handleTextChange, onBlur: handleBlur, placeholder: placeholder, size: size, autoFocus: true, actionElement: React.createElement("button", { className: "bianic-datepicker-toggle-button text-bia-coolgrey", disabled: disabled, onClick: function () {
3120
+ var input = isEditing ? (React.createElement(TextInput, { type: "text", value: dateString !== null && dateString !== void 0 ? dateString : '', onChange: handleTextChange, onBlur: handleBlur, placeholder: placeholder, size: size, inputClassName: className, autoFocus: true, actionElement: React.createElement("button", { className: "bianic-datepicker-toggle-button text-bia-coolgrey", disabled: disabled, onClick: function () {
3103
3121
  buttonAction && buttonAction();
3104
3122
  } },
3105
3123
  React.createElement(TbCalendar, { size: iconSize })) })) : (React.createElement(React.Fragment, null,
3106
- React.createElement("div", { role: "button", onClick: function () { return setIsEditing(true); }, className: "bianic-text-input bianic-fgc-target w-full min-w-[185px] rounded hover:rounded-b-none hover:border-b-bia-blue focus:rounded-b-none focus-visible:outline-none disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(extendedInputClassName, " ").concat(value ? 'text-bia-black' : 'text-bia-coolgrey') }, value ? displayDateFormatter(new Date(value)) : placeholder),
3124
+ React.createElement("div", { role: "button", onClick: function () { return setIsEditing(true); }, className: "bianic-text-input bianic-fgc-target w-full min-w-[185px] rounded hover:rounded-b-none hover:border-b-bia-blue focus:rounded-b-none focus-visible:outline-none disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(extendedInputClassName, " ").concat(value || nullDisplay ? 'text-bia-black' : 'text-bia-coolgrey', " ").concat(className) }, value
3125
+ ? displayDateFormatter(new Date(value))
3126
+ : nullDisplay || placeholder),
3107
3127
  React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 text-bia-coolgrey ".concat(iconPosition) },
3108
3128
  React.createElement("button", { className: "bianic-datepicker-toggle-button", disabled: disabled, onClick: function () { return buttonAction && buttonAction(); } },
3109
3129
  React.createElement(TbCalendar, { size: iconSize })))));
@@ -3132,7 +3152,7 @@ var displayDateFormatter = function (date) {
3132
3152
  };
3133
3153
 
3134
3154
  function DatePicker(_a) {
3135
- var value = _a.value, onChange = _a.onChange, size = _a.size, disabled = _a.disabled; _a.placeholder; var label = _a.label, minDate = _a.minDate, maxDate = _a.maxDate, required = _a.required;
3155
+ var className = _a.className, value = _a.value, onChange = _a.onChange, size = _a.size, disabled = _a.disabled; _a.placeholder; var label = _a.label, minDate = _a.minDate, maxDate = _a.maxDate, required = _a.required, nullDisplay = _a.nullDisplay;
3136
3156
  // State and Ref
3137
3157
  var inputRef = React.useRef(null);
3138
3158
  var wrapperRef = React.useRef(null);
@@ -3140,7 +3160,7 @@ function DatePicker(_a) {
3140
3160
  var _c = useDetectOutsideClick(wrapperRef, false, pickerRef), isPickerOpen = _c[0], setIsPickerOpen = _c[1];
3141
3161
  return (React.createElement("div", { className: "bianic-datepicker-container relative", ref: wrapperRef },
3142
3162
  React.createElement("div", { className: "bianic-datepicker-field-container" },
3143
- React.createElement(DateInputDisplay, { value: value, setValue: onChange, placeholder: "YYYY-MM-DD", size: size, label: label, required: required, buttonAction: function () { return setIsPickerOpen(!isPickerOpen); }, ref: inputRef, disabled: disabled })),
3163
+ React.createElement(DateInputDisplay, { inputClassName: className, value: value, setValue: onChange, placeholder: "YYYY-MM-DD", nullDisplay: nullDisplay, size: size, label: label, required: required, buttonAction: function () { return setIsPickerOpen(!isPickerOpen); }, ref: inputRef, disabled: disabled })),
3144
3164
  isPickerOpen && (React.createElement("div", { className: "bianic-datepicker-calendar-container absolute left-0 w-[250px] rounded-b-radius-sm bg-bia-white px-1.5 pb-[17px] pt-[15px] shadow-md" },
3145
3165
  React.createElement(PickerCalendar, { selectedDate: value, onDateChange: onChange, ref: pickerRef, minDate: minDate, maxDate: maxDate })))));
3146
3166
  }
@@ -3338,18 +3358,17 @@ var sizeConfig$3 = {
3338
3358
  };
3339
3359
 
3340
3360
  var InfoPanel = function (_a) {
3341
- var variant = _a.variant, color = _a.color, className = _a.className, textClassName = _a.textClassName;
3361
+ var variant = _a.variant, color = _a.color, className = _a.className, children = _a.children;
3342
3362
  var sizeClass = sizeConfig$3[variant || 'container'];
3343
3363
  var colorClass = colorConfig$1[color || 'yellow'];
3344
3364
  var allClasses = "".concat(sizeClass, " ").concat(colorClass, " ").concat(className);
3345
- return (React.createElement("div", { className: "flex items-center justify-center rounded-radius-md ".concat(allClasses) },
3346
- React.createElement(Text, { variant: "medium-text", extended: textClassName }, "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.")));
3365
+ return (React.createElement("div", { className: "flex items-center justify-center rounded-radius-md ".concat(allClasses) }, children));
3347
3366
  };
3348
3367
  InfoPanel.defaultProps = {
3349
3368
  variant: 'container',
3350
3369
  color: 'yellow',
3351
3370
  className: '',
3352
- textClassName: '',
3371
+ children: null,
3353
3372
  };
3354
3373
 
3355
3374
  function Modal(_a) {
@@ -3754,7 +3773,7 @@ var configTab = {
3754
3773
  };
3755
3774
 
3756
3775
  function Tab(_a) {
3757
- var children = _a.children, active = _a.active, icon = _a.icon, disabled = _a.disabled, _b = _a.mode, mode = _b === void 0 ? 'horizontal' : _b, _c = _a.fit, fit = _c === void 0 ? 'fit-content' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, rest = __rest(_a, ["children", "active", "icon", "disabled", "mode", "fit", "size"]);
3776
+ var children = _a.children, active = _a.active, icon = _a.icon, disabled = _a.disabled, _b = _a.mode, mode = _b === void 0 ? 'horizontal' : _b, _c = _a.fit, fit = _c === void 0 ? 'fit-content' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, className = _a.className, rest = __rest(_a, ["children", "active", "icon", "disabled", "mode", "fit", "size", "className"]);
3758
3777
  var disabledKeyTab = disabled || active ? ' pointer-events-none' : '';
3759
3778
  var cursor;
3760
3779
  if (disabled) {
@@ -3775,8 +3794,9 @@ function Tab(_a) {
3775
3794
  var activeKeyTab = active
3776
3795
  ? 'group-disabled:text-bia-coolgrey-disabled text-primary-black'
3777
3796
  : 'text-bia-coolgrey group-hover:text-bia-coolgrey-hover group-active:text-bia-coolgrey-active group-disabled:text-bia-coolgrey-disabled';
3797
+ var buttonClassName = "".concat(horizontalButtonStyle, " ").concat(disabledKeyTab, " ").concat(fit, " ").concat(className ? className : '');
3778
3798
  return (React.createElement("div", { className: "".concat(mode === 'horizontal' ? 'h-full' : 'w-full', " ").concat(cursor) },
3779
- React.createElement("button", __assign({ type: "button", disabled: disabled }, rest, { className: "flex items-stretch justify-between ".concat(horizontalButtonStyle, " group relative outline-none ").concat(disabledKeyTab, " ").concat(fit) }),
3799
+ React.createElement("button", __assign({ type: "button", className: "flex items-stretch justify-between group relative outline-none ".concat(buttonClassName), disabled: disabled }, rest),
3780
3800
  React.createElement("div", { className: "flex items-center justify-center ".concat(buttonContentStyle) },
3781
3801
  React.createElement("div", { className: "flex items-center justify-center " },
3782
3802
  React.createElement("div", { className: "flex items-center space-x-1 text-nowrap ".concat(activeKeyTab, " ").concat(configTab[size].text) },
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import TextInputProps from '../TextInput/PropsInterface';
3
3
  interface DateInputDisplayProps extends Omit<TextInputProps, 'value'> {
4
4
  value: string | null;
5
+ className: string;
5
6
  setValue?: (date: string | null) => void;
6
7
  placeholder?: string;
7
8
  label?: string;
@@ -9,6 +10,7 @@ interface DateInputDisplayProps extends Omit<TextInputProps, 'value'> {
9
10
  setIsActive?: () => void;
10
11
  buttonAction?: () => void;
11
12
  disabled: boolean;
13
+ nullDisplay?: string;
12
14
  }
13
- declare const DateInputDisplay: ({ value, setValue, placeholder, label, required, id, size, className, disabled, buttonAction, ...props }: DateInputDisplayProps) => React.JSX.Element;
15
+ declare const DateInputDisplay: ({ value, setValue, placeholder, label, required, id, size, className, disabled, buttonAction, nullDisplay, ...props }: DateInputDisplayProps) => React.JSX.Element;
14
16
  export default DateInputDisplay;
@@ -1,5 +1,6 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
2
  interface DatePickerProps extends Omit<HTMLAttributes<HTMLInputElement>, 'onChange' | 'value'> {
3
+ className: string;
3
4
  descText?: string;
4
5
  onChange?: (date: string) => void;
5
6
  required?: boolean;
@@ -10,6 +11,7 @@ interface DatePickerProps extends Omit<HTMLAttributes<HTMLInputElement>, 'onChan
10
11
  label?: string;
11
12
  minDate?: string;
12
13
  maxDate?: string;
14
+ nullDisplay?: string;
13
15
  }
14
- declare function DatePicker({ value, onChange, size, disabled, placeholder, label, minDate, maxDate, required, }: DatePickerProps): React.JSX.Element;
16
+ declare function DatePicker({ className, value, onChange, size, disabled, placeholder, label, minDate, maxDate, required, nullDisplay, }: DatePickerProps): React.JSX.Element;
15
17
  export default DatePicker;
@@ -9,7 +9,7 @@ export interface DropdownContainerProps extends ComponentPropsWithRef<'div'> {
9
9
  size?: 'sm' | 'md';
10
10
  zIndex?: number;
11
11
  anchorRef?: React.RefObject<HTMLElement>;
12
- onClickItem?: (event: React.MouseEvent<HTMLDivElement>, val: string | number) => void;
12
+ onClickItem?: (event: React.MouseEvent<HTMLDivElement>, val: string | number | object) => void;
13
13
  }
14
14
  declare const DropdownContainer: {
15
15
  (propsComp: DropdownContainerProps): React.JSX.Element | null;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import LiveSearchProps from '../PropsInterface';
3
- declare const LiveSearchExample: ({ ...props }: LiveSearchProps) => React.JSX.Element;
2
+ declare const LiveSearchExample: ({ children, ...props }: LiveSearchProps) => React.JSX.Element;
4
3
  export default LiveSearchExample;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { LiveSearchProps } from '../types';
3
+ declare function DeprecatedSimulation({ setValue, value, ...props }: LiveSearchProps): React.JSX.Element;
4
+ export default DeprecatedSimulation;
@@ -0,0 +1,9 @@
1
+ import { ChangeEvent, MouseEvent } from 'react';
2
+ import { LiveSearchHookProps } from '../types';
3
+ export declare const useLiveSearch: ({ value, setValue, onChangeText, dropContOnClickItem, }: LiveSearchHookProps) => {
4
+ isOpen: boolean;
5
+ setIsOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
6
+ searchTerm: string;
7
+ handleInputChange: (e: ChangeEvent<HTMLInputElement>) => void;
8
+ handleDropdownItemClick: (event: MouseEvent<HTMLDivElement>, clickedValue: any) => void;
9
+ };
@@ -1,10 +1,6 @@
1
1
  import React from 'react';
2
- import LiveSearchProps from './PropsInterface';
3
- export interface LiveSearchOption {
4
- id: string | number | null;
5
- label: string | number;
6
- }
7
- declare function LiveSearch({ descText, disabled, id, size, label, placeholder, required, options, setValue, value, readOnly, onChangeText, onClickDropdown, autoComplete, children, dropContProps, searchVariant, }: LiveSearchProps): React.JSX.Element;
2
+ import { LiveSearchProps } from './types';
3
+ declare function LiveSearch({ autoComplete, children, descText, disabled, dropContProps, id, label, onChangeText, onClickDropdown, options, placeholder, readOnly, required, searchVariant, setValue, size, value, }: LiveSearchProps): React.JSX.Element;
8
4
  declare namespace LiveSearch {
9
5
  var defaultProps: {
10
6
  descText: string;
@@ -0,0 +1,36 @@
1
+ import { ComponentPropsWithoutRef, MouseEvent, ChangeEvent, ReactNode } from 'react';
2
+ import { DropdownContainerProps } from '../../Dropdown/DropdownContainer';
3
+ export type SearchVariant = 'include' | 'startsWith' | 'endsWith';
4
+ export interface LiveSearchProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size' | 'value'> {
5
+ autoComplete?: string;
6
+ children?: ReactNode;
7
+ descText?: string;
8
+ disabled?: boolean;
9
+ dropContProps?: Omit<DropdownContainerProps, 'children'>;
10
+ id?: string;
11
+ label?: string;
12
+ onChangeText?: (e: ChangeEvent<HTMLInputElement>) => void;
13
+ onClickDropdown?: (event: MouseEvent<HTMLDivElement>) => void;
14
+ options?: any[];
15
+ placeholder?: string;
16
+ readOnly?: boolean;
17
+ required?: boolean;
18
+ searchVariant?: SearchVariant;
19
+ setValue: (value: any) => void;
20
+ size?: 'md' | 'sm';
21
+ value: any;
22
+ }
23
+ export interface LiveSearchHookProps {
24
+ value: any;
25
+ setValue: (value: any) => void;
26
+ onChangeText?: (e: ChangeEvent<HTMLInputElement>) => void;
27
+ dropContOnClickItem?: (event: MouseEvent<HTMLDivElement>, value: any) => void;
28
+ searchVariant?: SearchVariant;
29
+ }
30
+ export interface DropdownItemProps {
31
+ content: string | ReactNode;
32
+ value?: any;
33
+ disabled?: boolean;
34
+ onClickItem?: (event: MouseEvent<HTMLDivElement>, value: any) => void;
35
+ children?: ReactNode;
36
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { SearchVariant } from '../types';
3
+ export declare const getItemLabel: (value: any) => string;
4
+ export declare const processDropdownChildren: (nodes: React.ReactNode, currentSearchTerm: string, includeAllIfNoSearch: boolean, searchVariant: SearchVariant | undefined, handleDropdownItemClick: (e: React.MouseEvent<HTMLDivElement>, value: any) => void) => React.ReactNode;
5
+ export declare const processRenderedChildren: (children: React.ReactNode | undefined, searchTerm: string, searchVariant: SearchVariant, handleDropdownItemClick: (e: React.MouseEvent<HTMLDivElement>, value: any) => void) => {
6
+ renderedChildren: React.ReactNode;
7
+ hasFilteredResults: boolean;
8
+ };
@@ -0,0 +1,3 @@
1
+ import { SearchVariant } from '../types';
2
+ export declare const matchSearchTerm: (content: string, term: string, variant: SearchVariant) => boolean;
3
+ export declare const filterOptions: (options: any[], searchTerm: string) => any[];
@@ -3,15 +3,15 @@ interface InfoPanelProps {
3
3
  variant?: 'container' | 'form-sm' | 'form-md';
4
4
  color?: 'yellow' | 'blue' | 'grey' | 'white';
5
5
  className?: string;
6
- textClassName?: string;
6
+ children: React.ReactNode;
7
7
  }
8
8
  declare const InfoPanel: {
9
- ({ variant, color, className, textClassName, }: InfoPanelProps): React.JSX.Element;
9
+ ({ variant, color, className, children, }: InfoPanelProps): React.JSX.Element;
10
10
  defaultProps: {
11
11
  variant: string;
12
12
  color: string;
13
13
  className: string;
14
- textClassName: string;
14
+ children: null;
15
15
  };
16
16
  };
17
17
  export default InfoPanel;
@@ -6,5 +6,6 @@ export interface TabProps extends ComponentPropsWithoutRef<'button'> {
6
6
  mode?: 'horizontal' | 'vertical';
7
7
  fit?: 'fit-content' | 'maximize';
8
8
  size?: 'md' | 'sm';
9
+ className?: string;
9
10
  }
10
- export default function Tab({ children, active, icon, disabled, mode, fit, size, ...rest }: TabProps): React.JSX.Element;
11
+ export default function Tab({ children, active, icon, disabled, mode, fit, size, className, ...rest }: TabProps): React.JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import type { StoryObj } from '@storybook/react';
2
- import LiveSearchSimulation from '../../../components/Forms/LiveSearch/Simulation';
2
+ import DeprecatedSimulation from '../../../components/Forms/LiveSearch/Example/DeprecatedSimulation';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: typeof LiveSearchSimulation;
5
+ component: typeof DeprecatedSimulation;
6
6
  parameters: {
7
7
  layout: string;
8
8
  };
@@ -1,12 +1,13 @@
1
- /// <reference types="react" />
2
1
  import { StoryObj } from "@storybook/react/*";
2
+ import React from "react";
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ ...props }: import("../../../components/Forms/LiveSearch/PropsInterface").default) => import("react").JSX.Element;
5
+ component: ({ children, ...props }: LiveSearchProps) => React.JSX.Element;
6
6
  parameters: {
7
7
  layout: string;
8
8
  };
9
9
  };
10
10
  export default meta;
11
11
  type Story = StoryObj<typeof meta>;
12
- export declare const Example: Story;
12
+ export declare const BasicExample: Story;
13
+ export declare const ObjectOptionsExample: Story;
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, forwardRef, useRef, cloneElement, Children, useLayoutEffect, useCallback, isValidElement } from 'react';
1
+ import React, { useState, useEffect, forwardRef, useRef, cloneElement, Children, useLayoutEffect, isValidElement, useCallback } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
 
4
4
  function Accordions(_a) {
@@ -2518,111 +2518,129 @@ var matchSearchTerm = function (content, term, variant) {
2518
2518
  return lowerContent.includes(lowerTerm);
2519
2519
  }
2520
2520
  };
2521
- function LiveSearch(_a) {
2522
- var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, placeholder = _a.placeholder, _d = _a.required, required = _d === void 0 ? false : _d, options = _a.options, setValue = _a.setValue, value = _a.value, _e = _a.readOnly, readOnly = _e === void 0 ? false : _e, _f = _a.onChangeText, onChangeText = _f === void 0 ? function () { } : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, _h = _a.autoComplete, autoComplete = _h === void 0 ? 'off' : _h, _j = _a.children, children = _j === void 0 ? undefined : _j, _k = _a.dropContProps, dropContProps = _k === void 0 ? { className: undefined } : _k, _l = _a.searchVariant, searchVariant = _l === void 0 ? 'include' : _l;
2523
- var _m = useState(false), isOpen = _m[0], setIsOpen = _m[1];
2524
- var _o = useState(value.label || ''), searchTerm = _o[0], setSearchTerm = _o[1];
2525
- var _p = sizeConfig$6[size], iconClass = _p.iconClass, iconSize = _p.iconSize, inputClass = _p.inputClass;
2526
- var dropContClassName = dropContProps.className, dropContOnClickItem = dropContProps.onClickItem, restDropContProps = __rest(dropContProps, ["className", "onClickItem"]);
2527
- var isValueExist = value && value.label !== undefined && value.label !== '';
2528
- var inputRef = useRef(null);
2529
- var dropdownContRef = useRef(null);
2530
- // Will be used soon
2531
- // const handleOutsideClick = (e: MouseEvent) => {
2532
- // if (inputRef.current && !inputRef.current.contains(e.target as Node)) {
2533
- // setIsOpen(false)
2534
- // }
2535
- // }
2536
- // useEffect(() => {
2537
- // document.addEventListener('mousedown', handleOutsideClick)
2538
- // return () => {
2539
- // document.removeEventListener('mousedown', handleOutsideClick)
2540
- // }
2541
- // })
2542
- // Synchronize internal searchTerm with external value prop
2543
- useEffect(function () {
2544
- // Only update searchTerm if the label from the value prop differs from the current searchTerm
2545
- // This prevents infinite loops if searchTerm is already the same as value.label
2546
- if (value.label !== searchTerm) {
2547
- setSearchTerm(value.label || '');
2548
- }
2549
- }, [value.label, searchTerm]);
2550
- var filteredOptions = options === null || options === void 0 ? void 0 : options.filter(function (item) {
2551
- return item.label.toLowerCase().includes(value.label.toLowerCase());
2521
+ var filterOptions = function (options, searchTerm) {
2522
+ return options === null || options === void 0 ? void 0 : options.filter(function (item) {
2523
+ return item.label.toLowerCase().includes(searchTerm.toLowerCase());
2552
2524
  });
2553
- var handleInputChange = function (e) {
2554
- var newSearchTerm = e.target.value;
2555
- setSearchTerm(newSearchTerm);
2556
- setIsOpen(true); // Ensure dropdown opens when typing
2557
- };
2558
- var handleDropdownItemClick = useCallback(function (clickedValue) {
2559
- setSearchTerm(clickedValue.label); // Set input text to the selected label
2560
- setValue(clickedValue); // Update the value in the parent
2561
- setIsOpen(false);
2562
- }, [setValue]);
2563
- // Recursive function to filter and clone DropdownItems, including nested items
2564
- var processDropdownChildren = function (nodes, currentSearchTerm, includeAllIfNoSearch) {
2565
- return Children.map(nodes, function (child) {
2566
- if (!isValidElement(child) || child.type !== DropdownItem) {
2567
- return child;
2568
- }
2569
- var itemProps = child.props;
2570
- // Assume content is a string for filtering; otherwise, filtering won't work well
2571
- var itemContent = typeof itemProps.content === 'string' ? itemProps.content : '';
2572
- var itemValue = itemProps.value;
2573
- var isDisabled = itemProps.disabled;
2574
- // 2. Filtering Logic (Uses Global Search Variant)
2575
- if (!includeAllIfNoSearch) {
2576
- // Use the matchSearchTerm utility with the selected searchVariant
2577
- if (currentSearchTerm && !matchSearchTerm(itemValue, currentSearchTerm, searchVariant)) {
2578
- return null; // Item does not match the search criteria
2579
- }
2525
+ };
2526
+
2527
+ var getItemLabel = function (value) {
2528
+ var _a;
2529
+ return typeof value === 'object' && value !== null && 'label' in value
2530
+ ? (_a = value.label) !== null && _a !== void 0 ? _a : ''
2531
+ : String(value !== null && value !== void 0 ? value : '');
2532
+ };
2533
+ var processDropdownChildren = function (nodes, currentSearchTerm, includeAllIfNoSearch, searchVariant, handleDropdownItemClick) {
2534
+ if (searchVariant === void 0) { searchVariant = 'include'; }
2535
+ return Children.map(nodes, function (child) {
2536
+ if (!isValidElement(child) || child.type !== DropdownItem) {
2537
+ return child;
2538
+ }
2539
+ var itemProps = child.props;
2540
+ var itemContent = typeof itemProps.content === 'string' ? itemProps.content : '';
2541
+ var itemValue = itemProps.value;
2542
+ var isDisabled = itemProps.disabled;
2543
+ // Filtering Logic
2544
+ if (!includeAllIfNoSearch) {
2545
+ var itemValueStr = typeof itemValue === 'object'
2546
+ ? itemValue.label
2547
+ : String(itemValue || '');
2548
+ if (currentSearchTerm &&
2549
+ !matchSearchTerm(itemValueStr, currentSearchTerm, searchVariant)) {
2550
+ return null;
2580
2551
  }
2581
- // 3. Process Nested Children (Recursion)
2582
- var clonedChildren = itemProps.children
2583
- ? processDropdownChildren(itemProps.children, currentSearchTerm, includeAllIfNoSearch)
2584
- : null;
2585
- // 4. Clone and Inject Click Handler
2586
- return cloneElement(child, {
2587
- onClick: function (e) {
2588
- if (!isDisabled) {
2589
- handleDropdownItemClick({
2590
- id: itemValue !== undefined ? itemValue : itemContent,
2591
- label: itemValue !== undefined ? itemValue : itemContent
2592
- });
2593
- }
2594
- if (dropContOnClickItem) {
2595
- dropContOnClickItem(e, itemValue !== undefined ? itemValue : itemContent);
2552
+ }
2553
+ // Process Nested Children
2554
+ var clonedChildren = itemProps.children
2555
+ ? processDropdownChildren(itemProps.children, currentSearchTerm, includeAllIfNoSearch, searchVariant, handleDropdownItemClick)
2556
+ : null;
2557
+ // Clone and Inject Click Handler
2558
+ return cloneElement(child, {
2559
+ onClick: function (e) {
2560
+ if (!isDisabled) {
2561
+ if (itemValue === undefined &&
2562
+ typeof itemProps.content === 'string') {
2563
+ return handleDropdownItemClick(e, itemContent);
2596
2564
  }
2597
- if (itemProps.onClickItem) {
2598
- itemProps.onClickItem(e, itemValue !== undefined ? itemValue : itemContent);
2565
+ if (typeof itemValue === 'object' || itemValue !== undefined) {
2566
+ return handleDropdownItemClick(e, itemValue);
2599
2567
  }
2600
- },
2601
- children: clonedChildren
2602
- });
2568
+ }
2569
+ if (itemProps.onClickItem) {
2570
+ itemProps.onClickItem(e, itemValue !== undefined ? itemValue : itemContent);
2571
+ }
2572
+ },
2573
+ children: clonedChildren,
2603
2574
  });
2604
- };
2605
- // Determine which children to display
2575
+ });
2576
+ };
2577
+ var processRenderedChildren = function (children, searchTerm, searchVariant, handleDropdownItemClick) {
2606
2578
  var renderedChildren = null;
2607
2579
  var hasFilteredResults = false;
2608
2580
  if (searchTerm) {
2609
- // If there's a searchTerm, filter children
2610
- renderedChildren = processDropdownChildren(children, searchTerm, false);
2581
+ renderedChildren = processDropdownChildren(children, searchTerm, false, searchVariant, handleDropdownItemClick);
2611
2582
  hasFilteredResults =
2612
2583
  Children.toArray(renderedChildren).filter(Boolean).length > 0;
2613
2584
  }
2614
2585
  else {
2615
- // If searchTerm is empty, display all children without filtering (but with onClick injected)
2616
- renderedChildren = processDropdownChildren(children, '', true);
2586
+ renderedChildren = processDropdownChildren(children, '', true, searchVariant, handleDropdownItemClick);
2617
2587
  hasFilteredResults =
2618
- Children.toArray(renderedChildren).filter(Boolean).length > 0; // Should always be true if there are initial children
2588
+ Children.toArray(renderedChildren).filter(Boolean).length > 0;
2619
2589
  }
2590
+ return { renderedChildren: renderedChildren, hasFilteredResults: hasFilteredResults };
2591
+ };
2592
+
2593
+ var useLiveSearch = function (_a) {
2594
+ var value = _a.value, setValue = _a.setValue, onChangeText = _a.onChangeText, dropContOnClickItem = _a.dropContOnClickItem;
2595
+ var _b = useState(false), isOpen = _b[0], setIsOpen = _b[1];
2596
+ var _c = useState(String(value.label || '')), searchTerm = _c[0], setSearchTerm = _c[1];
2597
+ useEffect(function () {
2598
+ if (!isOpen && searchTerm !== '') {
2599
+ setSearchTerm(getItemLabel(value));
2600
+ }
2601
+ }, [isOpen]);
2602
+ var handleInputChange = function (e) {
2603
+ var newSearchTerm = e.target.value;
2604
+ setSearchTerm(newSearchTerm);
2605
+ setIsOpen(true);
2606
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(e);
2607
+ };
2608
+ var handleDropdownItemClick = useCallback(function (event, clickedValue) {
2609
+ dropContOnClickItem === null || dropContOnClickItem === void 0 ? void 0 : dropContOnClickItem(event, clickedValue);
2610
+ var newLabel = getItemLabel(clickedValue);
2611
+ setSearchTerm(newLabel);
2612
+ setValue(clickedValue);
2613
+ setIsOpen(false);
2614
+ }, [setValue, dropContOnClickItem]);
2615
+ return {
2616
+ isOpen: isOpen,
2617
+ setIsOpen: setIsOpen,
2618
+ searchTerm: searchTerm,
2619
+ handleInputChange: handleInputChange,
2620
+ handleDropdownItemClick: handleDropdownItemClick,
2621
+ };
2622
+ };
2623
+
2624
+ function LiveSearch(_a) {
2625
+ var _b = _a.autoComplete, autoComplete = _b === void 0 ? 'off' : _b, _c = _a.children, children = _c === void 0 ? undefined : _c, descText = _a.descText, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.dropContProps, dropContProps = _e === void 0 ? { className: undefined } : _e, id = _a.id, label = _a.label, _f = _a.onChangeText, onChangeText = _f === void 0 ? function () { } : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, options = _a.options, placeholder = _a.placeholder, _h = _a.readOnly, readOnly = _h === void 0 ? false : _h, _j = _a.required, required = _j === void 0 ? false : _j, _k = _a.searchVariant, searchVariant = _k === void 0 ? 'include' : _k, setValue = _a.setValue, _l = _a.size, size = _l === void 0 ? 'md' : _l, value = _a.value;
2626
+ var inputRef = useRef(null);
2627
+ var dropdownContRef = useRef(null);
2628
+ var _m = useLiveSearch({
2629
+ value: value,
2630
+ setValue: setValue,
2631
+ onChangeText: onChangeText,
2632
+ dropContOnClickItem: dropContProps.onClickItem
2633
+ }), isOpen = _m.isOpen, setIsOpen = _m.setIsOpen, searchTerm = _m.searchTerm, handleInputChange = _m.handleInputChange, handleDropdownItemClick = _m.handleDropdownItemClick;
2634
+ var _o = sizeConfig$6[size], iconClass = _o.iconClass, iconSize = _o.iconSize, inputClass = _o.inputClass;
2635
+ var dropContClassName = dropContProps.className; dropContProps.onClickItem; var restDropContProps = __rest(dropContProps, ["className", "onClickItem"]);
2636
+ var isValueExist = value && value.label !== undefined && value.label !== '';
2637
+ var filteredOptions = filterOptions(options || [], value.label);
2638
+ var _p = processRenderedChildren(children, searchTerm, searchVariant, handleDropdownItemClick), renderedChildren = _p.renderedChildren, hasFilteredResults = _p.hasFilteredResults;
2620
2639
  return (React.createElement("div", { className: "bianic-livesearch field-group group/form flex w-full flex-col gap-y-2 " },
2621
2640
  label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
2622
2641
  React.createElement("div", { className: "group relative w-full" },
2623
2642
  React.createElement("input", { className: "bianic-livesearch-input field peer w-full rounded border border-bia-grey-dark-10 bg-primary-white read-only:pointer-events-none read-only:border-bia-grey-disabled focus-visible:outline-none enabled:hover:rounded-b-none enabled:hover:border-b-bia-blue enabled:focus:rounded-b-none enabled:focus:border-b-bia-blue disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-10 disabled:text-bia-coolgrey ".concat(inputClass), onClick: function () { return setIsOpen(!isOpen); }, value: searchTerm, required: required, disabled: disabled, id: id, placeholder: placeholder, ref: inputRef, onChange: function (e) {
2624
2643
  onChangeText(e);
2625
- setValue({ id: null, label: e.target.value });
2626
2644
  handleInputChange(e);
2627
2645
  }, type: "text", readOnly: readOnly, autoComplete: autoComplete }),
2628
2646
  React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconClass) },
@@ -3068,7 +3086,7 @@ var monthMap = [
3068
3086
  'December',
3069
3087
  ];
3070
3088
  var DateInputDisplay = function (_a) {
3071
- var value = _a.value, setValue = _a.setValue, _b = _a.placeholder, placeholder = _b === void 0 ? 'YYYY-MM-DD' : _b, label = _a.label, required = _a.required, id = _a.id, _c = _a.size, size = _c === void 0 ? 'sm' : _c, className = _a.className, _d = _a.disabled, disabled = _d === void 0 ? false : _d, buttonAction = _a.buttonAction, props = __rest(_a, ["value", "setValue", "placeholder", "label", "required", "id", "size", "className", "disabled", "buttonAction"]);
3089
+ var value = _a.value, setValue = _a.setValue, _b = _a.placeholder, placeholder = _b === void 0 ? 'YYYY-MM-DD' : _b, label = _a.label, required = _a.required, id = _a.id, _c = _a.size, size = _c === void 0 ? 'sm' : _c, className = _a.className, _d = _a.disabled, disabled = _d === void 0 ? false : _d, buttonAction = _a.buttonAction, nullDisplay = _a.nullDisplay, props = __rest(_a, ["value", "setValue", "placeholder", "label", "required", "id", "size", "className", "disabled", "buttonAction", "nullDisplay"]);
3072
3090
  var _e = useState(false), isEditing = _e[0], setIsEditing = _e[1];
3073
3091
  var _f = useState(value), dateString = _f[0], setDateString = _f[1];
3074
3092
  var _g = styleConfig['text'], fieldStyle = _g.fieldStyle;
@@ -3097,11 +3115,13 @@ var DateInputDisplay = function (_a) {
3097
3115
  setIsEditing(false);
3098
3116
  setDateString(value);
3099
3117
  };
3100
- var input = isEditing ? (React.createElement(TextInput, { type: "text", value: dateString !== null && dateString !== void 0 ? dateString : '', onChange: handleTextChange, onBlur: handleBlur, placeholder: placeholder, size: size, autoFocus: true, actionElement: React.createElement("button", { className: "bianic-datepicker-toggle-button text-bia-coolgrey", disabled: disabled, onClick: function () {
3118
+ var input = isEditing ? (React.createElement(TextInput, { type: "text", value: dateString !== null && dateString !== void 0 ? dateString : '', onChange: handleTextChange, onBlur: handleBlur, placeholder: placeholder, size: size, inputClassName: className, autoFocus: true, actionElement: React.createElement("button", { className: "bianic-datepicker-toggle-button text-bia-coolgrey", disabled: disabled, onClick: function () {
3101
3119
  buttonAction && buttonAction();
3102
3120
  } },
3103
3121
  React.createElement(TbCalendar, { size: iconSize })) })) : (React.createElement(React.Fragment, null,
3104
- React.createElement("div", { role: "button", onClick: function () { return setIsEditing(true); }, className: "bianic-text-input bianic-fgc-target w-full min-w-[185px] rounded hover:rounded-b-none hover:border-b-bia-blue focus:rounded-b-none focus-visible:outline-none disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(extendedInputClassName, " ").concat(value ? 'text-bia-black' : 'text-bia-coolgrey') }, value ? displayDateFormatter(new Date(value)) : placeholder),
3122
+ React.createElement("div", { role: "button", onClick: function () { return setIsEditing(true); }, className: "bianic-text-input bianic-fgc-target w-full min-w-[185px] rounded hover:rounded-b-none hover:border-b-bia-blue focus:rounded-b-none focus-visible:outline-none disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(extendedInputClassName, " ").concat(value || nullDisplay ? 'text-bia-black' : 'text-bia-coolgrey', " ").concat(className) }, value
3123
+ ? displayDateFormatter(new Date(value))
3124
+ : nullDisplay || placeholder),
3105
3125
  React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 text-bia-coolgrey ".concat(iconPosition) },
3106
3126
  React.createElement("button", { className: "bianic-datepicker-toggle-button", disabled: disabled, onClick: function () { return buttonAction && buttonAction(); } },
3107
3127
  React.createElement(TbCalendar, { size: iconSize })))));
@@ -3130,7 +3150,7 @@ var displayDateFormatter = function (date) {
3130
3150
  };
3131
3151
 
3132
3152
  function DatePicker(_a) {
3133
- var value = _a.value, onChange = _a.onChange, size = _a.size, disabled = _a.disabled; _a.placeholder; var label = _a.label, minDate = _a.minDate, maxDate = _a.maxDate, required = _a.required;
3153
+ var className = _a.className, value = _a.value, onChange = _a.onChange, size = _a.size, disabled = _a.disabled; _a.placeholder; var label = _a.label, minDate = _a.minDate, maxDate = _a.maxDate, required = _a.required, nullDisplay = _a.nullDisplay;
3134
3154
  // State and Ref
3135
3155
  var inputRef = useRef(null);
3136
3156
  var wrapperRef = useRef(null);
@@ -3138,7 +3158,7 @@ function DatePicker(_a) {
3138
3158
  var _c = useDetectOutsideClick(wrapperRef, false, pickerRef), isPickerOpen = _c[0], setIsPickerOpen = _c[1];
3139
3159
  return (React.createElement("div", { className: "bianic-datepicker-container relative", ref: wrapperRef },
3140
3160
  React.createElement("div", { className: "bianic-datepicker-field-container" },
3141
- React.createElement(DateInputDisplay, { value: value, setValue: onChange, placeholder: "YYYY-MM-DD", size: size, label: label, required: required, buttonAction: function () { return setIsPickerOpen(!isPickerOpen); }, ref: inputRef, disabled: disabled })),
3161
+ React.createElement(DateInputDisplay, { inputClassName: className, value: value, setValue: onChange, placeholder: "YYYY-MM-DD", nullDisplay: nullDisplay, size: size, label: label, required: required, buttonAction: function () { return setIsPickerOpen(!isPickerOpen); }, ref: inputRef, disabled: disabled })),
3142
3162
  isPickerOpen && (React.createElement("div", { className: "bianic-datepicker-calendar-container absolute left-0 w-[250px] rounded-b-radius-sm bg-bia-white px-1.5 pb-[17px] pt-[15px] shadow-md" },
3143
3163
  React.createElement(PickerCalendar, { selectedDate: value, onDateChange: onChange, ref: pickerRef, minDate: minDate, maxDate: maxDate })))));
3144
3164
  }
@@ -3336,18 +3356,17 @@ var sizeConfig$3 = {
3336
3356
  };
3337
3357
 
3338
3358
  var InfoPanel = function (_a) {
3339
- var variant = _a.variant, color = _a.color, className = _a.className, textClassName = _a.textClassName;
3359
+ var variant = _a.variant, color = _a.color, className = _a.className, children = _a.children;
3340
3360
  var sizeClass = sizeConfig$3[variant || 'container'];
3341
3361
  var colorClass = colorConfig$1[color || 'yellow'];
3342
3362
  var allClasses = "".concat(sizeClass, " ").concat(colorClass, " ").concat(className);
3343
- return (React.createElement("div", { className: "flex items-center justify-center rounded-radius-md ".concat(allClasses) },
3344
- React.createElement(Text, { variant: "medium-text", extended: textClassName }, "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.")));
3363
+ return (React.createElement("div", { className: "flex items-center justify-center rounded-radius-md ".concat(allClasses) }, children));
3345
3364
  };
3346
3365
  InfoPanel.defaultProps = {
3347
3366
  variant: 'container',
3348
3367
  color: 'yellow',
3349
3368
  className: '',
3350
- textClassName: '',
3369
+ children: null,
3351
3370
  };
3352
3371
 
3353
3372
  function Modal(_a) {
@@ -3752,7 +3771,7 @@ var configTab = {
3752
3771
  };
3753
3772
 
3754
3773
  function Tab(_a) {
3755
- var children = _a.children, active = _a.active, icon = _a.icon, disabled = _a.disabled, _b = _a.mode, mode = _b === void 0 ? 'horizontal' : _b, _c = _a.fit, fit = _c === void 0 ? 'fit-content' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, rest = __rest(_a, ["children", "active", "icon", "disabled", "mode", "fit", "size"]);
3774
+ var children = _a.children, active = _a.active, icon = _a.icon, disabled = _a.disabled, _b = _a.mode, mode = _b === void 0 ? 'horizontal' : _b, _c = _a.fit, fit = _c === void 0 ? 'fit-content' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, className = _a.className, rest = __rest(_a, ["children", "active", "icon", "disabled", "mode", "fit", "size", "className"]);
3756
3775
  var disabledKeyTab = disabled || active ? ' pointer-events-none' : '';
3757
3776
  var cursor;
3758
3777
  if (disabled) {
@@ -3773,8 +3792,9 @@ function Tab(_a) {
3773
3792
  var activeKeyTab = active
3774
3793
  ? 'group-disabled:text-bia-coolgrey-disabled text-primary-black'
3775
3794
  : 'text-bia-coolgrey group-hover:text-bia-coolgrey-hover group-active:text-bia-coolgrey-active group-disabled:text-bia-coolgrey-disabled';
3795
+ var buttonClassName = "".concat(horizontalButtonStyle, " ").concat(disabledKeyTab, " ").concat(fit, " ").concat(className ? className : '');
3776
3796
  return (React.createElement("div", { className: "".concat(mode === 'horizontal' ? 'h-full' : 'w-full', " ").concat(cursor) },
3777
- React.createElement("button", __assign({ type: "button", disabled: disabled }, rest, { className: "flex items-stretch justify-between ".concat(horizontalButtonStyle, " group relative outline-none ").concat(disabledKeyTab, " ").concat(fit) }),
3797
+ React.createElement("button", __assign({ type: "button", className: "flex items-stretch justify-between group relative outline-none ".concat(buttonClassName), disabled: disabled }, rest),
3778
3798
  React.createElement("div", { className: "flex items-center justify-center ".concat(buttonContentStyle) },
3779
3799
  React.createElement("div", { className: "flex items-center justify-center " },
3780
3800
  React.createElement("div", { className: "flex items-center space-x-1 text-nowrap ".concat(activeKeyTab, " ").concat(configTab[size].text) },
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import TextInputProps from '../TextInput/PropsInterface';
3
3
  interface DateInputDisplayProps extends Omit<TextInputProps, 'value'> {
4
4
  value: string | null;
5
+ className: string;
5
6
  setValue?: (date: string | null) => void;
6
7
  placeholder?: string;
7
8
  label?: string;
@@ -9,6 +10,7 @@ interface DateInputDisplayProps extends Omit<TextInputProps, 'value'> {
9
10
  setIsActive?: () => void;
10
11
  buttonAction?: () => void;
11
12
  disabled: boolean;
13
+ nullDisplay?: string;
12
14
  }
13
- declare const DateInputDisplay: ({ value, setValue, placeholder, label, required, id, size, className, disabled, buttonAction, ...props }: DateInputDisplayProps) => React.JSX.Element;
15
+ declare const DateInputDisplay: ({ value, setValue, placeholder, label, required, id, size, className, disabled, buttonAction, nullDisplay, ...props }: DateInputDisplayProps) => React.JSX.Element;
14
16
  export default DateInputDisplay;
@@ -1,5 +1,6 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
2
  interface DatePickerProps extends Omit<HTMLAttributes<HTMLInputElement>, 'onChange' | 'value'> {
3
+ className: string;
3
4
  descText?: string;
4
5
  onChange?: (date: string) => void;
5
6
  required?: boolean;
@@ -10,6 +11,7 @@ interface DatePickerProps extends Omit<HTMLAttributes<HTMLInputElement>, 'onChan
10
11
  label?: string;
11
12
  minDate?: string;
12
13
  maxDate?: string;
14
+ nullDisplay?: string;
13
15
  }
14
- declare function DatePicker({ value, onChange, size, disabled, placeholder, label, minDate, maxDate, required, }: DatePickerProps): React.JSX.Element;
16
+ declare function DatePicker({ className, value, onChange, size, disabled, placeholder, label, minDate, maxDate, required, nullDisplay, }: DatePickerProps): React.JSX.Element;
15
17
  export default DatePicker;
@@ -9,7 +9,7 @@ export interface DropdownContainerProps extends ComponentPropsWithRef<'div'> {
9
9
  size?: 'sm' | 'md';
10
10
  zIndex?: number;
11
11
  anchorRef?: React.RefObject<HTMLElement>;
12
- onClickItem?: (event: React.MouseEvent<HTMLDivElement>, val: string | number) => void;
12
+ onClickItem?: (event: React.MouseEvent<HTMLDivElement>, val: string | number | object) => void;
13
13
  }
14
14
  declare const DropdownContainer: {
15
15
  (propsComp: DropdownContainerProps): React.JSX.Element | null;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import LiveSearchProps from '../PropsInterface';
3
- declare const LiveSearchExample: ({ ...props }: LiveSearchProps) => React.JSX.Element;
2
+ declare const LiveSearchExample: ({ children, ...props }: LiveSearchProps) => React.JSX.Element;
4
3
  export default LiveSearchExample;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { LiveSearchProps } from '../types';
3
+ declare function DeprecatedSimulation({ setValue, value, ...props }: LiveSearchProps): React.JSX.Element;
4
+ export default DeprecatedSimulation;
@@ -0,0 +1,9 @@
1
+ import { ChangeEvent, MouseEvent } from 'react';
2
+ import { LiveSearchHookProps } from '../types';
3
+ export declare const useLiveSearch: ({ value, setValue, onChangeText, dropContOnClickItem, }: LiveSearchHookProps) => {
4
+ isOpen: boolean;
5
+ setIsOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
6
+ searchTerm: string;
7
+ handleInputChange: (e: ChangeEvent<HTMLInputElement>) => void;
8
+ handleDropdownItemClick: (event: MouseEvent<HTMLDivElement>, clickedValue: any) => void;
9
+ };
@@ -1,10 +1,6 @@
1
1
  import React from 'react';
2
- import LiveSearchProps from './PropsInterface';
3
- export interface LiveSearchOption {
4
- id: string | number | null;
5
- label: string | number;
6
- }
7
- declare function LiveSearch({ descText, disabled, id, size, label, placeholder, required, options, setValue, value, readOnly, onChangeText, onClickDropdown, autoComplete, children, dropContProps, searchVariant, }: LiveSearchProps): React.JSX.Element;
2
+ import { LiveSearchProps } from './types';
3
+ declare function LiveSearch({ autoComplete, children, descText, disabled, dropContProps, id, label, onChangeText, onClickDropdown, options, placeholder, readOnly, required, searchVariant, setValue, size, value, }: LiveSearchProps): React.JSX.Element;
8
4
  declare namespace LiveSearch {
9
5
  var defaultProps: {
10
6
  descText: string;
@@ -0,0 +1,36 @@
1
+ import { ComponentPropsWithoutRef, MouseEvent, ChangeEvent, ReactNode } from 'react';
2
+ import { DropdownContainerProps } from '../../Dropdown/DropdownContainer';
3
+ export type SearchVariant = 'include' | 'startsWith' | 'endsWith';
4
+ export interface LiveSearchProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size' | 'value'> {
5
+ autoComplete?: string;
6
+ children?: ReactNode;
7
+ descText?: string;
8
+ disabled?: boolean;
9
+ dropContProps?: Omit<DropdownContainerProps, 'children'>;
10
+ id?: string;
11
+ label?: string;
12
+ onChangeText?: (e: ChangeEvent<HTMLInputElement>) => void;
13
+ onClickDropdown?: (event: MouseEvent<HTMLDivElement>) => void;
14
+ options?: any[];
15
+ placeholder?: string;
16
+ readOnly?: boolean;
17
+ required?: boolean;
18
+ searchVariant?: SearchVariant;
19
+ setValue: (value: any) => void;
20
+ size?: 'md' | 'sm';
21
+ value: any;
22
+ }
23
+ export interface LiveSearchHookProps {
24
+ value: any;
25
+ setValue: (value: any) => void;
26
+ onChangeText?: (e: ChangeEvent<HTMLInputElement>) => void;
27
+ dropContOnClickItem?: (event: MouseEvent<HTMLDivElement>, value: any) => void;
28
+ searchVariant?: SearchVariant;
29
+ }
30
+ export interface DropdownItemProps {
31
+ content: string | ReactNode;
32
+ value?: any;
33
+ disabled?: boolean;
34
+ onClickItem?: (event: MouseEvent<HTMLDivElement>, value: any) => void;
35
+ children?: ReactNode;
36
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { SearchVariant } from '../types';
3
+ export declare const getItemLabel: (value: any) => string;
4
+ export declare const processDropdownChildren: (nodes: React.ReactNode, currentSearchTerm: string, includeAllIfNoSearch: boolean, searchVariant: SearchVariant | undefined, handleDropdownItemClick: (e: React.MouseEvent<HTMLDivElement>, value: any) => void) => React.ReactNode;
5
+ export declare const processRenderedChildren: (children: React.ReactNode | undefined, searchTerm: string, searchVariant: SearchVariant, handleDropdownItemClick: (e: React.MouseEvent<HTMLDivElement>, value: any) => void) => {
6
+ renderedChildren: React.ReactNode;
7
+ hasFilteredResults: boolean;
8
+ };
@@ -0,0 +1,3 @@
1
+ import { SearchVariant } from '../types';
2
+ export declare const matchSearchTerm: (content: string, term: string, variant: SearchVariant) => boolean;
3
+ export declare const filterOptions: (options: any[], searchTerm: string) => any[];
@@ -3,15 +3,15 @@ interface InfoPanelProps {
3
3
  variant?: 'container' | 'form-sm' | 'form-md';
4
4
  color?: 'yellow' | 'blue' | 'grey' | 'white';
5
5
  className?: string;
6
- textClassName?: string;
6
+ children: React.ReactNode;
7
7
  }
8
8
  declare const InfoPanel: {
9
- ({ variant, color, className, textClassName, }: InfoPanelProps): React.JSX.Element;
9
+ ({ variant, color, className, children, }: InfoPanelProps): React.JSX.Element;
10
10
  defaultProps: {
11
11
  variant: string;
12
12
  color: string;
13
13
  className: string;
14
- textClassName: string;
14
+ children: null;
15
15
  };
16
16
  };
17
17
  export default InfoPanel;
@@ -6,5 +6,6 @@ export interface TabProps extends ComponentPropsWithoutRef<'button'> {
6
6
  mode?: 'horizontal' | 'vertical';
7
7
  fit?: 'fit-content' | 'maximize';
8
8
  size?: 'md' | 'sm';
9
+ className?: string;
9
10
  }
10
- export default function Tab({ children, active, icon, disabled, mode, fit, size, ...rest }: TabProps): React.JSX.Element;
11
+ export default function Tab({ children, active, icon, disabled, mode, fit, size, className, ...rest }: TabProps): React.JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import type { StoryObj } from '@storybook/react';
2
- import LiveSearchSimulation from '../../../components/Forms/LiveSearch/Simulation';
2
+ import DeprecatedSimulation from '../../../components/Forms/LiveSearch/Example/DeprecatedSimulation';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: typeof LiveSearchSimulation;
5
+ component: typeof DeprecatedSimulation;
6
6
  parameters: {
7
7
  layout: string;
8
8
  };
@@ -1,12 +1,13 @@
1
- /// <reference types="react" />
2
1
  import { StoryObj } from "@storybook/react/*";
2
+ import React from "react";
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ ...props }: import("../../../components/Forms/LiveSearch/PropsInterface").default) => import("react").JSX.Element;
5
+ component: ({ children, ...props }: LiveSearchProps) => React.JSX.Element;
6
6
  parameters: {
7
7
  layout: string;
8
8
  };
9
9
  };
10
10
  export default meta;
11
11
  type Story = StoryObj<typeof meta>;
12
- export declare const Example: Story;
12
+ export declare const BasicExample: Story;
13
+ export declare const ObjectOptionsExample: Story;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import React$1, { ComponentPropsWithoutRef, ComponentPropsWithRef, ChangeEvent, ReactNode, HTMLAttributes } from 'react';
2
+ import React$1, { ComponentPropsWithoutRef, ComponentPropsWithRef, ChangeEvent, ReactNode, MouseEvent, HTMLAttributes } from 'react';
3
3
 
4
4
  interface AccordionsProps extends ComponentPropsWithoutRef<'div'> {
5
5
  title: string;
@@ -303,7 +303,7 @@ interface DropdownContainerProps extends ComponentPropsWithRef<'div'> {
303
303
  size?: 'sm' | 'md';
304
304
  zIndex?: number;
305
305
  anchorRef?: React$1.RefObject<HTMLElement>;
306
- onClickItem?: (event: React$1.MouseEvent<HTMLDivElement>, val: string | number) => void;
306
+ onClickItem?: (event: React$1.MouseEvent<HTMLDivElement>, val: string | number | object) => void;
307
307
  }
308
308
  declare const DropdownContainer: {
309
309
  (propsComp: DropdownContainerProps): React$1.JSX.Element | null;
@@ -343,28 +343,28 @@ declare namespace SelectInput {
343
343
  };
344
344
  }
345
345
 
346
- interface LiveSearchProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size'> {
346
+ type SearchVariant = 'include' | 'startsWith' | 'endsWith';
347
+ interface LiveSearchProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size' | 'value'> {
348
+ autoComplete?: string;
349
+ children?: ReactNode;
347
350
  descText?: string;
348
351
  disabled?: boolean;
352
+ dropContProps?: Omit<DropdownContainerProps, 'children'>;
349
353
  id?: string;
350
- size?: 'md' | 'sm';
351
354
  label?: string;
355
+ onChangeText?: (e: ChangeEvent<HTMLInputElement>) => void;
356
+ onClickDropdown?: (event: MouseEvent<HTMLDivElement>) => void;
357
+ options?: any[];
352
358
  placeholder?: string;
353
- required?: boolean;
354
- options?: any;
355
- setValue?: any;
356
- value?: any;
357
359
  readOnly?: boolean;
358
- autoComplete?: string;
359
- onChangeText?: (value: any) => void;
360
- onClickDropdown?: (event: React.MouseEvent<HTMLDivElement>) => void;
361
- children?: React.ReactNode;
362
- dropdownClassName?: string;
363
- dropContProps?: Omit<DropdownContainerProps, 'children'>;
364
- searchVariant?: 'startsWith' | 'endsWith' | 'include';
360
+ required?: boolean;
361
+ searchVariant?: SearchVariant;
362
+ setValue: (value: any) => void;
363
+ size?: 'md' | 'sm';
364
+ value: any;
365
365
  }
366
366
 
367
- declare function LiveSearch({ descText, disabled, id, size, label, placeholder, required, options, setValue, value, readOnly, onChangeText, onClickDropdown, autoComplete, children, dropContProps, searchVariant, }: LiveSearchProps): React$1.JSX.Element;
367
+ declare function LiveSearch({ autoComplete, children, descText, disabled, dropContProps, id, label, onChangeText, onClickDropdown, options, placeholder, readOnly, required, searchVariant, setValue, size, value, }: LiveSearchProps): React$1.JSX.Element;
368
368
  declare namespace LiveSearch {
369
369
  var defaultProps: {
370
370
  descText: string;
@@ -454,6 +454,7 @@ declare namespace DropdownItem {
454
454
  }
455
455
 
456
456
  interface DatePickerProps extends Omit<HTMLAttributes<HTMLInputElement>, 'onChange' | 'value'> {
457
+ className: string;
457
458
  descText?: string;
458
459
  onChange?: (date: string) => void;
459
460
  required?: boolean;
@@ -464,8 +465,9 @@ interface DatePickerProps extends Omit<HTMLAttributes<HTMLInputElement>, 'onChan
464
465
  label?: string;
465
466
  minDate?: string;
466
467
  maxDate?: string;
468
+ nullDisplay?: string;
467
469
  }
468
- declare function DatePicker({ value, onChange, size, disabled, placeholder, label, minDate, maxDate, required, }: DatePickerProps): React$1.JSX.Element;
470
+ declare function DatePicker({ className, value, onChange, size, disabled, placeholder, label, minDate, maxDate, required, nullDisplay, }: DatePickerProps): React$1.JSX.Element;
469
471
 
470
472
  interface PickerCalendarProps extends ComponentPropsWithRef<'div'> {
471
473
  minDate?: string;
@@ -531,15 +533,15 @@ interface InfoPanelProps {
531
533
  variant?: 'container' | 'form-sm' | 'form-md';
532
534
  color?: 'yellow' | 'blue' | 'grey' | 'white';
533
535
  className?: string;
534
- textClassName?: string;
536
+ children: React$1.ReactNode;
535
537
  }
536
538
  declare const InfoPanel: {
537
- ({ variant, color, className, textClassName, }: InfoPanelProps): React$1.JSX.Element;
539
+ ({ variant, color, className, children, }: InfoPanelProps): React$1.JSX.Element;
538
540
  defaultProps: {
539
541
  variant: string;
540
542
  color: string;
541
543
  className: string;
542
- textClassName: string;
544
+ children: null;
543
545
  };
544
546
  };
545
547
 
@@ -642,8 +644,9 @@ interface TabProps extends ComponentPropsWithoutRef<'button'> {
642
644
  mode?: 'horizontal' | 'vertical';
643
645
  fit?: 'fit-content' | 'maximize';
644
646
  size?: 'md' | 'sm';
647
+ className?: string;
645
648
  }
646
- declare function Tab({ children, active, icon, disabled, mode, fit, size, ...rest }: TabProps): React$1.JSX.Element;
649
+ declare function Tab({ children, active, icon, disabled, mode, fit, size, className, ...rest }: TabProps): React$1.JSX.Element;
647
650
 
648
651
  interface TabMenuProps extends ComponentPropsWithoutRef<'div'> {
649
652
  variant?: 'default' | 'alternative';
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "@biaenergi:registry": "https://gitlab.com/api/v4/projects/50905269/packages/npm/"
5
5
  },
6
- "version": "1.15.0",
6
+ "version": "1.16.0-beta.1",
7
7
  "description": "Design Language System develop by BIAENERGI",
8
8
  "scripts": {
9
9
  "rollup": "rollup -c",
@@ -1,23 +0,0 @@
1
- import { ComponentPropsWithoutRef } from 'react';
2
- import { DropdownContainerProps } from '../Dropdown/DropdownContainer';
3
- interface LiveSearchProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size'> {
4
- descText?: string;
5
- disabled?: boolean;
6
- id?: string;
7
- size?: 'md' | 'sm';
8
- label?: string;
9
- placeholder?: string;
10
- required?: boolean;
11
- options?: any;
12
- setValue?: any;
13
- value?: any;
14
- readOnly?: boolean;
15
- autoComplete?: string;
16
- onChangeText?: (value: any) => void;
17
- onClickDropdown?: (event: React.MouseEvent<HTMLDivElement>) => void;
18
- children?: React.ReactNode;
19
- dropdownClassName?: string;
20
- dropContProps?: Omit<DropdownContainerProps, 'children'>;
21
- searchVariant?: 'startsWith' | 'endsWith' | 'include';
22
- }
23
- export default LiveSearchProps;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import LiveSearchProps from './PropsInterface';
3
- declare function LiveSearchSimulation({ setValue, value, ...props }: LiveSearchProps): React.JSX.Element;
4
- export default LiveSearchSimulation;
@@ -1,23 +0,0 @@
1
- import { ComponentPropsWithoutRef } from 'react';
2
- import { DropdownContainerProps } from '../Dropdown/DropdownContainer';
3
- interface LiveSearchProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size'> {
4
- descText?: string;
5
- disabled?: boolean;
6
- id?: string;
7
- size?: 'md' | 'sm';
8
- label?: string;
9
- placeholder?: string;
10
- required?: boolean;
11
- options?: any;
12
- setValue?: any;
13
- value?: any;
14
- readOnly?: boolean;
15
- autoComplete?: string;
16
- onChangeText?: (value: any) => void;
17
- onClickDropdown?: (event: React.MouseEvent<HTMLDivElement>) => void;
18
- children?: React.ReactNode;
19
- dropdownClassName?: string;
20
- dropContProps?: Omit<DropdownContainerProps, 'children'>;
21
- searchVariant?: 'startsWith' | 'endsWith' | 'include';
22
- }
23
- export default LiveSearchProps;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import LiveSearchProps from './PropsInterface';
3
- declare function LiveSearchSimulation({ setValue, value, ...props }: LiveSearchProps): React.JSX.Element;
4
- export default LiveSearchSimulation;