@agilant/toga-blox 1.0.37 → 1.0.39

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.
@@ -5,11 +5,12 @@ export type DropdownProps = {
5
5
  optionClasses?: string;
6
6
  menuClasses?: string;
7
7
  dropdownClasses?: string;
8
- icon?: {
9
- name: string;
10
- weight: "solid" | "regular" | "light" | "duotone" | "brands";
11
- iconClasses?: string;
12
- };
8
+ icon?: DropdownIconProps;
13
9
  selectedOptionBgColor?: string;
14
10
  optionHoverBgColor?: string;
15
11
  };
12
+ export type DropdownIconProps = {
13
+ name: string;
14
+ weight: "solid" | "regular" | "light" | "duotone" | "brands";
15
+ iconClasses?: string;
16
+ };
@@ -1,6 +1,11 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { MultiSelect } from "react-multi-select-component";
3
- const MultiSelectInput = ({ id, name, options = [], selectedValue = [], onChange, placeholder = "Select...", isSearchable = true, isOpen, hasSelectAll = false, disabled = false, isLoading = false, onMenuToggle, overrideStrings, className, width = "w-72", otherProps, }) => {
3
+ import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
4
+ const MultiSelectInput = ({ id, name, options = [], selectedValue = [], onChange, placeholder = {
5
+ text: "Select...",
6
+ icon: "",
7
+ iconStyle: "regular",
8
+ }, isSearchable = true, isOpen, hasSelectAll = false, disabled = false, isLoading = false, onMenuToggle, overrideStrings, className, width = "w-72", otherProps, }) => {
4
9
  // Convert your OptionType to the shape expected by react-multi-select-component.
5
10
  const multiSelectOptions = options.map((option) => ({
6
11
  label: option.name,
@@ -11,6 +16,19 @@ const MultiSelectInput = ({ id, name, options = [], selectedValue = [], onChange
11
16
  label: item.name,
12
17
  value: item.value,
13
18
  }));
19
+ const valueRenderer = (selected, _options) => {
20
+ if (!selected || selected.length === 0) {
21
+ return (_jsxs("span", { className: "flex items-center gap-2 text-gray-500", children: [placeholder?.icon
22
+ ? getFontAwesomeIcon(placeholder.icon)
23
+ : null, placeholder?.text] }));
24
+ }
25
+ // If user selected ALL possible options, show "All items selected"
26
+ if (selected.length === multiSelectOptions.length) {
27
+ return "All items selected";
28
+ }
29
+ // Default behavior: comma-separated labels
30
+ return selected.map((s) => s.label).join(", ");
31
+ };
14
32
  return (_jsx("div", { className: `${width}`, children: _jsx(MultiSelect, { id: id, name: name, className: className, options: multiSelectOptions, value: multiSelectValue, onChange: (selectedOptions) => {
15
33
  // Convert back to OptionType when passing to onChange
16
34
  const mapped = selectedOptions.map((opt) => ({
@@ -23,8 +41,8 @@ const MultiSelectInput = ({ id, name, options = [], selectedValue = [], onChange
23
41
  disableSearch: !isSearchable,
24
42
  // Additional props from react-multi-select-component
25
43
  isOpen: isOpen, hasSelectAll: hasSelectAll, disabled: disabled, isLoading: isLoading, onMenuToggle: onMenuToggle, overrideStrings: {
26
- selectSomeItems: placeholder,
44
+ // selectSomeItems: placeholder,
27
45
  ...overrideStrings,
28
- }, labelledBy: "Select", ...otherProps }) }));
46
+ }, labelledBy: "Select", valueRenderer: valueRenderer, ...otherProps }) }));
29
47
  };
30
48
  export default MultiSelectInput;
@@ -85,7 +85,7 @@ Default.args = {
85
85
  { name: "Option 3", value: "option3" },
86
86
  ],
87
87
  selectedValue: [],
88
- placeholder: "Select options...",
88
+ placeholder: { text: "Select options..." },
89
89
  isSearchable: true,
90
90
  hasSelectAll: false,
91
91
  disabled: false,
@@ -102,7 +102,7 @@ WithSelectAll.args = {
102
102
  { name: "Grape", value: "grape" },
103
103
  ],
104
104
  selectedValue: [],
105
- placeholder: "Select fruits...",
105
+ placeholder: { text: "Select fruits..." },
106
106
  hasSelectAll: true,
107
107
  isSearchable: true,
108
108
  };
@@ -116,7 +116,7 @@ OpenByDefault.args = {
116
116
  { name: "Angular", value: "angular" },
117
117
  ],
118
118
  selectedValue: [],
119
- placeholder: "Pick your JS framework...",
119
+ placeholder: { text: "Pick your JS framework..." },
120
120
  isOpen: true,
121
121
  hasSelectAll: false,
122
122
  };
@@ -130,7 +130,7 @@ Disabled.args = {
130
130
  { name: "Blue", value: "blue" },
131
131
  ],
132
132
  selectedValue: [],
133
- placeholder: "Disabled...",
133
+ placeholder: { text: "Disabled...", icon: "magnifyingGlass" },
134
134
  disabled: true,
135
135
  };
