@agilant/toga-blox 1.0.46 → 1.0.48
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.
- package/dist/components/Dropdown/Dropdown.js +1 -1
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Input/Input.js +5 -9
- package/dist/components/MagnifyingIcon/MagnifyingIcon.js +1 -1
- package/dist/components/MagnifyingIcon/MagnifyingIcon.stories.js +1 -0
- package/dist/components/SearchInput/SearchDropdownInput.d.ts +1 -0
- package/dist/components/SearchInput/SearchDropdownInput.js +2 -3
- package/dist/components/SearchInput/SearchInput.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.js +9 -51
- package/dist/components/SearchInput/SearchInput.stories.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.stories.js +32 -53
- package/dist/components/SearchInput/SearchInput.test.d.ts +1 -0
- package/dist/components/SearchInput/SearchInput.test.js +519 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts +8 -12
- package/dist/components/SearchInput/SearchInputDatePicker.d.ts +23 -0
- package/dist/components/SearchInput/SearchInputDatePicker.js +72 -0
- package/dist/components/SearchInput/SearchNumberInput.d.ts +2 -14
- package/dist/components/SearchInput/SearchNumberInput.js +16 -35
- package/dist/components/SearchInput/SearchTextInput.d.ts +2 -11
- package/dist/components/SearchInput/SearchTextInput.js +5 -24
- package/package.json +2 -1
|
@@ -9,7 +9,7 @@ const Dropdown = ({ options, selectedOption, onOptionSelect, optionClasses = "fl
|
|
|
9
9
|
}, selectedOptionBgColor = "bg-gray-50", optionHoverBgColor = "hover:bg-gray-50", }) => {
|
|
10
10
|
const [showMenu, setShowMenu] = useState(false);
|
|
11
11
|
const toggleMenu = () => setShowMenu(!showMenu);
|
|
12
|
-
return (_jsxs("div", { className: `flex items-center justify-between relative min-w-32
|
|
12
|
+
return (_jsxs("div", { className: `flex items-center justify-between relative min-w-32 ${dropdownClasses}`, children: [_jsxs("div", { onClick: toggleMenu, className: `flex cursor-pointer items-center group h-full `, children: [_jsx("div", { className: `font-bold ${optionClasses}`, children: selectedOption }), _jsx("div", { className: `transform transition-transform duration-200 mx-1 px-1 rounded-full relative ${icon.iconClasses} ${showMenu ? "rotate-180" : "rotate-0"}`, "data-testid": "dropdown-icon", children: getFontAwesomeIcon(icon.name) })] }), showMenu && (_jsx(AnimatePresence, { children: showMenu && (_jsx(motion.div, { initial: { opacity: 0, y: -10 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -10 }, className: `absolute top-0 z-10 right-0 left-0 ${menuClasses}`, children: _jsx("ul", { children: options.map((action) => (_jsxs("li", { className: `text-left px-4 py-2 cursor-pointer border-b ${action === selectedOption
|
|
13
13
|
? `{${selectedOptionBgColor} font-semibold}`
|
|
14
14
|
: `${optionHoverBgColor} text-black`}`, onClick: () => {
|
|
15
15
|
onOptionSelect(action);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { UseFormRegister } from "react-hook-form";
|
|
2
3
|
interface InputFieldProps {
|
|
3
4
|
label?: string;
|
|
4
5
|
value?: string | number;
|
|
@@ -25,6 +26,7 @@ interface InputFieldProps {
|
|
|
25
26
|
labelClasses?: string;
|
|
26
27
|
disabled?: boolean;
|
|
27
28
|
hasAutoFocus?: boolean;
|
|
29
|
+
register?: UseFormRegister<any>;
|
|
28
30
|
focusRingColor?: string;
|
|
29
31
|
}
|
|
30
32
|
declare const InputField: React.ForwardRefExoticComponent<InputFieldProps & React.RefAttributes<unknown>>;
|
|
@@ -2,9 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
|
|
3
3
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
4
|
import { useState, forwardRef } from "react";
|
|
5
|
-
const InputField = forwardRef(({ label, placeholder, required = false, checked, id, name, type = "text", firstIcon, secondIcon, iconPosition = "before", iconColor = "primary", isValid = true, isReadOnly = false, onChange, value, readOnlyInfo = "", toolTipText = "", hasToolTip = false, additionalClasses = "", labelClasses = "", hasAutoFocus, onIconClick, onKeyDown, disabled,
|
|
6
|
-
// register,
|
|
7
|
-
focusRingColor = "focus:ring-transparent", }) => {
|
|
5
|
+
const InputField = forwardRef(({ label, placeholder, required = false, checked, id, name, type = "text", firstIcon, secondIcon, iconPosition = "before", iconColor = "primary", isValid = true, isReadOnly = false, onChange, value, readOnlyInfo = "", toolTipText = "", hasToolTip = false, additionalClasses = "", labelClasses = "", hasAutoFocus, onIconClick, onKeyDown, disabled, register, focusRingColor = "focus:ring-transparent", }) => {
|
|
8
6
|
const [isFocused, setIsFocused] = useState(false);
|
|
9
7
|
const hasValue = value != null && !!value.toString().trim(); // Check if input value has at least one non-space character
|
|
10
8
|
const isNumberInput = type === "number";
|
|
@@ -47,17 +45,15 @@ focusRingColor = "focus:ring-transparent", }) => {
|
|
|
47
45
|
return null;
|
|
48
46
|
}
|
|
49
47
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
const registerProps = register
|
|
49
|
+
? register(name || "", { required })
|
|
50
|
+
: {};
|
|
53
51
|
return isReadOnly ? (_jsxs("div", { className: "input-wrapper relative", children: [renderIcons(), _jsxs("label", { htmlFor: id, className: `block font-light text-left mb-1 ${labelClasses} `, children: [label, hasToolTip && (_jsxs("span", { className: "pl-4 group", children: [_jsx(FontAwesomeIcon, { icon: faCircleInfo, className: "text-primary group-hover:text-blue-600" }), _jsx("span", { className: "opacity-0 group-hover:opacity-100 bg-gray-800 text-white text-sm rounded-md px-2 py-1 absolute top-[-14px]", children: toolTipText })] }))] }), _jsx("div", { className: `
|
|
54
52
|
text-left focus:outline-none focus:ring-2 block w-full py-2 px-2 rounded-lg shadow-input outline outline-0 outline-barelyPrimary focus:outline-4 md:w-full lg:w-full xl:w-full
|
|
55
53
|
${firstIcon ? "pl-10" : ""}
|
|
56
54
|
${secondIcon ? "pr-10" : ""}
|
|
57
55
|
${additionalClasses}
|
|
58
|
-
`, children: readOnlyInfo }), iconPosition === "after" && renderSecondIcon()] })) : (_jsxs(_Fragment, { children: [label && (_jsxs("label", { htmlFor: id, className: ` block font-light text-left mb-1 ${labelClasses}`, children: [label, hasToolTip && (_jsxs("span", { className: "pl-4 group", children: [_jsx(FontAwesomeIcon, { icon: faCircleInfo, className: "text-primary group-hover:text-blue-600" }), _jsx("span", { className: "opacity-0 group-hover:opacity-100 bg-gray-800 text-white text-sm rounded-md px-2 py-1 absolute top-[-14px]", children: toolTipText })] }))] })), _jsxs("div", { className: " input-wrapper relative", children: [renderIcons(), _jsx("input", { autoComplete: "",
|
|
59
|
-
// {...registerProps}
|
|
60
|
-
className: `rounded-md focused:ring-0 ${focusRingColor} focus:ring-1
|
|
56
|
+
`, children: readOnlyInfo }), iconPosition === "after" && renderSecondIcon()] })) : (_jsxs(_Fragment, { children: [label && (_jsxs("label", { htmlFor: id, className: ` block font-light text-left mb-1 ${labelClasses}`, children: [label, hasToolTip && (_jsxs("span", { className: "pl-4 group", children: [_jsx(FontAwesomeIcon, { icon: faCircleInfo, className: "text-primary group-hover:text-blue-600" }), _jsx("span", { className: "opacity-0 group-hover:opacity-100 bg-gray-800 text-white text-sm rounded-md px-2 py-1 absolute top-[-14px]", children: toolTipText })] }))] })), _jsxs("div", { className: " input-wrapper relative", children: [renderIcons(), _jsx("input", { autoComplete: "", ...registerProps, className: `rounded-md focused:ring-0 ${focusRingColor} focus:ring-1
|
|
61
57
|
focus:outline-none
|
|
62
58
|
${disabled
|
|
63
59
|
? "border-gray-500 focus:ring-gray-500"
|
|
@@ -53,6 +53,6 @@ const MagnifyingIcon = forwardRef(({ columnIndex, editingHeader, setEditingHeade
|
|
|
53
53
|
};
|
|
54
54
|
return (_jsx("div", { ref: ref, "data-testid": "magnifying-icon-test-id", className: `flex items-center cursor-pointer size-[18px] rounded relative ml-1 ${iconColor} ${showActiveStyles
|
|
55
55
|
? `${iconActiveBackgroundColor} hover:bg-blue-500 still-active`
|
|
56
|
-
: "hover:bg-white"}`, onClick: handleClick, children: _jsx("div", { className: `text-xs w-full ${additionalIconClasses}
|
|
56
|
+
: "hover:bg-white"}`, onClick: handleClick, children: _jsx("div", { className: `text-xs w-full ${additionalIconClasses} `, children: getFontAwesomeIcon("magnifyingGlass", "solid") }) }));
|
|
57
57
|
});
|
|
58
58
|
export default MagnifyingIcon;
|
|
@@ -5,7 +5,7 @@ import "./SearchDrowpdown.scss";
|
|
|
5
5
|
* A wrapper around MultiSelectInput that appends a special "__footer__" option
|
|
6
6
|
* and uses a custom item renderer to display "Clear" and "Filter" buttons.
|
|
7
7
|
*/
|
|
8
|
-
const SearchDropdownInput = ({ options = [], selectedValue = [], onChange, placeholder = "Select
|
|
8
|
+
const SearchDropdownInput = ({ options = [], selectedValue = [], onChange, placeholder = "Select", disabled = false, hasSelectAll = true, bgColor, textHighlight, handleFilter, ...rest }) => {
|
|
9
9
|
const footerOption = [{ name: "", value: "__footer__" }];
|
|
10
10
|
const extendedOptions = [...options, ...footerOption];
|
|
11
11
|
const itemRenderer = ({ option, checked, disabled, onClick }) => {
|
|
@@ -16,8 +16,7 @@ const SearchDropdownInput = ({ options = [], selectedValue = [], onChange, place
|
|
|
16
16
|
onChange([]); // Clear all selections
|
|
17
17
|
}, children: "Clear" }), _jsx("button", { type: "button", className: `${bgColor} text-white px-3 py-1 rounded`, onClick: (e) => {
|
|
18
18
|
e.stopPropagation();
|
|
19
|
-
|
|
20
|
-
// ...your custom filter logic
|
|
19
|
+
handleFilter();
|
|
21
20
|
}, children: "Filter" })] }));
|
|
22
21
|
}
|
|
23
22
|
else if (option.label === "Select All") {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SearchInputProps } from "./SearchInput.types";
|
|
2
|
-
declare const SearchInput: <T extends object>({
|
|
2
|
+
declare const SearchInput: <T extends object>({ bgColor, textHighlight, inputType, dropdownIconProp, dropdownOptions, selectedDropdownOption, onDropdownOptionSelect, searchItems, setSearchItems, toggleStatus, setToggleStatus, minValue, setMinValue, maxValue, setMaxValue, onChange, selectedValue, selectedDate, onDateSelect, selectedStartDate, onStartDateSelect, selectedEndDate, onEndDateSelect, handleFilter, }: SearchInputProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default SearchInput;
|
|
@@ -1,71 +1,29 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import { useEffect, useRef
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
3
|
import SearchTextInput from "./SearchTextInput";
|
|
4
4
|
import SearchNumberInput from "./SearchNumberInput";
|
|
5
|
-
import { Controller } from "react-hook-form";
|
|
6
5
|
import SearchDropdownInput from "./SearchDropdownInput";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (typeof dynamicDefaultValue !== "undefined") {
|
|
10
|
-
return dynamicDefaultValue;
|
|
11
|
-
}
|
|
12
|
-
return "";
|
|
13
|
-
}
|
|
14
|
-
const SearchInput = ({ closeOutSearch, setResetSearch, setEditingHeader, bgColor = "bg-sky-500", textHighlight = "text-sky-500", column, inputType = "text", dropdownIconProp = {
|
|
6
|
+
import SearchDatePickerInput from "./SearchInputDatePicker";
|
|
7
|
+
const SearchInput = ({ bgColor = "bg-sky-500", textHighlight = "text-sky-500", inputType = "text", dropdownIconProp = {
|
|
15
8
|
name: "chevronDown",
|
|
16
9
|
weight: "bold",
|
|
17
10
|
iconClasses: "text-black",
|
|
18
|
-
}, dropdownOptions = [], selectedDropdownOption = "", onDropdownOptionSelect, searchItems = [], setSearchItems, toggleStatus = false, setToggleStatus, minValue, setMinValue, maxValue, setMaxValue,
|
|
11
|
+
}, dropdownOptions = [], selectedDropdownOption = "", onDropdownOptionSelect, searchItems = [], setSearchItems, toggleStatus = false, setToggleStatus, minValue, setMinValue, maxValue, setMaxValue, onChange, selectedValue, selectedDate, onDateSelect, selectedStartDate, onStartDateSelect, selectedEndDate, onEndDateSelect, handleFilter, }) => {
|
|
19
12
|
const containerRef = useRef(null);
|
|
20
|
-
const [localSearchText, setLocalSearchText] = useState("");
|
|
21
13
|
const inputRef = useRef(null);
|
|
22
14
|
useEffect(() => {
|
|
23
15
|
inputRef.current?.focus();
|
|
24
16
|
}, []);
|
|
25
|
-
const handleInputChange = (event) => {
|
|
26
|
-
setLocalSearchText(event.target.value);
|
|
27
|
-
};
|
|
28
|
-
const handleSubmitClick = () => {
|
|
29
|
-
const trimmedSearchText = localSearchText.trim();
|
|
30
|
-
let safeHeader;
|
|
31
|
-
if (typeof column.Header === "string") {
|
|
32
|
-
safeHeader = column.Header;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
safeHeader = column.accessor || "Unnamed Column";
|
|
36
|
-
}
|
|
37
|
-
if (trimmedSearchText === "") {
|
|
38
|
-
// Remove criterion if text is empty
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
// Update or add criterion
|
|
42
|
-
}
|
|
43
|
-
setEditingHeader(null);
|
|
44
|
-
};
|
|
45
17
|
return (_jsx("div", { ref: containerRef, className: "", children: (() => {
|
|
46
18
|
switch (inputType) {
|
|
47
19
|
case "text":
|
|
48
|
-
return (_jsx(SearchTextInput, {
|
|
20
|
+
return (_jsx(SearchTextInput, { dropdownIconProp: dropdownIconProp, dropdownOptions: dropdownOptions, selectedDropdownOption: selectedDropdownOption, onDropdownOptionSelect: onDropdownOptionSelect, searchItems: searchItems, setSearchItems: setSearchItems, handleFilter: handleFilter }));
|
|
49
21
|
case "number":
|
|
50
|
-
return (_jsx(SearchNumberInput, {
|
|
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 }));
|
|
51
23
|
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 }));
|
|
56
|
-
case "boolean":
|
|
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 }));
|
|
57
25
|
case "date":
|
|
58
|
-
|
|
59
|
-
if (!control || !valueKey) {
|
|
60
|
-
return (_jsxs("div", { className: "text-red-500", children: ["Missing ", _jsx("code", { children: "control" }), " or", " ", _jsx("code", { children: "valueKey" }), " prop for React Hook Form"] }));
|
|
61
|
-
}
|
|
62
|
-
return (_jsx(Controller, { name: valueKey, control: control, defaultValue: getDefaultValue(dynamicDefaultValue, valueKey), render: ({ field }) => (_jsx("div", { className: "inline-flex items-center", children: _jsxs("label", { className: "flex items-center cursor-pointer relative", children: [_jsx("input", { type: "checkbox", className: "peer h-5 w-5 cursor-pointer transition-all appearance-none rounded border border-stroke", id: valueKey, checked: !!field.value, onChange: (e) => {
|
|
63
|
-
// You can log the value here:
|
|
64
|
-
console.log("Checkbox changed to:", e.target.checked);
|
|
65
|
-
field.onChange(e.target.checked);
|
|
66
|
-
} }), _jsx("span", { className: "absolute text-white opacity-0 peer-checked:opacity-100 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-3.5 w-3.5", viewBox: "0 0 20 20", fill: "currentColor", stroke: "currentColor", strokeWidth: "1", children: _jsx("path", { fillRule: "evenodd", d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z", clipRule: "evenodd" }) }) })] }) })) }));
|
|
67
|
-
default:
|
|
68
|
-
return null;
|
|
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 }));
|
|
69
27
|
}
|
|
70
28
|
})() }));
|
|
71
29
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import SearchInput from "./SearchInput";
|
|
3
|
-
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
4
3
|
import { useState } from "react";
|
|
5
4
|
export default {
|
|
6
5
|
title: "Components/SearchInput",
|
|
@@ -13,10 +12,6 @@ export default {
|
|
|
13
12
|
options: ["text", "number", "boolean", "date", "multiSelect"],
|
|
14
13
|
},
|
|
15
14
|
},
|
|
16
|
-
closeOutSearch: { control: "none", table: { disable: true } },
|
|
17
|
-
setResetSearch: { control: "none", table: { disable: true } },
|
|
18
|
-
column: { control: "none", table: { disable: true } },
|
|
19
|
-
setEditingHeader: { control: "none", table: { disable: true } },
|
|
20
15
|
dropdownIconProp: {
|
|
21
16
|
control: "object",
|
|
22
17
|
description: "Icon configuration for dropdown",
|
|
@@ -56,6 +51,10 @@ const Template = (args) => {
|
|
|
56
51
|
const [minValue, setMinValue] = useState();
|
|
57
52
|
const [maxValue, setMaxValue] = useState();
|
|
58
53
|
const [selectedValue, setSelectedValue] = useState(args.selectedValue || []);
|
|
54
|
+
// NEW: State for date control
|
|
55
|
+
const [selectedDate, setSelectedDate] = useState(args.selectedDate);
|
|
56
|
+
const [selectedStartDate, setSelectedStartDate] = useState(args.selectedStartDate);
|
|
57
|
+
const [selectedEndDate, setSelectedEndDate] = useState(args.selectedEndDate);
|
|
59
58
|
// Handle onChange from the multi-select
|
|
60
59
|
const handleOnChange = (newSelected) => {
|
|
61
60
|
setSelectedValue(newSelected);
|
|
@@ -63,23 +62,25 @@ const Template = (args) => {
|
|
|
63
62
|
args.onChange?.(newSelected);
|
|
64
63
|
console.log("Selected items:", newSelected);
|
|
65
64
|
};
|
|
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 }));
|
|
65
|
+
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, selectedDate: selectedDate, onDateSelect: setSelectedDate, selectedStartDate: selectedStartDate, onStartDateSelect: setSelectedStartDate, selectedEndDate: selectedEndDate, onEndDateSelect: setSelectedEndDate }));
|
|
67
66
|
};
|
|
68
67
|
export const Default = Template.bind({});
|
|
69
68
|
Default.args = {
|
|
70
69
|
inputType: "text",
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
handleFilter: () => console.log(`Filter applied`),
|
|
71
|
+
dropdownOptions: [
|
|
72
|
+
"Starts with",
|
|
73
|
+
"Ends with",
|
|
74
|
+
"Exactly",
|
|
75
|
+
"Includes",
|
|
76
|
+
"Excludes",
|
|
77
|
+
],
|
|
78
|
+
selectedDropdownOption: "Starts with",
|
|
75
79
|
};
|
|
76
80
|
export const TextInput = Template.bind({});
|
|
77
81
|
TextInput.args = {
|
|
78
82
|
inputType: "text",
|
|
79
|
-
|
|
80
|
-
closeOutSearch: (value) => console.log(`Search cleared: ${value}`),
|
|
81
|
-
setResetSearch: () => console.log("Reset search triggered"),
|
|
82
|
-
setEditingHeader: (value) => console.log(`Editing header: ${value}`),
|
|
83
|
+
handleFilter: () => console.log(`Filter applied`),
|
|
83
84
|
pillColor: "bg-sky-500",
|
|
84
85
|
textHighlight: "text-sky-500",
|
|
85
86
|
dropdownIconProp: {
|
|
@@ -99,10 +100,7 @@ TextInput.args = {
|
|
|
99
100
|
export const NumberInput = Template.bind({});
|
|
100
101
|
NumberInput.args = {
|
|
101
102
|
inputType: "number",
|
|
102
|
-
|
|
103
|
-
closeOutSearch: (value) => console.log(`Search cleared: ${value}`),
|
|
104
|
-
setResetSearch: () => console.log("Reset search triggered"),
|
|
105
|
-
setEditingHeader: (value) => console.log(`Editing header: ${value}`),
|
|
103
|
+
handleFilter: () => console.log(`Filter applied`),
|
|
106
104
|
dropdownIconProp: {
|
|
107
105
|
iconClasses: "text-sky-500",
|
|
108
106
|
name: "chevronDown",
|
|
@@ -114,67 +112,48 @@ NumberInput.args = {
|
|
|
114
112
|
export const DropdownInput = Template.bind({});
|
|
115
113
|
DropdownInput.args = {
|
|
116
114
|
inputType: "multiSelect",
|
|
117
|
-
|
|
118
|
-
closeOutSearch: (value) => console.log(`Search cleared: ${value}`),
|
|
119
|
-
setResetSearch: () => console.log("Reset search triggered"),
|
|
120
|
-
setEditingHeader: (value) => console.log(`Editing header: ${value}`),
|
|
115
|
+
handleFilter: () => console.log(`Filter applied`),
|
|
121
116
|
placeholder: "Search",
|
|
122
117
|
dropdownOptions: [
|
|
123
118
|
{ uuid: "1", name: "Option 1", value: "option1" },
|
|
124
119
|
{ uuid: "2", name: "Option 2", value: "option2" },
|
|
125
120
|
{ uuid: "3", name: "Option 3", value: "option3" },
|
|
126
121
|
],
|
|
127
|
-
/** For multi-select, `value` is typically an array */
|
|
128
122
|
selectedValue: [],
|
|
129
|
-
// onChange: (selected: OptionType[]) => {
|
|
130
|
-
// console.log("Selected items:", selected);
|
|
131
|
-
// },
|
|
132
|
-
/** Additional props you might want to set */
|
|
133
123
|
isSearchable: true,
|
|
134
124
|
hasSelectAll: true,
|
|
135
125
|
disabled: false,
|
|
136
126
|
isLoading: false,
|
|
137
127
|
type: "multiSelect",
|
|
138
|
-
// etc...
|
|
139
128
|
};
|
|
140
129
|
export const BooleanInput = Template.bind({});
|
|
141
130
|
BooleanInput.args = {
|
|
142
131
|
inputType: "multiSelect",
|
|
143
|
-
|
|
144
|
-
closeOutSearch: (value) => console.log(`Search cleared: ${value}`),
|
|
145
|
-
setResetSearch: () => console.log("Reset search triggered"),
|
|
146
|
-
setEditingHeader: (value) => console.log(`Editing header: ${value}`),
|
|
132
|
+
handleFilter: () => console.log(`Filter applied`),
|
|
147
133
|
placeholder: "Search",
|
|
148
134
|
dropdownOptions: [
|
|
149
135
|
{ uuid: "1", name: "True", value: "true" },
|
|
150
136
|
{ uuid: "2", name: "False", value: "false" },
|
|
151
137
|
],
|
|
152
138
|
selectedValue: [],
|
|
153
|
-
// onChange: (selected: OptionType[]) => {
|
|
154
|
-
// console.log("Selected items:", selected);
|
|
155
|
-
// },
|
|
156
139
|
isSearchable: true,
|
|
157
140
|
hasSelectAll: true,
|
|
158
141
|
disabled: false,
|
|
159
142
|
isLoading: false,
|
|
160
143
|
type: "multiSelect",
|
|
161
|
-
// etc...
|
|
162
144
|
};
|
|
163
|
-
export const
|
|
164
|
-
|
|
165
|
-
inputType: "
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
buttonIconClasses: "text-gray-400",
|
|
178
|
-
containerClasses: "flex items-center",
|
|
179
|
-
onButtonClick: () => alert("Button is disabled."),
|
|
145
|
+
export const DatePickerInput = Template.bind({});
|
|
146
|
+
DatePickerInput.args = {
|
|
147
|
+
inputType: "date",
|
|
148
|
+
handleFilter: () => console.log(`Filter applied`),
|
|
149
|
+
textHighlight: "text-sky-500",
|
|
150
|
+
dropdownOptions: ["Exactly", "Before", "After"],
|
|
151
|
+
selectedDropdownOption: "Exactly",
|
|
152
|
+
onDropdownOptionSelect: (option) => console.log(`Option selected: ${option}`),
|
|
153
|
+
searchItems: [],
|
|
154
|
+
setSearchItems: () => { },
|
|
155
|
+
toggleStatus: false,
|
|
156
|
+
setToggleStatus: () => { },
|
|
157
|
+
themeBgColor: "bg-sky-500",
|
|
158
|
+
lightThemeBg: "bg-sky-100",
|
|
180
159
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|