@ews-admin/global-design-system 1.1.18 → 1.1.19
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/index.d.ts +4 -0
- package/dist/index.esm.js +14 -32
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14 -32
- package/dist/index.js.map +1 -1
- package/dist/molecules/SpecialtySearchAutocomplete/SpecialtySearchAutocomplete.d.ts +4 -0
- package/dist/molecules/SpecialtySearchAutocomplete/SpecialtySearchAutocomplete.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/molecules/SpecialtySearchAutocomplete/SpecialtySearchAutocomplete.tsx +46 -52
package/dist/index.js
CHANGED
|
@@ -1946,46 +1946,26 @@ const ThemeDebugger = ({ className = "", }) => {
|
|
|
1946
1946
|
: "bg-gray-200 text-gray-700"}`, children: "MED" })] }), jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2 mt-4", children: [jsxRuntime.jsx("div", { className: "bg-ews-primary text-white p-2 rounded text-center", children: "Primary" }), jsxRuntime.jsx("div", { className: "bg-ews-secondary text-white p-2 rounded text-center", children: "Secondary" }), jsxRuntime.jsx("div", { className: "bg-ews-success text-white p-2 rounded text-center", children: "Success" }), jsxRuntime.jsx("div", { className: "bg-ews-warning text-white p-2 rounded text-center", children: "Warning" })] })] })] }));
|
|
1947
1947
|
};
|
|
1948
1948
|
|
|
1949
|
-
const SpecialtySearchAutocomplete = ({ selectedSpecialties = [], onSpecialtiesChange, placeholder = "Search and select medical specialties...", className = "", disabled = false, maxSelections, showSelectedCount = true, }) => {
|
|
1950
|
-
const [
|
|
1949
|
+
const SpecialtySearchAutocomplete = ({ selectedSpecialties = [], onSpecialtiesChange, specialties: availableSpecialties, placeholder = "Search and select medical specialties...", className = "", disabled = false, maxSelections, showSelectedCount = true, title = "Medical Specialties", label = "Select Specialties", getSelectedCountText, }) => {
|
|
1950
|
+
const [filteredSpecialties, setFilteredSpecialties] = React.useState([]);
|
|
1951
1951
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
1952
|
-
//
|
|
1952
|
+
// Filter specialties based on search term
|
|
1953
1953
|
const fetchSpecialties = React.useCallback(async (searchTerm) => {
|
|
1954
1954
|
setIsLoading(true);
|
|
1955
1955
|
try {
|
|
1956
|
-
// Simulate API delay
|
|
1957
|
-
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
1958
|
-
// Mock data - replace with actual API call
|
|
1959
|
-
const mockSpecialties = [
|
|
1960
|
-
{ id: "1", code: "CARD", label: "Cardiology" },
|
|
1961
|
-
{ id: "2", code: "DERM", label: "Dermatology" },
|
|
1962
|
-
{ id: "3", code: "ENDO", label: "Endocrinology" },
|
|
1963
|
-
{ id: "4", code: "GAST", label: "Gastroenterology" },
|
|
1964
|
-
{ id: "5", code: "HEMA", label: "Hematology" },
|
|
1965
|
-
{ id: "6", code: "NEUR", label: "Neurology" },
|
|
1966
|
-
{ id: "7", code: "ONCO", label: "Oncology" },
|
|
1967
|
-
{ id: "8", code: "ORTH", label: "Orthopedics" },
|
|
1968
|
-
{ id: "9", code: "PED", label: "Pediatrics" },
|
|
1969
|
-
{ id: "10", code: "PSYC", label: "Psychiatry" },
|
|
1970
|
-
{ id: "11", code: "RAD", label: "Radiology" },
|
|
1971
|
-
{ id: "12", code: "SURG", label: "Surgery" },
|
|
1972
|
-
{ id: "13", code: "UROL", label: "Urology" },
|
|
1973
|
-
{ id: "14", code: "GYN", label: "Gynecology" },
|
|
1974
|
-
{ id: "15", code: "OPHT", label: "Ophthalmology" },
|
|
1975
|
-
];
|
|
1976
1956
|
// Filter based on search term
|
|
1977
|
-
const filtered =
|
|
1957
|
+
const filtered = availableSpecialties.filter((specialty) => specialty.label.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
|
1978
1958
|
specialty.code.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
1979
|
-
|
|
1959
|
+
setFilteredSpecialties(filtered);
|
|
1980
1960
|
}
|
|
1981
1961
|
catch (error) {
|
|
1982
|
-
console.error("Error
|
|
1983
|
-
|
|
1962
|
+
console.error("Error filtering specialties:", error);
|
|
1963
|
+
setFilteredSpecialties([]);
|
|
1984
1964
|
}
|
|
1985
1965
|
finally {
|
|
1986
1966
|
setIsLoading(false);
|
|
1987
1967
|
}
|
|
1988
|
-
}, []);
|
|
1968
|
+
}, [availableSpecialties]);
|
|
1989
1969
|
// Initial load
|
|
1990
1970
|
React.useEffect(() => {
|
|
1991
1971
|
fetchSpecialties("");
|
|
@@ -1998,11 +1978,13 @@ const SpecialtySearchAutocomplete = ({ selectedSpecialties = [], onSpecialtiesCh
|
|
|
1998
1978
|
onSpecialtiesChange(items);
|
|
1999
1979
|
}, [onSpecialtiesChange, maxSelections]);
|
|
2000
1980
|
const getEntityById = React.useCallback(async (id) => {
|
|
2001
|
-
return
|
|
2002
|
-
}, [
|
|
2003
|
-
return (jsxRuntime.jsxs("div", { className: cn("space-y-3", className), children: [jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [jsxRuntime.jsx("div", { className: "flex justify-center items-center w-8 h-8 rounded-lg bg-secondary-100", children: jsxRuntime.jsx(Stethoscope, { className: "w-4 h-4 text-secondary-600" }) }), jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Medical Specialties" })] }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx("label", { className: "block text-sm font-medium text-gray-700
|
|
1981
|
+
return availableSpecialties.find((specialty) => specialty.id === id);
|
|
1982
|
+
}, [availableSpecialties]);
|
|
1983
|
+
return (jsxRuntime.jsxs("div", { className: cn("space-y-3", className), children: [jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [jsxRuntime.jsx("div", { className: "flex justify-center items-center w-8 h-8 rounded-lg bg-secondary-100", children: jsxRuntime.jsx(Stethoscope, { className: "w-4 h-4 text-secondary-600" }) }), jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-gray-900", children: title || "Medical Specialties" })] }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx("label", { className: "block mb-2 text-sm font-medium text-gray-700", children: label || "Select Specialties" }) }), jsxRuntime.jsx(MultiSearchAutocomplete, { items: filteredSpecialties, selectedItems: selectedSpecialties, onSelectionChange: handleSelectionChange, onSearch: fetchSpecialties, getEntityById: getEntityById, getPrimaryText: (specialty) => specialty.label, getSecondaryText: (specialty) => specialty.code, placeholder: placeholder, disabled: disabled, loading: isLoading, multiple: true, keepOpenOnSelect: true, className: "w-full", renderSelectedItem: (specialty) => (jsxRuntime.jsx("span", { className: "inline-flex items-center px-3 py-1 text-sm font-medium rounded-full border bg-ews-primary/10 text-ews-primary border-ews-primary/20", children: specialty.label })), renderListItem: (specialty, isSelected) => (jsxRuntime.jsxs("div", { className: "flex items-center space-x-3", children: [jsxRuntime.jsx("div", { className: cn("flex justify-center items-center w-5 h-5 rounded border-2", isSelected
|
|
2004
1984
|
? "bg-ews-primary border-ews-primary"
|
|
2005
|
-
: "border-ews-gray-300"), children: isSelected && (jsxRuntime.jsx("svg", { className: "w-3 h-3 text-white", fill: "currentColor", viewBox: "0 0 20 20", children: jsxRuntime.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" }) })) }), jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx("span", { className: cn("font-medium", isSelected ? "text-ews-primary" : "text-gray-900"), children: specialty.label }), jsxRuntime.jsx("span", { className: cn("text-sm", isSelected ? "text-ews-primary/70" : "text-gray-500"), children: specialty.code })] })] })) }), showSelectedCount && selectedSpecialties.length > 0 && (jsxRuntime.jsxs("div", { className: "flex items-center
|
|
1985
|
+
: "border-ews-gray-300"), children: isSelected && (jsxRuntime.jsx("svg", { className: "w-3 h-3 text-white", fill: "currentColor", viewBox: "0 0 20 20", children: jsxRuntime.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" }) })) }), jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx("span", { className: cn("font-medium", isSelected ? "text-ews-primary" : "text-gray-900"), children: specialty.label }), jsxRuntime.jsx("span", { className: cn("text-sm", isSelected ? "text-ews-primary/70" : "text-gray-500"), children: specialty.code })] })] })) }), showSelectedCount && selectedSpecialties.length > 0 && (jsxRuntime.jsxs("div", { className: "flex justify-between items-center text-sm text-gray-600", children: [jsxRuntime.jsx("span", { children: getSelectedCountText
|
|
1986
|
+
? getSelectedCountText(selectedSpecialties.length)
|
|
1987
|
+
: `${selectedSpecialties.length} specialty${selectedSpecialties.length !== 1 ? "ies" : ""} selected` }), maxSelections && (jsxRuntime.jsxs("span", { className: "text-gray-400", children: [selectedSpecialties.length, "/", maxSelections] }))] }))] }));
|
|
2006
1988
|
};
|
|
2007
1989
|
|
|
2008
1990
|
exports.ArrowRight = ArrowRight;
|