@ews-admin/global-design-system 1.1.17 → 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.
Files changed (47) hide show
  1. package/dist/components/SearchAutocomplete/SearchAutocomplete.d.ts +1 -1
  2. package/dist/components/SearchAutocomplete/SearchAutocomplete.d.ts.map +1 -1
  3. package/dist/index.d.ts +5 -1
  4. package/dist/index.esm.js +15 -33
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/index.js +15 -33
  7. package/dist/index.js.map +1 -1
  8. package/dist/molecules/SpecialtySearchAutocomplete/SpecialtySearchAutocomplete.d.ts +4 -0
  9. package/dist/molecules/SpecialtySearchAutocomplete/SpecialtySearchAutocomplete.d.ts.map +1 -1
  10. package/package.json +1 -1
  11. package/src/components/SearchAutocomplete/SearchAutocomplete.tsx +2 -4
  12. package/src/molecules/SpecialtySearchAutocomplete/SpecialtySearchAutocomplete.tsx +46 -52
  13. package/dist/assets/doctor.png +0 -0
  14. package/dist/assets/favicon.ico +0 -0
  15. package/dist/assets/logo.png +0 -0
  16. package/dist/assets/logoAssets.d.ts +0 -11
  17. package/dist/assets/logoAssets.d.ts.map +0 -1
  18. package/dist/assets/logoWhite.png +0 -0
  19. package/dist/assets/patient.png +0 -0
  20. package/dist/components/DoctorForm/DoctorForm.d.ts +0 -11
  21. package/dist/components/DoctorForm/DoctorForm.d.ts.map +0 -1
  22. package/dist/components/DoctorForm/index.d.ts +0 -3
  23. package/dist/components/DoctorForm/index.d.ts.map +0 -1
  24. package/dist/components/Logo/logoAssets.d.ts +0 -1
  25. package/dist/components/Logo/logoAssets.d.ts.map +0 -1
  26. package/dist/icons/ArrowRightIcon.d.ts +0 -4
  27. package/dist/icons/ArrowRightIcon.d.ts.map +0 -1
  28. package/dist/icons/CheckIcon.d.ts +0 -4
  29. package/dist/icons/CheckIcon.d.ts.map +0 -1
  30. package/dist/icons/EyeIcon.d.ts +0 -4
  31. package/dist/icons/EyeIcon.d.ts.map +0 -1
  32. package/dist/icons/EyeOffIcon.d.ts +0 -4
  33. package/dist/icons/EyeOffIcon.d.ts.map +0 -1
  34. package/dist/icons/SearchIcon.d.ts +0 -4
  35. package/dist/icons/SearchIcon.d.ts.map +0 -1
  36. package/dist/public/doctor.png +0 -0
  37. package/dist/public/favicon.ico +0 -0
  38. package/dist/public/image/doctor.png +0 -0
  39. package/dist/public/image/logo.png +0 -0
  40. package/dist/public/image/logoWhite.png +0 -0
  41. package/dist/public/image/patient.png +0 -0
  42. package/dist/public/logo.png +0 -0
  43. package/dist/public/logoWhite.png +0 -0
  44. package/dist/public/patient.png +0 -0
  45. package/dist/styles/theme-variables.css +0 -62
  46. package/dist/types/doctor.d.ts +0 -144
  47. package/dist/types/doctor.d.ts.map +0 -1
@@ -4,7 +4,7 @@ export interface SearchableEntity {
4
4
  [key: string]: unknown;
5
5
  }
