@agilant/toga-blox 1.0.72 → 1.0.74

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.
@@ -1,21 +1,33 @@
1
1
  import React from "react";
2
- import { OptionType } from "../MultiSelect/MultiSelect.types";
3
- import "./SearchDropdown.scss";
2
+ import { MultiSelectInputProps, OptionType } from "../MultiSelect/MultiSelect.types";
4
3
  interface SearchDropdownInputProps {
5
4
  options?: OptionType[];
5
+ /** The currently‐selected items (each has { name, value } ) **/
6
6
  selectedValue?: OptionType[];
7
+ /** Called whenever the selectedValue changes **/
7
8
  onChange: (selected: OptionType[]) => void;
8
9
  placeholder?: string;
9
10
  disabled?: boolean;
10
11
  hasSelectAll?: boolean;
11
12
  bgColor?: string;
12
13
  textHighlight?: string;
13
- [key: string]: any;
14
14
  handleFilter?: () => void;
15
+ /** The array of “badges” or stored strings for this particular column’s filter(s) **/
16
+ searchItems?: string[];
17
+ setSearchItems?: React.Dispatch<React.SetStateAction<string[]>>;
18
+ /** The full array of all column filters for your table **/
19
+ setSearchCriteria?: React.Dispatch<React.SetStateAction<any[]>>;
20
+ /** The column object must have an .id property */
21
+ column?: {
22
+ id: string;
23
+ [key: string]: any;
24
+ };
25
+ /** Tells the parent to close the UI, etc. */
26
+ setEditingHeader?: React.Dispatch<React.SetStateAction<any>>;
27
+ /** localStorage key used to store the entire “searchCriteria” array */
28
+ localStorageKey?: string;
29
+ otherProps?: MultiSelectInputProps["otherProps"];
30
+ additionalClasses?: string;
15
31
  }
16
- /**
17
- * A wrapper around MultiSelectInput that appends a special "__footer__" option
18
- * and uses a custom item renderer to display "Clear" and "Filter" buttons.
19
- */
20
32
  declare const SearchDropdownInput: React.FC<SearchDropdownInputProps>;
21
33
  export default SearchDropdownInput;
@@ -1,25 +1,104 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
2
3
  import MultiSelectInput from "../MultiSelect/MultiSelect";