136
136
  export const LoadingState = Template.bind({});
@@ -143,7 +143,7 @@ LoadingState.args = {
143
143
  { name: "Option C", value: "c" },
144
144
  ],
145
145
  selectedValue: [],
146
- placeholder: "Loading...",
146
+ placeholder: { text: "Loading..." },
147
147
  isLoading: true,
148
148
  };
149
149
  export const CustomStrings = Template.bind({});
@@ -9,7 +9,11 @@ export interface MultiSelectInputProps {
9
9
  options?: OptionType[];
10
10
  selectedValue?: OptionType[];
11
11
  onChange: (selected: OptionType[]) => void;
12
- placeholder?: string;
12
+ placeholder?: {
13
+ text?: string;
14
+ icon?: string;
15
+ iconStyle?: string;
16
+ };
13
17
  isSearchable?: boolean;
14
18
  isOpen?: boolean;
15
19
  hasSelectAll?: boolean;
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { OptionType } from "../MultiSelect/MultiSelect.types";
3
+ import "./SearchDrowpdown.scss";
4
+ interface SearchDropdownInputProps {
5
+ options?: OptionType[];
6
+ selectedValue?: OptionType[];
7
+ onChange: (selected: OptionType[]) => void;
8
+ placeholder?: string;
9
+ disabled?: boolean;
10
+ hasSelectAll?: boolean;
11
+ bgColor?: string;
12
+ textHighlight?: string;
13
+ [key: string]: any;
14
+ }
15
+ /**
16
+ * A wrapper around MultiSelectInput that appends a special "__footer__" option
17
+ * and uses a custom item renderer to display "Clear" and "Filter" buttons.
18
+ */
19
+ declare const SearchDropdownInput: React.FC<SearchDropdownInputProps>;
20
+ export default SearchDropdownInput;
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import MultiSelectInput from "../MultiSelect/MultiSelect";
3
+ import "./SearchDrowpdown.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, ...rest }) => {
9
+ const footerOption = [{ name: "", value: "__footer__" }];
10
+ const extendedOptions = [...options, ...footerOption];
11
+ const itemRenderer = ({ option, checked, disabled, onClick }) => {
12
+ // If it's our footer option, display the custom footer row
13
+ 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) => {
15
+ 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
+ console.log("Filter clicked!", selectedValue);
20
+ // ...your custom filter logic
21
+ }, children: "Filter" })] }));
22
+ }
23
+ else if (option.label === "Select All") {
24
+ return (_jsxs("label", { className: "select-all-item", style: {
25
+ display: "flex",
26
+ alignItems: "center",
27
+ padding: "0.5rem 1rem",
28
+ position: "sticky",
29
+ top: 0,
30
+ borderBottom: "1px solid #ccc",
31
+ zIndex: 10,
32
+ }, onClick: (e) => {
33
+ e.stopPropagation();
34
+ onClick(e); // Let the library handle toggling
35
+ }, children: [_jsx("input", { type: "checkbox", checked: checked, readOnly: true, disabled: disabled }), _jsx("span", { style: { marginLeft: "0.5rem" }, children: option.label })] }));
36
+ }
37
+ else {
38
+ 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
+ }
40
+ };
41
+ return (_jsx(MultiSelectInput, { options: extendedOptions, selectedValue: selectedValue, onChange: onChange, placeholder: {
42
+ text: placeholder,
43
+ icon: "magnifyingGlass",
44
+ iconStyle: "regular",
45
+ }, disabled: disabled, hasSelectAll: hasSelectAll,
46
+ /** Provide the custom item renderer and any additional props via otherProps */
47
+ otherProps: {
48
+ ItemRenderer: itemRenderer,
49
+ ...rest.otherProps,
50
+ }, ...rest }));
51
+ };
52
+ export default SearchDropdownInput;
@@ -1,3 +1,3 @@
1
1
  import { SearchInputProps } from "./SearchInput.types";