6
6
  interface SearchAutocompleteProps<T extends SearchableEntity> {
7
- onSelect: (id: string) => void;
7
+ onSelect: (id: string, entity?: T) => void;
8
8
  selectedId: string;
9
9
  searchFunction: (keyword: string) => Promise<T[]>;
10
10
  getEntityById?: (id: string) => Promise<T | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"SearchAutocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/SearchAutocomplete/SearchAutocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,cAAc,CAAC;AAMrD,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,UAAU,uBAAuB,CAAC,CAAC,SAAS,gBAAgB;IAC1D,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAClD,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACvD,eAAe,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,CAAC;IACvC,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,CAAC;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,gBAAgB,EAAE,EAC7D,QAAQ,EACR,UAAU,EACV,cAAc,EACd,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,IAAa,EACb,QAAgB,EAChB,eAAmB,EACnB,YAAkB,EAClB,KAAK,GACN,EAAE,uBAAuB,CAAC,CAAC,CAAC,2CAmR5B"}
1
+ {"version":3,"file":"SearchAutocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/SearchAutocomplete/SearchAutocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,cAAc,CAAC;AAMrD,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,UAAU,uBAAuB,CAAC,CAAC,SAAS,gBAAgB;IAC1D,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAClD,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACvD,eAAe,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,CAAC;IACvC,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,CAAC;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,gBAAgB,EAAE,EAC7D,QAAQ,EACR,UAAU,EACV,cAAc,EACd,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,IAAa,EACb,QAAgB,EAChB,eAAmB,EACnB,YAAkB,EAClB,KAAK,GACN,EAAE,uBAAuB,CAAC,CAAC,CAAC,2CAiR5B"}
package/dist/index.d.ts CHANGED
@@ -194,7 +194,7 @@ interface SearchableEntity {
194
194
  [key: string]: unknown;
195
195
  }
