@agilant/toga-blox 1.0.83 → 1.0.84

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.
@@ -2,9 +2,7 @@ import React from "react";
2
2
  import { MultiSelectInputProps, OptionType } from "../MultiSelect/MultiSelect.types";
3
3
  interface SearchDropdownInputProps {
4
4
  options?: OptionType[];
5
- /** The currently‐selected items (each has { name, value } ) **/
6
5
  selectedValue?: OptionType[];
7
- /** Called whenever the selectedValue changes **/
8
6
  onChange: (selected: OptionType[]) => void;
9
7
  placeholder?: string;
10
8
  disabled?: boolean;
@@ -12,22 +10,22 @@ interface SearchDropdownInputProps {
12
10
  bgColor?: string;
13
11
  textHighlight?: string;
14
12
  handleFilter?: () => void;
15
- /** The array of “badges” or stored strings for this particular column’s filter(s) **/
16
13
  searchItems?: string[];
17
14
  setSearchItems?: React.Dispatch<React.SetStateAction<string[]>>;
18
- /** The full array of all column filters for your table **/
19
15
  setSearchCriteria?: React.Dispatch<React.SetStateAction<any[]>>;
20
- /** The column object must have an .id property */
21
16
  column?: {
22
17
  id: string;
23
18
  [key: string]: any;
24
19
  };
25
- /** Tells the parent to close the UI, etc. */
26
20
  setEditingHeader?: React.Dispatch<React.SetStateAction<any>>;
27
21
  /** localStorage key used to store the entire “searchCriteria” array */
28
22
  localStorageKey?: string;
29
23
  otherProps?: MultiSelectInputProps["otherProps"];
30
24
  additionalClasses?: string;
25
+ clearText?: string;
26
+ clearTextColor?: string;
27
+ buttonText?: string;
28
+ buttonColor?: string;
31
29
  }
32
30
  declare const SearchDropdownInput: React.FC<SearchDropdownInputProps>;
33
31
  export default SearchDropdownInput;
@@ -3,7 +3,7 @@ import { useEffect } from "react";
3
3
  import MultiSelectInput from "../MultiSelect/MultiSelect";
4
4
  import updateLocalStorage from "../../utils/updateLocalStorage";
5
5
  const DEFAULT_STORAGE_KEY = "searchCriteria";
6
- 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
+ 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, clearText = "Clear", clearTextColor = "text-sky-500", buttonText = "Filter", buttonColor = "bg-sky-500", localStorageKey = DEFAULT_STORAGE_KEY, ...rest }) => {
7
7
  // Are we able to store filters for this column?
8
8
  const canStore = !!column?.id && !!setSearchCriteria;
9
9
  useEffect(() => {
@@ -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, setSearchCriteria: setSearchCriteria, column: column }));
23
23
  case "multiSelect":
24
- return (_jsx(SearchDropdownInput, { options: dropdownOptions, placeholder: "Search", additionalClasses: "", onChange: onChange, selectedValue: selectedValue, bgColor: bgColor, textHighlight: textHighlight, handleFilter: handleFilter, column: column, setSearchCriteria: setSearchCriteria }));
24
+ return (_jsx(SearchDropdownInput, { options: dropdownOptions, placeholder: "Search", additionalClasses: "", onChange: onChange, selectedValue: selectedValue, bgColor: bgColor, clearText: "Clear", clearTextColor: "text-sky-500", buttonText: "Filter", handleFilter: handleFilter, column: column, setSearchCriteria: setSearchCriteria, textHighlight: textHighlight }));
25
25
  case "date":
26
26
  return (_jsx(SearchDatePickerInput, { textHighlight: textHighlight, dropdownOptions: dropdownOptions, toggleStatus: toggleStatus, setToggleStatus: setToggleStatus, selectedDate: selectedDate, onDateSelect: onDateSelect, selectedStartDate: selectedStartDate, onStartDateSelect: onStartDateSelect, selectedEndDate: selectedEndDate, onEndDateSelect: onEndDateSelect, handleFilter: handleFilter, themeBgColor: dataPickerThemeColor, lightThemeBg: dataPickerThemeColorAccent, setSearchCriteria: setSearchCriteria, column: column, setEditingHeader: setEditingHeader, searchItems: searchItems, setSearchItems: setSearchItems, pillColor: pillColor }));