2
- declare const SearchInput: <T extends object>({ closeOutSearch, setResetSearch, setEditingHeader, pillColor, textHighlight, column, inputType, dropdownIconProp, dropdownOptions, selectedDropdownOption, onDropdownOptionSelect, searchItems, setSearchItems, toggleStatus, setToggleStatus, minValue, setMinValue, maxValue, setMaxValue, control, valueKey, dynamicDefaultValue, }: SearchInputProps<T>) => import("react/jsx-runtime").JSX.Element;
2
+ declare const SearchInput: <T extends object>({ closeOutSearch, setResetSearch, setEditingHeader, bgColor, textHighlight, column, inputType, dropdownIconProp, dropdownOptions, selectedDropdownOption, onDropdownOptionSelect, searchItems, setSearchItems, toggleStatus, setToggleStatus, minValue, setMinValue, maxValue, setMaxValue, control, valueKey, dynamicDefaultValue, onChange, selectedValue, }: SearchInputProps<T>) => import("react/jsx-runtime").JSX.Element;
3
3
  export default SearchInput;
@@ -3,6 +3,7 @@ import { useEffect, useRef, useState } from "react";
3
3
  import SearchTextInput from "./SearchTextInput";
4
4
  import SearchNumberInput from "./SearchNumberInput";
5
5
  import { Controller } from "react-hook-form";
6
+ import SearchDropdownInput from "./SearchDropdownInput";
6
7
  // A simple helper function for default values
7
8
  function getDefaultValue(dynamicDefaultValue, valueKey) {
8
9
  if (typeof dynamicDefaultValue !== "undefined") {
@@ -10,11 +11,11 @@ function getDefaultValue(dynamicDefaultValue, valueKey) {
10
11
  }
11
12
  return "";
12
13
  }
13
- const SearchInput = ({ closeOutSearch, setResetSearch, setEditingHeader, pillColor = "bg-sky-500", textHighlight = "text-sky-500", column, inputType = "text", dropdownIconProp = {
14
+ const SearchInput = ({ closeOutSearch, setResetSearch, setEditingHeader, bgColor = "bg-sky-500", textHighlight = "text-sky-500", column, inputType = "text", dropdownIconProp = {
14
15
  name: "chevronDown",
15
16
  weight: "bold",
16
17
  iconClasses: "text-black",
17
- }, dropdownOptions = [], selectedDropdownOption = "", onDropdownOptionSelect, searchItems = [], setSearchItems, toggleStatus = false, setToggleStatus, minValue, setMinValue, maxValue, setMaxValue, control, valueKey, dynamicDefaultValue, }) => {
18
+ }, dropdownOptions = [], selectedDropdownOption = "", onDropdownOptionSelect, searchItems = [], setSearchItems, toggleStatus = false, setToggleStatus, minValue, setMinValue, maxValue, setMaxValue, control, valueKey, dynamicDefaultValue, onChange, selectedValue, }) => {
18
19
  const containerRef = useRef(null);
19
20
  const [localSearchText, setLocalSearchText] = useState("");
20
21
  const inputRef = useRef(null);
@@ -48,6 +49,10 @@ const SearchInput = ({ closeOutSearch, setResetSearch, setEditingHeader, pillCol
48
49
  case "number":
49
50
  return (_jsx(SearchNumberInput, { closeOutSearch: () => { }, setResetSearch: () => { }, setEditingHeader: () => { }, column: undefined, dropdownIconProp: dropdownIconProp, dropdownOptions: dropdownOptions, selectedDropdownOption: selectedDropdownOption, onDropdownOptionSelect: onDropdownOptionSelect, toggleStatus: toggleStatus, setToggleStatus: setToggleStatus, minValue: minValue, maxValue: maxValue, setMinValue: setMinValue, setMaxValue: setMaxValue }));
50
51
  case "multiSelect":
52
+ {
53
+ console.log(dropdownOptions, "dropdownOptions");
54
+ }
55
+ 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 }));
51
56
  case "boolean":
52
57
  case "date":
53
58
  // Make sure control & valueKey exist before using them
@@ -4,4 +4,6 @@ export default _default;
4
4
  export declare const Default: any;
5
5
  export declare const TextInput: any;
6
6
  export declare const NumberInput: any;
7
+ export declare const DropdownInput: any;
8
+ export declare const BooleanInput: any;
7
9
  export declare const DisabledInput: any;
@@ -33,6 +33,14 @@ export default {
33
33
  action: "selected",
34
34
  description: "Callback when dropdown option is selected",
35
35
  },
36
+ searchItems: {
37
+ control: "array",
38
+ description: "Array of search items",
39
+ },
40
+ selectedValue: {
41
+ control: "array",
42
+ description: "Array of selected values",
43
+ },
36
44
  },
37
45
  parameters: { layout: "centered" },
38
46
  };