196
196
  interface SearchAutocompleteProps<T extends SearchableEntity> {
197
- onSelect: (id: string) => void;
197
+ onSelect: (id: string, entity?: T) => void;
198
198
  selectedId: string;
199
199
  searchFunction: (keyword: string) => Promise<T[]>;
200
200
  getEntityById?: (id: string) => Promise<T | undefined>;
@@ -384,11 +384,15 @@ interface Specialty {
384
384
  interface SpecialtySearchAutocompleteProps {
385
385
  selectedSpecialties: Specialty[];
386
386
  onSpecialtiesChange: (specialties: Specialty[]) => void;
387
+ specialties: Specialty[];
387
388
  placeholder?: string;
388
389
  className?: string;
389
390
  disabled?: boolean;
390
391
  maxSelections?: number;
391
392
  showSelectedCount?: boolean;
393
+ title?: string;
394
+ label?: string;
395
+ getSelectedCountText?: (count: number) => React.ReactNode;
392
396
  }
393
397
  declare const SpecialtySearchAutocomplete: React.FC<SpecialtySearchAutocompleteProps>;
394
398
 
package/dist/index.esm.js CHANGED
@@ -1487,7 +1487,7 @@ function SearchAutocomplete({ onSelect, selectedId, searchFunction, getEntityByI
1487
1487
  console.log(`Selected entity with ID: ${entity.id}`);
1488
1488
  setSelectedEntity(entity);
1489
1489
  setSearchTerm(getDisplayValue(entity));
1490
- onSelect(entity.id);
1490
+ onSelect(entity.id, entity);
1491
1491
  setShowDropdown(false);
1492
1492
  };
1493
1493
  const handleClearSelection = () => {
@@ -1944,46 +1944,26 @@ const ThemeDebugger = ({ className = "", }) => {
1944
1944
  : "bg-gray-200 text-gray-700"}`, children: "MED" })] }), jsxs("div", { className: "grid grid-cols-2 gap-2 mt-4", children: [jsx("div", { className: "bg-ews-primary text-white p-2 rounded text-center", children: "Primary" }), jsx("div", { className: "bg-ews-secondary text-white p-2 rounded text-center", children: "Secondary" }), jsx("div", { className: "bg-ews-success text-white p-2 rounded text-center", children: "Success" }), jsx("div", { className: "bg-ews-warning text-white p-2 rounded text-center", children: "Warning" })] })] })] }));
1945
1945
  };
1946
1946
 
1947
- const SpecialtySearchAutocomplete = ({ selectedSpecialties = [], onSpecialtiesChange, placeholder = "Search and select medical specialties...", className = "", disabled = false, maxSelections, showSelectedCount = true, }) => {
1948
- const [specialties, setSpecialties] = useState([]);
1947
+ 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, }) => {
1948
+ const [filteredSpecialties, setFilteredSpecialties] = useState([]);
1949
1949
  const [isLoading, setIsLoading] = useState(false);
1950
- // Mock API call - replace with actual API
1950
+ // Filter specialties based on search term
1951
1951
  const fetchSpecialties = useCallback(async (searchTerm) => {
1952
1952
  setIsLoading(true);
1953
1953
  try {
1954
- // Simulate API delay
1955
- await new Promise((resolve) => setTimeout(resolve, 300));
1956
- // Mock data - replace with actual API call
1957
- const mockSpecialties = [
1958
- { id: "1", code: "CARD", label: "Cardiology" },
1959
- { id: "2", code: "DERM", label: "Dermatology" },
1960
- { id: "3", code: "ENDO", label: "Endocrinology" },
1961
- { id: "4", code: "GAST", label: "Gastroenterology" },
1962
- { id: "5", code: "HEMA", label: "Hematology" },
1963
- { id: "6", code: "NEUR", label: "Neurology" },
1964
- { id: "7", code: "ONCO", label: "Oncology" },
1965
- { id: "8", code: "ORTH", label: "Orthopedics" },
1966
- { id: "9", code: "PED", label: "Pediatrics" },
1967
- { id: "10", code: "PSYC", label: "Psychiatry" },
1968
- { id: "11", code: "RAD", label: "Radiology" },
1969
- { id: "12", code: "SURG", label: "Surgery" },
1970
- { id: "13", code: "UROL", label: "Urology" },
1971
- { id: "14", code: "GYN", label: "Gynecology" },
1972
- { id: "15", code: "OPHT", label: "Ophthalmology" },
1973
- ];
1974
1954
  // Filter based on search term
1975
- const filtered = mockSpecialties.filter((specialty) => specialty.label.toLowerCase().includes(searchTerm.toLowerCase()) ||
1955
+ const filtered = availableSpecialties.filter((specialty) => specialty.label.toLowerCase().includes(searchTerm.toLowerCase()) ||
1976
1956
  specialty.code.toLowerCase().includes(searchTerm.toLowerCase()));
1977
- setSpecialties(filtered);
1957
+ setFilteredSpecialties(filtered);
1978
1958
  }
1979
1959
  catch (error) {
1980
- console.error("Error fetching specialties:", error);
1981
- setSpecialties([]);
1960
+ console.error("Error filtering specialties:", error);
1961
+ setFilteredSpecialties([]);
1982
1962
  }
1983
1963
  finally {
1984
1964
  setIsLoading(false);
1985
1965
  }
1986
- }, []);
1966
+ }, [availableSpecialties]);
1987
1967
  // Initial load
1988
1968
  useEffect(() => {
1989
1969
  fetchSpecialties("");
@@ -1996,11 +1976,13 @@ const SpecialtySearchAutocomplete = ({ selectedSpecialties = [], onSpecialtiesCh
1996
1976
  onSpecialtiesChange(items);
1997
1977
  }, [onSpecialtiesChange, maxSelections]);
1998
1978
  const getEntityById = useCallback(async (id) => {
1999
- return specialties.find((specialty) => specialty.id === id);
2000
- }, [specialties]);
2001
- return (jsxs("div", { className: cn("space-y-3", className), children: [jsxs("div", { className: "flex items-center space-x-2", children: [jsx("div", { className: "flex justify-center items-center w-8 h-8 rounded-lg bg-secondary-100", children: jsx(Stethoscope, { className: "w-4 h-4 text-secondary-600" }) }), jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Medical Specialties" })] }), jsx("div", { children: jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Select Specialties" }) }), jsx(MultiSearchAutocomplete, { items: specialties, 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) => (jsx("span", { className: "inline-flex items-center px-3 py-1 text-sm font-medium rounded-full bg-ews-primary/10 text-ews-primary border border-ews-primary/20", children: specialty.label })), renderListItem: (specialty, isSelected) => (jsxs("div", { className: "flex items-center space-x-3", children: [jsx("div", { className: cn("w-5 h-5 border-2 rounded flex items-center justify-center", isSelected
1979
+ return availableSpecialties.find((specialty) => specialty.id === id);
1980
+ }, [availableSpecialties]);
1981
+ return (jsxs("div", { className: cn("space-y-3", className), children: [jsxs("div", { className: "flex items-center space-x-2", children: [jsx("div", { className: "flex justify-center items-center w-8 h-8 rounded-lg bg-secondary-100", children: jsx(Stethoscope, { className: "w-4 h-4 text-secondary-600" }) }), jsx("h3", { className: "text-lg font-semibold text-gray-900", children: title || "Medical Specialties" })] }), jsx("div", { children: jsx("label", { className: "block mb-2 text-sm font-medium text-gray-700", children: label || "Select Specialties" }) }), 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) => (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) => (jsxs("div", { className: "flex items-center space-x-3", children: [jsx("div", { className: cn("flex justify-center items-center w-5 h-5 rounded border-2", isSelected
2002
1982
  ? "bg-ews-primary border-ews-primary"
2003
- : "border-ews-gray-300"), children: isSelected && (jsx("svg", { className: "w-3 h-3 text-white", fill: "currentColor", viewBox: "0 0 20 20", 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" }) })) }), jsxs("div", { className: "flex flex-col", children: [jsx("span", { className: cn("font-medium", isSelected ? "text-ews-primary" : "text-gray-900"), children: specialty.label }), jsx("span", { className: cn("text-sm", isSelected ? "text-ews-primary/70" : "text-gray-500"), children: specialty.code })] })] })) }), showSelectedCount && selectedSpecialties.length > 0 && (jsxs("div", { className: "flex items-center justify-between text-sm text-gray-600", children: [jsxs("span", { children: [selectedSpecialties.length, " specialty", selectedSpecialties.length !== 1 ? "ies" : "", " selected"] }), maxSelections && (jsxs("span", { className: "text-gray-400", children: [selectedSpecialties.length, "/", maxSelections] }))] }))] }));
1983
+ : "border-ews-gray-300"), children: isSelected && (jsx("svg", { className: "w-3 h-3 text-white", fill: "currentColor", viewBox: "0 0 20 20", 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" }) })) }), jsxs("div", { className: "flex flex-col", children: [jsx("span", { className: cn("font-medium", isSelected ? "text-ews-primary" : "text-gray-900"), children: specialty.label }), jsx("span", { className: cn("text-sm", isSelected ? "text-ews-primary/70" : "text-gray-500"), children: specialty.code })] })] })) }), showSelectedCount && selectedSpecialties.length > 0 && (jsxs("div", { className: "flex justify-between items-center text-sm text-gray-600", children: [jsx("span", { children: getSelectedCountText
1984
+ ? getSelectedCountText(selectedSpecialties.length)
1985
+ : `${selectedSpecialties.length} specialty${selectedSpecialties.length !== 1 ? "ies" : ""} selected` }), maxSelections && (jsxs("span", { className: "text-gray-400", children: [selectedSpecialties.length, "/", maxSelections] }))] }))] }));
2004
1986
  };
2005
1987
 
2006
1988
  export { ArrowRight, Button, Check, DoctorIcon, DropdownMultiSelect, Icon, Input, Logo, Modal, MultiSearchAutocomplete, PatientIcon, Search, SearchAutocomplete, Select, SpecialtySearchAutocomplete, ThemeDebugger, ThemeProvider, ThemeToggle, UserIcon, cn, debounce, formatCurrency, formatDate, formatNumeric, generateId, isValidPhoneNumber, useDebounce, useDebouncedCallback, useSelectField, useTheme };