27
27
  default:
@@ -17,6 +17,8 @@ type SearchDatePickerInputProps<T extends object> = {
17
17
  onStartDateSelect?: (date: Date | undefined) => void;
18
18
  selectedEndDate?: Date;
19
19
  onEndDateSelect?: (date: Date | undefined) => void;
20
+ buttonText?: string;
21
+ buttonColor?: string;
20
22
  searchItems?: string[];
21
23
  setSearchItems?: React.Dispatch<React.SetStateAction<string[]>>;
22
24
  handleFilter?: () => void;
@@ -25,5 +27,5 @@ type SearchDatePickerInputProps<T extends object> = {
25
27
  setEditingHeader?: React.Dispatch<React.SetStateAction<any>>;
26
28
  localStorageKey?: string;
27
29
  };
28
- declare const SearchDatePickerInput: <T extends object>({ themeBgColor, lightThemeBg, pillColor, textHighlight, dropdownOptions, dropdownIconProp, toggleStatus, setToggleStatus, selectedDate, onDateSelect, selectedStartDate, onStartDateSelect, selectedEndDate, onEndDateSelect, searchItems, setSearchItems, handleFilter, setSearchCriteria, column, setEditingHeader, localStorageKey, }: SearchDatePickerInputProps<T>) => import("react/jsx-runtime").JSX.Element;
30
+ declare const SearchDatePickerInput: <T extends object>({ themeBgColor, lightThemeBg, pillColor, textHighlight, dropdownOptions, dropdownIconProp, toggleStatus, setToggleStatus, selectedDate, onDateSelect, selectedStartDate, onStartDateSelect, selectedEndDate, onEndDateSelect, searchItems, setSearchItems, handleFilter, setSearchCriteria, column, setEditingHeader, buttonText, localStorageKey, }: SearchDatePickerInputProps<T>) => import("react/jsx-runtime").JSX.Element;
29
31
  export default SearchDatePickerInput;
@@ -18,7 +18,7 @@ const SearchDatePickerInput = ({ themeBgColor = "bg-sky-500", lightThemeBg = "bg
18
18
  iconClasses: "text-sky-500",
19
19
  name: "chevronDown",
20
20
  weight: "solid",
21
- }, toggleStatus = false, setToggleStatus, selectedDate, onDateSelect, selectedStartDate, onStartDateSelect, selectedEndDate, onEndDateSelect, searchItems = [], setSearchItems, handleFilter, setSearchCriteria, column, setEditingHeader, localStorageKey = "searchCriteria", }) => {
21
+ }, toggleStatus = false, setToggleStatus, selectedDate, onDateSelect, selectedStartDate, onStartDateSelect, selectedEndDate, onEndDateSelect, searchItems = [], setSearchItems, handleFilter, setSearchCriteria, column, setEditingHeader, buttonText = "Filter", localStorageKey = "searchCriteria", }) => {
22
22
  const containerRef = useRef(null);
23
23
  const [isDatePickerOpen, setIsDatePickerOpen] = useState(false);
24
24
  const [activeInput, setActiveInput] = useState(null);
@@ -139,6 +139,6 @@ const SearchDatePickerInput = ({ themeBgColor = "bg-sky-500", lightThemeBg = "bg
139
139
  return filtered;
140
140
  });
141
141
  }
142
- }, 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" })] })] }));
142
+ }, 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: buttonText, backgroundColor: themeBgColor, additionalClasses: "py-1.5 px-6 text-white", borderColor: "border-none", onClick: handleFilterClick, shape: "rounded-full" })] })] }));
143
143
  };
144
144
  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.83",
4
+ "version": "1.0.84",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",