@@ -47,7 +55,15 @@ const Template = (args) => {
47
55
  const [toggleStatus, setToggleStatus] = useState(false);
48
56
  const [minValue, setMinValue] = useState();
49
57
  const [maxValue, setMaxValue] = useState();
50
- return (_jsx(SearchInput, { ...args, selectedDropdownOption: selectedOption, onDropdownOptionSelect: (option) => setSelectedOption(option), searchItems: searchItems, setSearchItems: setSearchItems, toggleStatus: toggleStatus, setToggleStatus: setToggleStatus, minValue: minValue, maxValue: maxValue, setMinValue: setMinValue, setMaxValue: setMaxValue }));
58
+ const [selectedValue, setSelectedValue] = useState(args.selectedValue || []);
59
+ // Handle onChange from the multi-select
60
+ const handleOnChange = (newSelected) => {
61
+ setSelectedValue(newSelected);
62
+ // Call the original onChange if provided in the story args
63
+ args.onChange?.(newSelected);
64
+ console.log("Selected items:", newSelected);
65
+ };
66
+ return (_jsx(SearchInput, { ...args, 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 }));
51
67
  };
52
68
  export const Default = Template.bind({});
53
69
  Default.args = {
@@ -95,6 +111,55 @@ NumberInput.args = {
95
111
  dropdownOptions: ["Exactly", "Less Than", "Greater Than"],
96
112
  selectedDropdownOption: "Exactly",
97
113
  };
114
+ export const DropdownInput = Template.bind({});
115
+ DropdownInput.args = {
116
+ inputType: "multiSelect",
117
+ column: mockColumn,
118
+ closeOutSearch: (value) => console.log(`Search cleared: ${value}`),
119
+ setResetSearch: () => console.log("Reset search triggered"),
120
+ setEditingHeader: (value) => console.log(`Editing header: ${value}`),
121
+ placeholder: "Search",
122
+ dropdownOptions: [
123
+ { uuid: "1", name: "Option 1", value: "option1" },
124
+ { uuid: "2", name: "Option 2", value: "option2" },
125
+ { uuid: "3", name: "Option 3", value: "option3" },
126
+ ],
127
+ /** For multi-select, `value` is typically an array */
128
+ selectedValue: [],
129
+ // onChange: (selected: OptionType[]) => {
130
+ // console.log("Selected items:", selected);
131
+ // },
132
+ /** Additional props you might want to set */
133
+ isSearchable: true,
134
+ hasSelectAll: true,
135
+ disabled: false,
136
+ isLoading: false,
137
+ type: "multiSelect",
138
+ // etc...
139
+ };
140
+ export const BooleanInput = Template.bind({});
141
+ BooleanInput.args = {
142
+ inputType: "multiSelect",
143
+ column: mockColumn,
144
+ closeOutSearch: (value) => console.log(`Search cleared: ${value}`),
145
+ setResetSearch: () => console.log("Reset search triggered"),
146
+ setEditingHeader: (value) => console.log(`Editing header: ${value}`),
147
+ placeholder: "Search",
148
+ dropdownOptions: [
149
+ { uuid: "1", name: "True", value: "true" },
150
+ { uuid: "2", name: "False", value: "false" },
151
+ ],
152
+ selectedValue: [],
153
+ // onChange: (selected: OptionType[]) => {
154
+ // console.log("Selected items:", selected);
155
+ // },
156
+ isSearchable: true,
157
+ hasSelectAll: true,
158
+ disabled: false,
159
+ isLoading: false,
160
+ type: "multiSelect",
161
+ // etc...
162
+ };
98
163
  export const DisabledInput = Template.bind({});
99
164
  DisabledInput.args = {
100
165
  inputType: "text",
@@ -5,17 +5,20 @@ type ColumnWithAccessor<T extends object> = ColumnInstance<T> & {
5
5
  accessor?: string | number | symbol | Accessor<T>;
6
6
  };
7
7
  export type SearchInputProps<T extends object> = {
8
+ onChange(newSelected: OptionType[]): unknown;
9
+ selectedValue: any[];
10
+ value: any[];
8
11
  closeOutSearch: (value: number | null) => void;
9
12
  setResetSearch: React.Dispatch<React.SetStateAction<boolean>>;
10
13
  columHeader?: any;
11
14
  column: ColumnWithAccessor<T>;
12
15
  parentIndex?: number;
13
16
  setEditingHeader: (value: number | null) => void;
14
- pillColor?: string;
17
+ bgColor?: string;
15
18
  textHighlight?: string;
16
19
  inputType?: string;
17
- dropdownOptions?: string[];
18
- selectedDropdownOption?: string;
20
+ dropdownOptions?: string[] | OptionType[] | number[];
21
+ selectedDropdownOption?: string | OptionType | number;
19
22
  onDropdownOptionSelect?: (option: string) => void;
20
23
  dropdownIconProp?: searchDropdownIconProps;
21
24
  searchItems?: string[] | number[];
@@ -30,6 +33,12 @@ export type SearchInputProps<T extends object> = {
30
33
  valueKey?: string;
31
34
  dynamicDefaultValue?: any;
32
35
  };
36
+ export interface OptionType {
37
+ uuid: string;
38
+ name: string;
39
+ value: string;
40
+ label: string;
41
+ }
33
42
  export type searchDropdownIconProps = {
34
43
  name: string;
35
44
  weight: string;
@@ -53,7 +53,7 @@ const SearchNumberInput = ({ closeOutSearch, setResetSearch, setEditingHeader, t
53
53
  handleSubmitClick();
54
54
  }
55
55
  };
56
- return (_jsx("div", { ref: containerRef, className: "", children: _jsxs("div", { className: `flex flex-col p-4 w-[425px] h-[130px] border-2 border-navy-200 rounded-md`, children: [_jsx("div", { className: `flex flex-[1] ${toggleStatus ? "" : "border-2"} h-full max-h-11 items-center justify-around`, children: toggleStatus ? (_jsxs(_Fragment, { children: [_jsx(Input, { focusRingColor: "focus:ring-2", hasAutoFocus: true, value: minValue, iconColor: "text-navy-400", onKeyDown: handleKeyDown, required: false, id: "", name: "", type: "number", onChange: handleInputChange, additionalClasses: "min-w-[180px] max-w-[180px] h-10 text-gray flex border-2 focus:border-transparent ", placeholder: "Min" }), _jsx(Text, { size: "text-md", tag: "span", text: "to", additionalClasses: "px-2" }), _jsx(Input, { focusRingColor: "focus:ring-2", value: maxValue, iconColor: "text-navy-400", onKeyDown: handleKeyDown, required: false, id: "", name: "", type: "number", onChange: handleMaximumInputChange, additionalClasses: "min-w-[180px] max-w-[180px] h-10 text-gray flex border-2 focus:border-transparent ", placeholder: "Max", hasIcons: true, iconPosition: "both" })] })) : (_jsxs(_Fragment, { children: [_jsx(Dropdown, { options: dropdownOptions, selectedOption: selectedDropdownOption, onOptionSelect: onDropdownOptionSelect, optionClasses: "px-4 h-full flex items-center", menuClasses: "bg-white min-w-32 top-[-8px] left-[-2px]", dropdownClasses: "border-0 border-r-2", icon: dropdownIconProp }), _jsx(Input, { focusRingColor: "focus:ring-transparent", hasAutoFocus: true, value: minValue, iconColor: "text-navy-400", onKeyDown: handleKeyDown, required: false, id: "", name: "", type: "number", onChange: handleInputChange, additionalClasses: "min-w-[250px] max-w-[250px] h-10 text-gray flex ", placeholder: "Amount", hasIcons: true, iconPosition: "both" })] })) }), _jsxs("div", { className: "flex flex-[1] justify-between items-end bg-white px-2 rounded-md ", children: [_jsx(ToggleButton, { initialStatus: toggleStatus, onClick: () => {
56
+ return (_jsx("div", { ref: containerRef, className: "w-[425px]", children: _jsxs("div", { className: `flex flex-col p-4 h-[130px] border-2 border-navy-200 rounded-md`, children: [_jsx("div", { className: `flex flex-[1] ${toggleStatus ? "" : "border-2"} h-full max-h-11 items-center justify-around`, children: toggleStatus ? (_jsxs(_Fragment, { children: [_jsx(Input, { focusRingColor: "focus:ring-2", hasAutoFocus: true, value: minValue, iconColor: "text-navy-400", onKeyDown: handleKeyDown, required: false, id: "", name: "", type: "number", onChange: handleInputChange, additionalClasses: "min-w-[180px] max-w-[180px] h-10 text-gray flex border-2 focus:border-transparent ", placeholder: "Min" }), _jsx(Text, { size: "text-md", tag: "span", text: "to", additionalClasses: "px-2" }), _jsx(Input, { focusRingColor: "focus:ring-2", value: maxValue, iconColor: "text-navy-400", onKeyDown: handleKeyDown, required: false, id: "", name: "", type: "number", onChange: handleMaximumInputChange, additionalClasses: "min-w-[180px] max-w-[180px] h-10 text-gray flex border-2 focus:border-transparent ", placeholder: "Max", hasIcons: true, iconPosition: "both" })] })) : (_jsxs(_Fragment, { children: [_jsx(Dropdown, { options: dropdownOptions, selectedOption: selectedDropdownOption, onOptionSelect: onDropdownOptionSelect, optionClasses: "px-4 h-full flex items-center", menuClasses: "bg-white w-min-[150px] top-[-8px] left-[-2px]", dropdownClasses: "border-0 border-r-2 w-auto", icon: dropdownIconProp }), _jsx(Input, { focusRingColor: "focus:ring-transparent", hasAutoFocus: true, value: minValue, iconColor: "text-navy-400", onKeyDown: handleKeyDown, required: false, id: "", name: "", type: "number", onChange: handleInputChange, additionalClasses: "min-w-[200px] h-10 text-gray flex ", placeholder: "Amount", hasIcons: true, iconPosition: "both" })] })) }), _jsxs("div", { className: "flex flex-[1] justify-between items-end bg-white px-2 rounded-md ", children: [_jsx(ToggleButton, { initialStatus: toggleStatus, onClick: () => {
57
57
  setToggleStatus(!toggleStatus);
58
58
  }, 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" })] })] }) }));
59
59
  };
@@ -54,7 +54,7 @@ const SearchTextInput = ({ closeOutSearch, setResetSearch, setEditingHeader, pil
54
54
  }
55
55
  };
56
56
  const pillClassnames = `${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`;
57
- return (_jsx("div", { ref: containerRef, className: "", children: _jsxs("div", { className: "flex flex-col border-2 border-navy-200 rounded-md", children: [_jsxs("div", { className: `flex ${searchItems.length ? "border-b-2" : ""} h-full`, children: [_jsx(Dropdown, { options: dropdownOptions, selectedOption: selectedDropdownOption, onOptionSelect: onDropdownOptionSelect, optionClasses: "px-4 py-1 h-full flex items-center", menuClasses: "bg-white min-w-32", icon: dropdownIconProp, dropdownClasses: "border-0 border-r-2" }), _jsx(Input, { focusRingColor: "focus:ring-transparent", hasAutoFocus: true, value: localSearchText, iconColor: "text-navy-400", onKeyDown: handleKeyDown, required: false, id: "", name: "", type: "text", onChange: handleInputChange, additionalClasses: "min-w-[250px] max-w-[250px] min-h-full text-gray flex ", placeholder: "Search", hasIcons: true, firstIcon: localSearchText === "" ? (_jsx(AnimatePresence, { children: _jsx(motion.div, { initial: "initial", animate: "animate", exit: "exit", className: "text-navy-400", children: getFontAwesomeIcon("search", "regular") }) })) : undefined, iconPosition: "both", secondIcon: _jsx("div", { className: "border-transparent text-white min-w-9", children: _jsx(AnimatePresence, { children: localSearchText !== "" && (_jsxs(motion.div, { className: "flex justify-between items-center min-w-4 text-navy-400 hover:cursor-pointer hover:text-primary", initial: "initial", animate: "animate", exit: "exit", children: [_jsx("div", { className: "bg-navy-50 pr-2 pl-1 text-gray-500", onClick: () => {
57
+ return (_jsx("div", { ref: containerRef, className: "w-[425px]", children: _jsxs("div", { className: "flex flex-col border-2 border-navy-200 rounded-md", children: [_jsxs("div", { className: `flex ${searchItems.length ? "border-b-2" : ""} h-full`, children: [_jsx(Dropdown, { options: dropdownOptions, selectedOption: selectedDropdownOption, onOptionSelect: onDropdownOptionSelect, optionClasses: "px-4 py-1 h-full flex items-center", menuClasses: "bg-white min-w-32", icon: dropdownIconProp, dropdownClasses: "border-0 border-r-2 w-auto" }), _jsx(Input, { focusRingColor: "focus:ring-transparent", hasAutoFocus: true, value: localSearchText, iconColor: "text-navy-400", onKeyDown: handleKeyDown, required: false, id: "", name: "", type: "text", onChange: handleInputChange, additionalClasses: " min-w-[250px] min-h-full text-gray flex", placeholder: "Search", hasIcons: true, firstIcon: localSearchText === "" ? (_jsx(AnimatePresence, { children: _jsx(motion.div, { initial: "initial", animate: "animate", exit: "exit", className: "text-navy-400", children: getFontAwesomeIcon("search", "regular") }) })) : undefined, iconPosition: "both", secondIcon: _jsx("div", { className: "border-transparent text-white min-w-9", children: _jsx(AnimatePresence, { children: localSearchText !== "" && (_jsxs(motion.div, { className: "flex justify-between items-center min-w-4 text-navy-400 hover:cursor-pointer hover:text-primary", initial: "initial", animate: "animate", exit: "exit", children: [_jsx("div", { className: "bg-navy-50 pr-2 pl-1 text-gray-500", onClick: () => {
58
58
  setLocalSearchText("");
59
59
  }, children: getFontAwesomeIcon("xmark", "regular") }), _jsx("div", { className: `${textHighlight} text-sm hover:text-primary`, children: getFontAwesomeIcon("search", "solid") })] })) }) }), onIconClick: () => {
60
60
  setLocalSearchText("");
@@ -26,7 +26,7 @@ const SortArrows = ({ column, setSortColumn, slug, isNested, parentIndex, onSort
26
26
  setShowArrowContainer(false);
27
27
  onRequestClose?.();
28
28
  };
29
- return (_jsxs("div", { "data-testid": `sort-arrows-${slug}`, ref: containerRef, className: arrowContainerClassNames, onClick: handleParentClick, children: [isActive && (_jsxs("div", { className: `${counterIcon.iconClassNames} ${activeDirection === "desc" ? "rotate-180" : ""}`, children: [_jsx("span", { className: `${counterIcon?.numberSize}`, children: getFontAwesomeIcon(counterIcon.icon, counterIcon.weight) }), _jsx("div", { className: `${activeDirection === "desc" ? "rotate-180" : ""} ${counterIcon.numberClassNames} `, children: sortOrderNumber })] })), !isActive && (_jsxs(_Fragment, { children: [_jsx(SortArrowIcon, { slug: slug, parentIndex: parentIndex, columnName: String(column.render("Header")), direction: "up", setColumn: () => { }, isActive: false }), _jsx(SortArrowIcon, { slug: slug, parentIndex: parentIndex, columnName: String(column.render("Header")), direction: "down", setColumn: () => { }, isActive: false })] })), showArrowContainer && (_jsxs(motion.div, { className: `z-[9989] bg-white rounded flex flex-col border-1 absolute top-6 w-32 ${column.id === "col1" ? "left-[5px]" : ""}`, initial: "initial", animate: "animate", exit: "exit", children: [activeDirection !== "asc" && (_jsxs("div", { className: "flex border-b-1 p-1 hover:bg-blue-50", onClick: () => handleClick("up"), children: [_jsx("span", { className: "pl-1 text-primary", children: getFontAwesomeIcon("arrowUp", "regular") }), _jsx("span", { className: "flex-1 text-left pl-4", children: "Ascending" })] })), activeDirection !== "desc" && (_jsxs("div", { className: "flex p-1 hover:bg-blue-50 border-b-1", onClick: () => handleClick("down"), children: [_jsx("span", { className: "pl-1 text-primary", children: getFontAwesomeIcon("arrowDown", "regular") }), _jsx("span", { className: "flex-1 text-left pl-4", children: "Descending" })] })), isActive && (_jsxs("div", { className: "flex border-b-1 p-1 hover:bg-blue-50", onClick: handleResetSort, children: [_jsx("span", { className: "pl-1 text-primary", children: getFontAwesomeIcon("rotateLeft", "solid") }), _jsx("span", { className: "flex-1 text-left pl-3", children: "Reset" })] }))] })), showArrowContainer &&
29
+ return (_jsxs("div", { "data-testid": `sort-arrows-${slug}`, ref: containerRef, className: arrowContainerClassNames, onClick: handleParentClick, children: [isActive && (_jsxs("div", { className: "relative", children: [_jsx("div", { className: `${counterIcon.iconClassNames} ${activeDirection === "desc" ? "rotate-180" : ""}`, children: _jsx("span", { className: `${counterIcon?.numberSize}`, children: getFontAwesomeIcon(counterIcon.icon, counterIcon.weight) }) }), _jsx("span", { className: `${counterIcon.numberClassNames} ${activeDirection === "desc" && " pb-0.5"}`, children: sortOrderNumber })] })), !isActive && (_jsxs(_Fragment, { children: [_jsx(SortArrowIcon, { slug: slug, parentIndex: parentIndex, columnName: String(column.render("Header")), direction: "up", setColumn: () => { }, isActive: false }), _jsx(SortArrowIcon, { slug: slug, parentIndex: parentIndex, columnName: String(column.render("Header")), direction: "down", setColumn: () => { }, isActive: false })] })), showArrowContainer && (_jsxs(motion.div, { className: `z-[9989] bg-white rounded flex flex-col border-1 absolute top-6 w-32 ${column.id === "col1" ? "left-[5px]" : ""}`, initial: "initial", animate: "animate", exit: "exit", children: [activeDirection !== "asc" && (_jsxs("div", { className: "flex border-b-1 p-1 hover:bg-blue-50", onClick: () => handleClick("up"), children: [_jsx("span", { className: "pl-1 text-primary", children: getFontAwesomeIcon("arrowUp", "regular") }), _jsx("span", { className: "flex-1 text-left pl-4", children: "Ascending" })] })), activeDirection !== "desc" && (_jsxs("div", { className: "flex p-1 hover:bg-blue-50 border-b-1", onClick: () => handleClick("down"), children: [_jsx("span", { className: "pl-1 text-primary", children: getFontAwesomeIcon("arrowDown", "regular") }), _jsx("span", { className: "flex-1 text-left pl-4", children: "Descending" })] })), isActive && (_jsxs("div", { className: "flex border-b-1 p-1 hover:bg-blue-50", onClick: handleResetSort, children: [_jsx("span", { className: "pl-1 text-primary", children: getFontAwesomeIcon("rotateLeft", "solid") }), _jsx("span", { className: "flex-1 text-left pl-3", children: "Reset" })] }))] })), showArrowContainer &&
30
30
  renderPortalOverlay &&
31
31
  renderPortalOverlay(handleClose)] }));
32
32
  };
@@ -33,9 +33,9 @@ export const WithOverlayAndIndexCount = {
33
33
  return (_jsx("div", { className: "size-96", children: _jsx(SortArrows, { counterIcon: {
34
34
  icon: "triangle",
35
35
  weight: "solid",
36
- numberClassNames: "text-white text-[20px] text-red-400 rounded-full top-1.5 right-0 left-0",
37
- iconClassNames: "text-blue-400 hover:text-red-400 p-4",
38
- numberSize: "text-[50px]",
36
+ numberClassNames: " absolute bottom-1.5 left-[10px] text-xs",
37
+ iconClassNames: "text-green-500 hover:text-red-400 text-2xl",
38
+ numberSize: " text-red-500 top-0",
39
39
  }, column: column, setSortColumn: setSortColumn, slug: "products", renderPortalOverlay: (onClose) => (_jsx("div", { className: "absolute top-0 left-0 w-[300px] h-[300px] bg-black bg-opacity-50 flex items-center justify-center", onClick: onClose })) }) }));
40
40
  },
41
41
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agilant/toga-blox",
3
3
  "private": false,
4
- "version": "1.0.37",
4
+ "version": "1.0.39",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -40,6 +40,7 @@
40
40
  "react-select": "^5.10.0",
41
41
  "react-table": "^7.8.0",
42
42
  "react-table-sticky": "^1.1.3",
43
+ "sass": "^1.83.4",
43
44
  "storybook-addon-react-router-v6": "^2.0.15",
44
45
  "tslib": "^2.3.0"
45
46
  },