@agilant/toga-blox 1.0.71 → 1.0.72
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,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
|
-
import SearchTextInput from "./SearchTextInput";
|
|
3
|
+
import SearchTextInput from "./SearchTextInput"; // your working text
|
|
4
4
|
import SearchNumberInput from "./SearchNumberInput";
|
|
5
5
|
import SearchDropdownInput from "./SearchDropdownInput";
|
|
6
6
|
import SearchDatePickerInput from "./SearchInputDatePicker";
|
|
@@ -23,7 +23,11 @@ const SearchInput = ({ bgColor = "bg-sky-500", textHighlight = "text-sky-500", i
|
|
|
23
23
|
case "multiSelect":
|
|
24
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 }));
|
|
25
25
|
case "date":
|
|
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
|
|
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
|
+
// pass the same local-storage props:
|
|
28
|
+
setSearchCriteria: setSearchCriteria, column: column, setEditingHeader: setEditingHeader, searchItems: searchItems, setSearchItems: setSearchItems, pillColor: pillColor }));
|
|
29
|
+
default:
|
|
30
|
+
return null;
|
|
27
31
|
}
|
|
28
32
|
})() }));
|
|
29
33
|
};
|
|
@@ -39,28 +39,40 @@ export default {
|
|
|
39
39
|
},
|
|
40
40
|
parameters: { layout: "centered" },
|
|
41
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Our 'Template' sets up local state for everything,
|
|
44
|
+
* so the SearchInput can function (adding/removing badges, toggling date range, etc.)
|
|
45
|
+
*/
|
|
42
46
|
const Template = (args) => {
|
|
43
47
|
const [selectedOption, setSelectedOption] = useState(args.selectedDropdownOption);
|
|
44
48
|
const [searchItems, setSearchItems] = useState([]);
|
|
45
49
|
const [toggleStatus, setToggleStatus] = useState(false);
|
|
46
50
|
const [minValue, setMinValue] = useState(undefined);
|
|
47
51
|
const [maxValue, setMaxValue] = useState(undefined);
|
|
52
|
+
// For multiSelect
|
|
48
53
|
const [selectedValue, setSelectedValue] = useState(args.selectedValue || []);
|
|
54
|
+
// For date pickers
|
|
49
55
|
const [selectedDate, setSelectedDate] = useState(args.selectedDate);
|
|
50
56
|
const [selectedStartDate, setSelectedStartDate] = useState(args.selectedStartDate);
|
|
51
57
|
const [selectedEndDate, setSelectedEndDate] = useState(args.selectedEndDate);
|
|
52
|
-
//
|
|
58
|
+
// For local-storage logic
|
|
53
59
|
const [searchCriteria, setSearchCriteria] = useState([]);
|
|
60
|
+
// For controlling "editingHeader"
|
|
54
61
|
const [editingHeader, setEditingHeader] = useState(0);
|
|
55
62
|
// Log current state to verify updates.
|
|
56
63
|
console.log("Template render: editingHeader =", editingHeader);
|
|
57
64
|
console.log("Template render: searchCriteria =", searchCriteria);
|
|
65
|
+
// For multiSelect changes (or other input changes)
|
|
58
66
|
const handleOnChange = (newSelected) => {
|
|
59
67
|
setSelectedValue(newSelected);
|
|
60
68
|
args.onChange?.(newSelected);
|
|
61
69
|
console.log("Selected items:", newSelected);
|
|
62
70
|
};
|
|
63
|
-
return (_jsx(SearchInput, { ...args, column: mockColumn,
|
|
71
|
+
return (_jsx(SearchInput, { ...args, column: mockColumn,
|
|
72
|
+
// Our local states
|
|
73
|
+
selectedDropdownOption: selectedOption, onDropdownOptionSelect: (option) => setSelectedOption(option), searchItems: searchItems, setSearchItems: setSearchItems, toggleStatus: toggleStatus, setToggleStatus: setToggleStatus, minValue: minValue, maxValue: maxValue, setMinValue: setMinValue, setMaxValue: setMaxValue, onChange: handleOnChange, selectedValue: selectedValue, selectedDate: selectedDate, onDateSelect: setSelectedDate, selectedStartDate: selectedStartDate, onStartDateSelect: setSelectedStartDate, selectedEndDate: selectedEndDate, onEndDateSelect: setSelectedEndDate, setSearchCriteria: setSearchCriteria, setEditingHeader: setEditingHeader,
|
|
74
|
+
// Keep handleFilter from the args or provide a custom
|
|
75
|
+
handleFilter: args.handleFilter }));
|
|
64
76
|
};
|
|
65
77
|
export const Default = Template.bind({});
|
|
66
78
|
Default.args = {
|
|
@@ -148,10 +160,18 @@ DatePickerInput.args = {
|
|
|
148
160
|
dropdownOptions: ["Exactly", "Before", "After"],
|
|
149
161
|
selectedDropdownOption: "Exactly",
|
|
150
162
|
onDropdownOptionSelect: (option) => console.log(`Option selected: ${option}`),
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
163
|
+
/**
|
|
164
|
+
* IMPORTANT:
|
|
165
|
+
* DO NOT override 'searchItems' or 'setSearchItems' with no-ops
|
|
166
|
+
* or you lose the local state from the Template.
|
|
167
|
+
*
|
|
168
|
+
* DO NOT pass toggleStatus, setToggleStatus as no-ops, or you won't see range toggling.
|
|
169
|
+
*
|
|
170
|
+
* Keep them out so we use the Template's state-based hooking.
|
|
171
|
+
*/
|
|
172
|
+
// Theming for DayPicker
|
|
155
173
|
themeBgColor: "bg-sky-500",
|
|
156
174
|
lightThemeBg: "bg-sky-100",
|
|
175
|
+
// If you want local-storage logic for date filtering:
|
|
176
|
+
column: { id: "dateColumn" }, // real or mock
|
|
157
177
|
};
|
|
@@ -2,6 +2,9 @@ import React from "react";
|
|
|
2
2
|
import "react-day-picker/dist/style.css";
|
|
3
3
|
import { searchDropdownIconProps } from "./SearchInput.types";
|
|
4
4
|
type SearchDatePickerInputProps<T extends object> = {
|
|
5
|
+
themeBgColor?: string;
|
|
6
|
+
lightThemeBg?: string;
|
|
7
|
+
pillColor?: string;
|
|
5
8
|
textHighlight?: string;
|
|
6
9
|
dropdownOptions?: string[];
|
|
7
10
|
selectedDropdownOption?: string;
|
|
@@ -9,15 +12,19 @@ type SearchDatePickerInputProps<T extends object> = {
|
|
|
9
12
|
dropdownIconProp?: searchDropdownIconProps;
|
|
10
13
|
toggleStatus?: boolean;
|
|
11
14
|
setToggleStatus?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
12
|
-
themeBgColor?: string;
|
|
13
|
-
lightThemeBg?: string;
|
|
14
15
|
selectedDate?: Date;
|
|
15
|
-
onDateSelect?: (date: Date) => void;
|
|
16
|
+
onDateSelect?: (date: Date | undefined) => void;
|
|
16
17
|
selectedStartDate?: Date;
|
|
17
|
-
onStartDateSelect?: (date: Date) => void;
|
|
18
|
+
onStartDateSelect?: (date: Date | undefined) => void;
|
|
18
19
|
selectedEndDate?: Date;
|
|
19
|
-
onEndDateSelect?: (date: Date) => void;
|
|
20
|
+
onEndDateSelect?: (date: Date | undefined) => void;
|
|
21
|
+
searchItems?: string[];
|
|
22
|
+
setSearchItems?: React.Dispatch<React.SetStateAction<string[]>>;
|
|
20
23
|
handleFilter?: () => void;
|
|
24
|
+
setSearchCriteria?: React.Dispatch<React.SetStateAction<any[]>>;
|
|
25
|
+
column?: any;
|
|
26
|
+
setEditingHeader?: React.Dispatch<React.SetStateAction<any>>;
|
|
27
|
+
localStorageKey?: string;
|
|
21
28
|
};
|
|
22
|
-
declare function SearchDatePickerInput<T extends object>({ textHighlight, dropdownOptions, selectedDropdownOption, onDropdownOptionSelect, dropdownIconProp, toggleStatus, setToggleStatus,
|
|
29
|
+
declare function SearchDatePickerInput<T extends object>({ themeBgColor, lightThemeBg, pillColor, textHighlight, dropdownOptions, selectedDropdownOption, onDropdownOptionSelect, dropdownIconProp, toggleStatus, setToggleStatus, selectedDate, onDateSelect, selectedStartDate, onStartDateSelect, selectedEndDate, onEndDateSelect, searchItems, setSearchItems, handleFilter, setSearchCriteria, column, setEditingHeader, localStorageKey, }: SearchDatePickerInputProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
23
30
|
export default SearchDatePickerInput;
|
|
@@ -5,24 +5,41 @@ import "react-day-picker/dist/style.css";
|
|
|
5
5
|
import Dropdown from "../Dropdown/Dropdown";
|
|
6
6
|
import ToggleButton from "../ToggleButton/ToggleButton";
|
|
7
7
|
import BaseButton from "../BaseButton";
|
|
8
|
-
|
|
8
|
+
import Badge from "../Badge/Badge";
|
|
9
|
+
import Text from "../Text";
|
|
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 = {
|
|
9
12
|
iconClasses: "text-sky-500",
|
|
10
13
|
name: "chevronDown",
|
|
11
14
|
weight: "solid",
|
|
12
|
-
}, toggleStatus = false, setToggleStatus,
|
|
15
|
+
}, toggleStatus = false, setToggleStatus, selectedDate, onDateSelect, selectedStartDate, onStartDateSelect, selectedEndDate, onEndDateSelect, searchItems = [], setSearchItems, handleFilter, setSearchCriteria, column, setEditingHeader, localStorageKey = "searchCriteria", }) {
|
|
13
16
|
const containerRef = useRef(null);
|
|
14
|
-
// Remove internal state for the date values (they come from props)
|
|
15
|
-
// Internal UI state for showing the calendar and active input remains:
|
|
16
17
|
const [isDatePickerOpen, setIsDatePickerOpen] = useState(false);
|
|
17
18
|
const [activeInput, setActiveInput] = useState(null);
|
|
19
|
+
const canStore = !!column?.id && !!setSearchCriteria;
|
|
20
|
+
// On mount: load existing filter for this column (the FIRST one we find)
|
|
18
21
|
useEffect(() => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
if (!canStore)
|
|
23
|
+
return;
|
|
24
|
+
const stored = localStorage.getItem(localStorageKey);
|
|
25
|
+
if (stored) {
|
|
26
|
+
try {
|
|
27
|
+
const parsed = JSON.parse(stored);
|
|
28
|
+
const existing = parsed.find((criterion) => criterion.searchColumn.id === column.id);
|
|
29
|
+
if (existing && setSearchItems) {
|
|
30
|
+
setSearchItems([existing.submittedSearchText]);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
console.error("Error reading stored date filter:", err);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}, [canStore, column?.id, localStorageKey, setSearchItems]);
|
|
38
|
+
// close datepickers on outside click
|
|
22
39
|
useEffect(() => {
|
|
23
|
-
function handleClickOutside(
|
|
40
|
+
function handleClickOutside(e) {
|
|
24
41
|
if (containerRef.current &&
|
|
25
|
-
!containerRef.current.contains(
|
|
42
|
+
!containerRef.current.contains(e.target)) {
|
|
26
43
|
setIsDatePickerOpen(false);
|
|
27
44
|
setActiveInput(null);
|
|
28
45
|
}
|
|
@@ -32,41 +49,113 @@ function SearchDatePickerInput({ textHighlight = "text-sky-700", dropdownOptions
|
|
|
32
49
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
33
50
|
};
|
|
34
51
|
}, []);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
const updateLocalStorage = (criteria) => {
|
|
53
|
+
localStorage.setItem(localStorageKey, JSON.stringify(criteria));
|
|
54
|
+
};
|
|
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
|
|
68
|
+
const buildDateString = () => {
|
|
69
|
+
if (toggleStatus) {
|
|
70
|
+
if (selectedStartDate && selectedEndDate) {
|
|
71
|
+
return `${selectedStartDate.toLocaleDateString()} - ${selectedEndDate.toLocaleDateString()}`;
|
|
72
|
+
}
|
|
73
|
+
else if (selectedStartDate) {
|
|
74
|
+
return `Start: ${selectedStartDate.toLocaleDateString()}`;
|
|
75
|
+
}
|
|
76
|
+
else if (selectedEndDate) {
|
|
77
|
+
return `End: ${selectedEndDate.toLocaleDateString()}`;
|
|
78
|
+
}
|
|
79
|
+
return "";
|
|
80
|
+
}
|
|
81
|
+
return selectedDate ? selectedDate.toLocaleDateString() : "";
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* If empty => remove all queries for col
|
|
85
|
+
* If non-empty => APPEND
|
|
86
|
+
* (do NOT filter out old queries for that column)
|
|
87
|
+
*/
|
|
88
|
+
const handleFilterClick = () => {
|
|
89
|
+
const dateString = buildDateString().trim();
|
|
90
|
+
if (!dateString) {
|
|
91
|
+
if (canStore) {
|
|
92
|
+
setSearchCriteria?.((prev) => {
|
|
93
|
+
const newCriteria = prev.filter((c) => c.searchColumn.id !== column.id);
|
|
94
|
+
updateLocalStorage(newCriteria);
|
|
95
|
+
return newCriteria;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
if (!searchItems.includes(dateString)) {
|
|
101
|
+
setSearchItems?.([...searchItems, dateString]);
|
|
102
|
+
}
|
|
103
|
+
if (canStore) {
|
|
104
|
+
setSearchCriteria?.((prev) => {
|
|
105
|
+
// KEY: no filtering out old queries => we let them accumulate
|
|
106
|
+
const newCriteria = [
|
|
107
|
+
...prev,
|
|
108
|
+
{
|
|
109
|
+
searchColumn: column,
|
|
110
|
+
submittedSearchText: dateString,
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
updateLocalStorage(newCriteria);
|
|
114
|
+
return newCriteria;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
setEditingHeader?.(null);
|
|
119
|
+
handleFilter?.();
|
|
39
120
|
setIsDatePickerOpen(false);
|
|
40
121
|
setActiveInput(null);
|
|
41
|
-
handleFilter();
|
|
42
122
|
};
|
|
123
|
+
// styling for day picker
|
|
43
124
|
const modifiersClassNames = {
|
|
44
125
|
selected: `${themeBgColor} text-white rounded-full`,
|
|
45
126
|
today: `${lightThemeBg} ${textHighlight}`,
|
|
46
127
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
128
|
+
// open date pickers
|
|
129
|
+
const openStartPicker = () => {
|
|
130
|
+
setIsDatePickerOpen(true);
|
|
131
|
+
setActiveInput("start");
|
|
132
|
+
};
|
|
133
|
+
const openEndPicker = () => {
|
|
134
|
+
setIsDatePickerOpen(true);
|
|
135
|
+
setActiveInput("end");
|
|
136
|
+
};
|
|
137
|
+
const openSinglePicker = () => {
|
|
138
|
+
setActiveInput(null);
|
|
139
|
+
setIsDatePickerOpen((prev) => !prev);
|
|
140
|
+
};
|
|
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
|
|
50
142
|
? selectedStartDate.toLocaleDateString()
|
|
51
|
-
: "Start Date" }), _jsx("span", { className: "mx-2", children: "to" }), _jsx("button", { onClick:
|
|
143
|
+
: "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
|
|
52
144
|
? selectedEndDate.toLocaleDateString()
|
|
53
|
-
: "End Date" })] })) : (
|
|
54
|
-
// Non-toggle mode: Dropdown and a single date input
|
|
55
|
-
_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: () => setIsDatePickerOpen((prev) => !prev), className: "border-2 px-3 py-2 flex-[2] h-10 text-left min-w-40", children: selectedDate
|
|
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
|
|
56
146
|
? selectedDate.toLocaleDateString()
|
|
57
147
|
: "Select Date" })] })) }), toggleStatus
|
|
58
|
-
? 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: (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
setActiveInput(null);
|
|
62
|
-
}, modifiersClassNames: modifiersClassNames })) : (_jsx(DayPicker, { mode: "single", selected: selectedEndDate, onSelect: (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
setActiveInput(null);
|
|
148
|
+
? 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
|
+
onStartDateSelect?.(day || undefined);
|
|
150
|
+
setIsDatePickerOpen(false);
|
|
151
|
+
setActiveInput(null);
|
|
152
|
+
}, modifiersClassNames: modifiersClassNames })) : (_jsx(DayPicker, { mode: "single", selected: selectedEndDate, onSelect: (day) => {
|
|
153
|
+
onEndDateSelect?.(day || undefined);
|
|
154
|
+
setIsDatePickerOpen(false);
|
|
155
|
+
setActiveInput(null);
|
|
66
156
|
}, modifiersClassNames: modifiersClassNames })) }))
|
|
67
|
-
: 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: (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}, modifiersClassNames: modifiersClassNames }) })), _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: handleSubmitClick, shape: "rounded-full" })] })] }));
|
|
157
|
+
: 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
|
+
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" })] })] }));
|
|
71
160
|
}
|
|
72
161
|
export default SearchDatePickerInput;
|