3
- import "./SearchDropdown.scss";
4
- /**
5
- * A wrapper around MultiSelectInput that appends a special "__footer__" option
6
- * and uses a custom item renderer to display "Clear" and "Filter" buttons.
7
- */
8
- const SearchDropdownInput = ({ options = [], selectedValue = [], onChange, placeholder = "Select", disabled = false, hasSelectAll = true, bgColor, textHighlight, handleFilter, ...rest }) => {
4
+ const DEFAULT_STORAGE_KEY = "searchCriteria";
5
+ const SearchDropdownInput = ({ options = [], selectedValue = [], onChange, placeholder = "Select", disabled = false, hasSelectAll = true, bgColor = "bg-sky-500", textHighlight = "text-sky-700", handleFilter, searchItems = [], setSearchItems, setSearchCriteria, column, setEditingHeader, localStorageKey = DEFAULT_STORAGE_KEY, ...rest }) => {
6
+ // Are we able to store filters for this column?
7
+ const canStore = !!column?.id && !!setSearchCriteria;
8
+ /** Helper: write the entire searchCriteria array to localStorage */
9
+ const updateLocalStorage = (criteria) => {
10
+ localStorage.setItem(localStorageKey, JSON.stringify(criteria));
11
+ };
12
+ useEffect(() => {
13
+ if (!canStore)
14
+ return;
15
+ const stored = localStorage.getItem(localStorageKey);
16
+ if (!stored)
17
+ return;
18
+ try {
19
+ const parsed = JSON.parse(stored);
20
+ const existing = parsed.find((c) => c.searchColumn?.id === column.id);
21
+ if (existing && setSearchItems) {
22
+ const raw = existing.submittedSearchText;
23
+ setSearchItems([raw]);
24
+ const storedValues = raw
25
+ .split(",")
26
+ .map((s) => s.trim());
27
+ const matched = options.filter((o) => storedValues.includes(o.value));
28
+ onChange(matched);
29
+ }
30
+ }
31
+ catch (err) {
32
+ console.error("Error reading stored dropdown filter:", err);
33
+ }
34
+ }, [
35
+ canStore,
36
+ column?.id,
37
+ localStorageKey,
38
+ setSearchItems,
39
+ onChange,
40
+ options,
41
+ ]);
42
+ const handleFooterFilter = () => {
43
+ const actualSelections = selectedValue.filter((opt) => opt.value !== "__footer__" && opt.label !== "Select All");
44
+ const selectedLabels = actualSelections
45
+ .map((opt) => opt.value)
46
+ .join(",");
47
+ const isEmpty = !selectedLabels.trim();
48
+ if (!canStore) {
49
+ // If we have no place to store it, just do handleFilter
50
+ handleFilter?.();
51
+ return;
52
+ }
53
+ if (isEmpty) {
54
+ setSearchCriteria?.((prev) => {
55
+ const newCriteria = prev.filter((c) => c.searchColumn.id !== column.id);
56
+ updateLocalStorage(newCriteria);
57
+ return newCriteria;
58
+ });
59
+ }
60
+ else {
61
+ if (!searchItems.includes(selectedLabels)) {
62
+ setSearchItems?.([...searchItems, selectedLabels]);
63
+ }
64
+ setSearchCriteria?.((prev) => {
65
+ const newCriteria = [
66
+ ...prev,
67
+ {
68
+ searchColumn: column,
69
+ submittedSearchText: selectedLabels,
70
+ },
71
+ ];
72
+ updateLocalStorage(newCriteria);
73
+ return newCriteria;
74
+ });
75
+ }
76
+ setEditingHeader?.(null);
77
+ handleFilter?.();
78
+ };
79
+ const handleClear = () => {
80
+ onChange([]);
81
+ if (canStore) {
82
+ setSearchCriteria?.((prev) => {
83
+ const newCriteria = prev.filter((c) => c.searchColumn.id !== column.id);
84
+ updateLocalStorage(newCriteria);
85
+ return newCriteria;
86
+ });
87
+ setSearchItems?.([]);
88
+ setEditingHeader?.(null);
89
+ }
90
+ };
9
91
  const footerOption = [{ name: "", value: "__footer__" }];
10
92
  const extendedOptions = [...options, ...footerOption];
11
93
  const itemRenderer = ({ option, checked, disabled, onClick }) => {
12
- // If it's our footer option, display the custom footer row
13
94
  if (option.value === "__footer__") {
14
- return (_jsxs("div", { className: "footer px-4 py-2 flex justify-between", children: [_jsx("button", { type: "button", className: `${textHighlight}`, onClick: (e) => {
95
+ return (_jsxs("div", { className: "footer px-4 py-2 flex justify-between", children: [_jsx("div", { role: "button", className: `${textHighlight}`, onClick: handleClear, children: "Clear" }), _jsx("button", { type: "button", className: `${bgColor} text-white px-3 py-1 rounded`, onClick: (e) => {
15
96
  e.stopPropagation();
16
- onChange([]); // Clear all selections
17
- }, children: "Clear" }), _jsx("button", { type: "button", className: `${bgColor} text-white px-3 py-1 rounded`, onClick: (e) => {
18
- e.stopPropagation();
19
- handleFilter();
97
+ handleFooterFilter();
20
98
  }, children: "Filter" })] }));
21
99
  }
22
- else if (option.label === "Select All") {
100
+ // If it's the "Select All" item
101
+ if (option.label === "Select All") {
23
102
  return (_jsxs("label", { className: "select-all-item", style: {
24
103
  display: "flex",
25
104
  alignItems: "center",
@@ -30,20 +109,16 @@ const SearchDropdownInput = ({ options = [], selectedValue = [], onChange, place
30
109
  zIndex: 10,
31
110
  }, onClick: (e) => {
32
111
  e.stopPropagation();
33
- onClick(e); // Let the library handle toggling
112
+ onClick(e);
34
113
  }, children: [_jsx("input", { type: "checkbox", checked: checked, readOnly: true, disabled: disabled }), _jsx("span", { style: { marginLeft: "0.5rem" }, children: option.label })] }));
35
114
  }
36
- else {
37
- return (_jsxs("div", { className: "item px-4 py-1 cursor-pointer flex items-center", onClick: (e) => onClick(option, e), children: [_jsx("input", { type: "checkbox", checked: checked, readOnly: true, disabled: disabled }), _jsx("span", { className: "ml-2", children: option.label })] }));
38
- }
115
+ return (_jsxs("div", { className: "item px-4 py-1 cursor-pointer flex items-center", onClick: (e) => onClick(option, e), children: [_jsx("input", { type: "checkbox", checked: checked, readOnly: true, disabled: disabled }), _jsx("span", { className: "ml-2", children: option.label })] }));
39
116
  };
40
117
  return (_jsx(MultiSelectInput, { options: extendedOptions, selectedValue: selectedValue, onChange: onChange, placeholder: {
41
118
  text: placeholder,
42
119
  icon: "magnifyingGlass",
43
120
  iconStyle: "regular",
44
- }, disabled: disabled, hasSelectAll: hasSelectAll,
45
- /** Provide the custom item renderer and any additional props via otherProps */
46
- otherProps: {
121
+ }, disabled: disabled, hasSelectAll: hasSelectAll, otherProps: {
47
122
  ItemRenderer: itemRenderer,
48
123
  ...rest.otherProps,
49
124
  }, ...rest }));
@@ -21,7 +21,7 @@ const SearchInput = ({ bgColor = "bg-sky-500", textHighlight = "text-sky-500", i
21
21
  case "number":
22
22
  return (_jsx(SearchNumberInput, { dropdownIconProp: dropdownIconProp, dropdownOptions: dropdownOptions, selectedDropdownOption: selectedDropdownOption, onDropdownOptionSelect: onDropdownOptionSelect, toggleStatus: toggleStatus, setToggleStatus: setToggleStatus, minValue: minValue, maxValue: maxValue, setMinValue: setMinValue, setMaxValue: setMaxValue, handleFilter: handleFilter }));
23
23
  case "multiSelect":
24
- return (_jsx(SearchDropdownInput, { options: dropdownOptions, isSearchable: true, placeholder: "Search", isMulti: true, hideSelectedOptions: true, closeMenuOnSelect: false, inputWidth: "w-full", inputTextSize: "text-sm", additionalClasses: "", customClassNames: {}, onChange: onChange, value: [], selectedValue: selectedValue, bgColor: bgColor, textHighlight: textHighlight, handleFilter: handleFilter }));
24
+ return (_jsx(SearchDropdownInput, { options: dropdownOptions, placeholder: "Search", additionalClasses: "", onChange: onChange, selectedValue: selectedValue, bgColor: bgColor, textHighlight: textHighlight, handleFilter: handleFilter, column: column, setSearchCriteria: setSearchCriteria }));
25
25
  case "date":
26
26
  return (_jsx(SearchDatePickerInput, { textHighlight: textHighlight, dropdownOptions: dropdownOptions, selectedDropdownOption: selectedDropdownOption, onDropdownOptionSelect: onDropdownOptionSelect, toggleStatus: toggleStatus, setToggleStatus: setToggleStatus, selectedDate: selectedDate, onDateSelect: onDateSelect, selectedStartDate: selectedStartDate, onStartDateSelect: onStartDateSelect, selectedEndDate: selectedEndDate, onEndDateSelect: onEndDateSelect, handleFilter: handleFilter, themeBgColor: dataPickerThemeColor, lightThemeBg: dataPickerThemeColorAccent,
27
27
  // pass the same local-storage props:
@@ -135,6 +135,8 @@ DropdownInput.args = {
135
135
  disabled: false,
136
136
  isLoading: false,
137
137
  type: "multiSelect",
138
+ column: { id: "multiSelectColumn" },
139
+ localStorageKey: "searchCriteria",
138
140
  };
139
141
  export const BooleanInput = Template.bind({});
140
142
  BooleanInput.args = {
@@ -8,11 +8,34 @@ import BaseButton from "../BaseButton";
8
8
  import Badge from "../Badge/Badge";
9
9
  import Text from "../Text";
10
10
  import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
11
- function SearchDatePickerInput({ themeBgColor = "bg-sky-500", lightThemeBg = "bg-sky-100", pillColor = "bg-sky-500", textHighlight = "text-sky-700", dropdownOptions = [], selectedDropdownOption = "", onDropdownOptionSelect, dropdownIconProp = {
11
+ /**
12
+ * A helper to convert a Date object to 'YYYY-MM-DD'
13
+ * so we don't get slashes in the final string.
14
+ */
15
+ function formatAsYMD(date) {
16
+ if (!date)
17
+ return "";
18
+ // date.toISOString() is 'YYYY-MM-DDTHH:mm:ss.sssZ'
19
+ // slice(0,10) => 'YYYY-MM-DD'
20
+ return date.toISOString().slice(0, 10);
21
+ }
22
+ function SearchDatePickerInput({
23
+ // theming
24
+ themeBgColor = "bg-sky-500", lightThemeBg = "bg-sky-100",
25
+ // style/config
26
+ pillColor = "bg-sky-500", textHighlight = "text-sky-700", dropdownOptions = [], selectedDropdownOption = "", onDropdownOptionSelect, dropdownIconProp = {
12
27
  iconClasses: "text-sky-500",
13
28
  name: "chevronDown",
14
29
  weight: "solid",
15
- }, toggleStatus = false, setToggleStatus, selectedDate, onDateSelect, selectedStartDate, onStartDateSelect, selectedEndDate, onEndDateSelect, searchItems = [], setSearchItems, handleFilter, setSearchCriteria, column, setEditingHeader, localStorageKey = "searchCriteria", }) {
30
+ },
31
+ // toggle
32
+ toggleStatus = false, setToggleStatus,
33
+ // single date
34
+ selectedDate, onDateSelect,
35
+ // range
36
+ selectedStartDate, onStartDateSelect, selectedEndDate, onEndDateSelect,
37
+ // local-storage logic
38
+ searchItems = [], setSearchItems, handleFilter, setSearchCriteria, column, setEditingHeader, localStorageKey = "searchCriteria", }) {
16
39
  const containerRef = useRef(null);
17
40
  const [isDatePickerOpen, setIsDatePickerOpen] = useState(false);
18
41
  const [activeInput, setActiveInput] = useState(null);
@@ -27,6 +50,7 @@ function SearchDatePickerInput({ themeBgColor = "bg-sky-500", lightThemeBg = "bg
27
50
  const parsed = JSON.parse(stored);
28
51
  const existing = parsed.find((criterion) => criterion.searchColumn.id === column.id);
29
52
  if (existing && setSearchItems) {
53
+ // e.g. "2025-02-27" or "2024-12-01 - 2024-12-28"
30
54
  setSearchItems([existing.submittedSearchText]);
31
55
  }
32
56
  }
@@ -35,7 +59,7 @@ function SearchDatePickerInput({ themeBgColor = "bg-sky-500", lightThemeBg = "bg
35
59
  }
36
60
  }
37
61
  }, [canStore, column?.id, localStorageKey, setSearchItems]);
38
- // close datepickers on outside click
62
+ // Close date pickers on outside click
39
63
  useEffect(() => {
40
64
  function handleClickOutside(e) {
41
65
  if (containerRef.current &&
@@ -45,49 +69,45 @@ function SearchDatePickerInput({ themeBgColor = "bg-sky-500", lightThemeBg = "bg
45
69
  }
46
70
  }
47
71
  document.addEventListener("mousedown", handleClickOutside);
48
- return () => {
49
- document.removeEventListener("mousedown", handleClickOutside);
50
- };
72
+ return () => document.removeEventListener("mousedown", handleClickOutside);
51
73
  }, []);
52
74
  const updateLocalStorage = (criteria) => {
53
75
  localStorage.setItem(localStorageKey, JSON.stringify(criteria));
54
76
  };
55
- // removing a date "badge"
56
- const handleSearchBadgeClick = (item) => {
57
- const newSearchItems = searchItems.filter((x) => x !== item);
58
- setSearchItems?.(newSearchItems);
59
- if (canStore) {
60
- setSearchCriteria?.((prev) => {
61
- const newCriteria = prev.filter((crit) => crit.submittedSearchText !== item);
62
- updateLocalStorage(newCriteria);
63
- return newCriteria;
64
- });
65
- }
66
- };
67
- // build single or range
77
+ /**
78
+ * Build a string in 'YYYY-MM-DD' (or range) format,
79
+ * so it won't break in your URL as "mm%2Fdd%2Fyyyy"
80
+ */
68
81
  const buildDateString = () => {
69
82
  if (toggleStatus) {
83
+ // range mode
70
84
  if (selectedStartDate && selectedEndDate) {
71
- return `${selectedStartDate.toLocaleDateString()} - ${selectedEndDate.toLocaleDateString()}`;
85
+ return `${formatAsYMD(selectedStartDate)} - ${formatAsYMD(selectedEndDate)}`;
72
86
  }
73
87
  else if (selectedStartDate) {
74
- return `Start: ${selectedStartDate.toLocaleDateString()}`;
88
+ return `Start: ${formatAsYMD(selectedStartDate)}`;
75
89
  }
76
90
  else if (selectedEndDate) {
77
- return `End: ${selectedEndDate.toLocaleDateString()}`;
91
+ return `End: ${formatAsYMD(selectedEndDate)}`;
78
92
  }
79
93
  return "";
80
94
  }
81
- return selectedDate ? selectedDate.toLocaleDateString() : "";
95
+ else {
96
+ // single-date mode
97
+ return selectedDate ? formatAsYMD(selectedDate) : "";
98
+ }
82
99
  };
83
100
  /**
84
101
  * If empty => remove all queries for col
85
102
  * If non-empty => APPEND
86
103
  * (do NOT filter out old queries for that column)
104
+ *
105
+ * But now the stored string is "YYYY-MM-DD" or "YYYY-MM-DD - YYYY-MM-DD"
87
106
  */
88
107
  const handleFilterClick = () => {
89
108
  const dateString = buildDateString().trim();
90
109
  if (!dateString) {
110
+ // remove existing for col
91
111
  if (canStore) {
92
112
  setSearchCriteria?.((prev) => {
93
113
  const newCriteria = prev.filter((c) => c.searchColumn.id !== column.id);
@@ -97,12 +117,12 @@ function SearchDatePickerInput({ themeBgColor = "bg-sky-500", lightThemeBg = "bg
97
117
  }
98
118
  }
99
119
  else {
120
+ // append
100
121
  if (!searchItems.includes(dateString)) {
101
122
  setSearchItems?.([...searchItems, dateString]);
102
123
  }
103
124
  if (canStore) {
104
125
  setSearchCriteria?.((prev) => {
105
- // KEY: no filtering out old queries => we let them accumulate
106
126
  const newCriteria = [
107
127
  ...prev,
108
128
  {
@@ -120,7 +140,7 @@ function SearchDatePickerInput({ themeBgColor = "bg-sky-500", lightThemeBg = "bg
120
140
  setIsDatePickerOpen(false);
121
141
  setActiveInput(null);
122
142
  };
123
- // styling for day picker
143
+ // DayPicker styling
124
144
  const modifiersClassNames = {
125
145
  selected: `${themeBgColor} text-white rounded-full`,
126
146
  today: `${lightThemeBg} ${textHighlight}`,
@@ -138,12 +158,16 @@ function SearchDatePickerInput({ themeBgColor = "bg-sky-500", lightThemeBg = "bg
138
158
  setActiveInput(null);
139
159
  setIsDatePickerOpen((prev) => !prev);
140
160
  };
141
- return (_jsxs("div", { ref: containerRef, className: "relative w-[425px] border-2 p-4", children: [_jsx("div", { className: "flex items-center justify-between h-12 mb-2", children: toggleStatus ? (_jsxs("div", { className: "flex items-center w-full", children: [_jsx("button", { onClick: openStartPicker, className: "border-2 px-3 py-2 flex-1 h-10 text-left", children: selectedStartDate
142
- ? selectedStartDate.toLocaleDateString()
161
+ return (_jsxs("div", { ref: containerRef, className: "relative w-[425px] border-2 p-4", children: [_jsx("div", { className: "flex items-center justify-between h-12 mb-2", children: toggleStatus ? (
162
+ // Range mode
163
+ _jsxs("div", { className: "flex items-center w-full", children: [_jsx("button", { onClick: openStartPicker, className: "border-2 px-3 py-2 flex-1 h-10 text-left", children: selectedStartDate
164
+ ? formatAsYMD(selectedStartDate)
143
165
  : "Start Date" }), _jsx("span", { className: "mx-2", children: "to" }), _jsx("button", { onClick: openEndPicker, className: "border-2 px-3 py-2 flex-1 h-10 text-left", children: selectedEndDate
144
- ? selectedEndDate.toLocaleDateString()
145
- : "End Date" })] })) : (_jsxs(_Fragment, { children: [_jsx(Dropdown, { options: dropdownOptions, selectedOption: selectedDropdownOption, onOptionSelect: onDropdownOptionSelect, optionClasses: "px-4 h-full flex items-center", menuClasses: "bg-white min-w-[150px] top-[-8px] left-[-2px]", dropdownClasses: "border-2 border-r-0 flex-[1] h-10 w-auto", icon: dropdownIconProp }), _jsx("button", { onClick: openSinglePicker, className: "border-2 px-3 py-2 flex-[2] h-10 text-left min-w-40", children: selectedDate
146
- ? selectedDate.toLocaleDateString()
166
+ ? formatAsYMD(selectedEndDate)
167
+ : "End Date" })] })) : (
168
+ // Single-date mode
169
+ _jsxs(_Fragment, { children: [_jsx(Dropdown, { options: dropdownOptions, selectedOption: selectedDropdownOption, onOptionSelect: onDropdownOptionSelect, optionClasses: "px-4 h-full flex items-center", menuClasses: "bg-white min-w-[150px] top-[-8px] left-[-2px]", dropdownClasses: "border-2 border-r-0 flex-[1] h-10 w-auto", icon: dropdownIconProp }), _jsx("button", { onClick: openSinglePicker, className: "border-2 px-3 py-2 flex-[2] h-10 text-left min-w-40", children: selectedDate
170
+ ? formatAsYMD(selectedDate)
147
171
  : "Select Date" })] })) }), toggleStatus
148
172
  ? activeInput && (_jsx("div", { className: "absolute p-4 top-16 w-auto z-50 shadow-lg bg-white", children: activeInput === "start" ? (_jsx(DayPicker, { mode: "single", selected: selectedStartDate, onSelect: (day) => {
149
173
  onStartDateSelect?.(day || undefined);
@@ -156,6 +180,18 @@ function SearchDatePickerInput({ themeBgColor = "bg-sky-500", lightThemeBg = "bg
156
180
  }, modifiersClassNames: modifiersClassNames })) }))
157
181
  : isDatePickerOpen && (_jsx("div", { className: "absolute p-4 top-16 w-auto z-50 shadow-lg bg-white", children: _jsx(DayPicker, { mode: "single", selected: selectedDate, onSelect: (day) => {
158
182
  onDateSelect?.(day || undefined);
159
- }, modifiersClassNames: modifiersClassNames }) })), searchItems?.length ? (_jsx("div", { className: "flex flex-wrap bg-white py-2 px-2 mt-2 rounded-md", children: searchItems.map((item, index) => (_jsx(Badge, { backgroundColor: pillColor, borderRadius: "rounded-full", hasRightIcon: true, icon: _jsx("div", { className: "text-white text-xxs", children: getFontAwesomeIcon("xmark", "solid") }), iconSize: "text-sm", mobileIconLabel: item, onClick: () => handleSearchBadgeClick(item), text: _jsx(Text, { color: "text-white", fontFamily: "font-serif", size: "text-sm", tag: "span", text: item }), badgeContainerClasses: `${pillColor} p-1 max-w-fit min-w-20 rounded-full flex justify-between items-center text-white text-xs px-4 border-none mr-4 mb-1`, type: "span" }, index))) })) : null, _jsxs("div", { className: "flex justify-between items-end bg-white px-2 rounded-md mt-4", children: [_jsx(ToggleButton, { initialStatus: toggleStatus, onClick: () => setToggleStatus?.(!toggleStatus), activeColorBackground: "bg-sky-500", activeColorBorder: "border-sky-500", activeLabel: "Range", activeTextColor: "text-sky-500", additionalClasses: "flex items-center", inactiveColorBackground: "bg-gray-300", inactiveColorBorder: "border-gray-300", inactiveLabel: "Range", inactiveTextColor: "text-gray-500", pillHeight: "h-8", textPosition: "right", textSize: "text-sm", smallToggle: false, borderStyle: false }), _jsx(BaseButton, { text: "Filter", backgroundColor: "bg-sky-500", additionalClasses: "py-1.5 px-6 text-white", borderColor: "border-none", onClick: handleFilterClick, shape: "rounded-full" })] })] }));
183
+ setIsDatePickerOpen(false);
184
+ }, modifiersClassNames: modifiersClassNames }) })), searchItems?.length ? (_jsx("div", { className: "flex flex-wrap bg-white py-2 px-2 mt-2 rounded-md", children: searchItems.map((item, index) => (_jsx(Badge, { backgroundColor: pillColor, borderRadius: "rounded-full", hasRightIcon: true, icon: _jsx("div", { className: "text-white text-xxs", children: getFontAwesomeIcon("xmark", "solid") }), iconSize: "text-sm", mobileIconLabel: item, onClick: () => {
185
+ const newSearchItems = searchItems.filter((x) => x !== item);
186
+ setSearchItems?.(newSearchItems);
187
+ if (canStore) {
188
+ setSearchCriteria?.((prev) => {
189
+ const filtered = prev.filter((crit) => crit.submittedSearchText !==
190
+ item);
191
+ updateLocalStorage(filtered);
192
+ return filtered;
193
+ });
194
+ }
195
+ }, text: _jsx(Text, { color: "text-white", fontFamily: "font-serif", size: "text-sm", tag: "span", text: item }), badgeContainerClasses: `${pillColor} p-1 max-w-fit min-w-20 rounded-full flex justify-between items-center text-white text-xs px-4 border-none mr-4 mb-1`, type: "span" }, index))) })) : null, _jsxs("div", { className: "flex justify-between items-end bg-white px-2 rounded-md mt-4", children: [_jsx(ToggleButton, { initialStatus: toggleStatus, onClick: () => setToggleStatus?.(!toggleStatus), activeColorBackground: "bg-sky-500", activeColorBorder: "border-sky-500", activeLabel: "Range", activeTextColor: "text-sky-500", additionalClasses: "flex items-center", inactiveColorBackground: "bg-gray-300", inactiveColorBorder: "border-gray-300", inactiveLabel: "Range", inactiveTextColor: "text-gray-500", pillHeight: "h-8", textPosition: "right", textSize: "text-sm", smallToggle: false, borderStyle: false }), _jsx(BaseButton, { text: "Filter", backgroundColor: "bg-sky-500", additionalClasses: "py-1.5 px-6 text-white", borderColor: "border-none", onClick: handleFilterClick, shape: "rounded-full" })] })] }));
160
196
  }
161
197
  export default SearchDatePickerInput;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agilant/toga-blox",
3
3
  "private": false,
4
- "version": "1.0.72",
4
+ "version": "1.0.74",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",