@ews-admin/global-design-system 1.1.5 → 1.1.6
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/SearchAutocomplete/SearchAutocomplete.d.ts +1 -1
- package/dist/components/SearchAutocomplete/SearchAutocomplete.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SearchAutocomplete/SearchAutocomplete.tsx +9 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LucideIcon } from "lucide-react";
|
|
2
2
|
export interface SearchableEntity {
|
|
3
3
|
id: string;
|
|
4
|
-
[key: string]:
|
|
4
|
+
[key: string]: any;
|
|
5
5
|
}
|
|
6
6
|
interface SearchAutocompleteProps<T extends SearchableEntity> {
|
|
7
7
|
onSelect: (id: string) => void;
|
|
@@ -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,
|
|
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,GAAG,CAAC;CACpB;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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttri
|
|
|
74
74
|
|
|
75
75
|
interface SearchableEntity {
|
|
76
76
|
id: string;
|
|
77
|
-
[key: string]:
|
|
77
|
+
[key: string]: any;
|
|
78
78
|
}
|
|
79
79
|
interface SearchAutocompleteProps<T extends SearchableEntity> {
|
|
80
80
|
onSelect: (id: string) => void;
|
package/dist/index.esm.js
CHANGED
|
@@ -618,14 +618,14 @@ function SearchAutocomplete({ onSelect, selectedId, searchFunction, getEntityByI
|
|
|
618
618
|
className: "w-10 h-10 text-neutral-400 mr-3",
|
|
619
619
|
})), jsxs("div", { children: [jsx("div", { className: "font-medium text-neutral-900", children: getDisplayValue(selectedEntity) }), getSecondaryText && getSecondaryText(selectedEntity) && (jsx("div", { className: "text-sm text-neutral-500", children: getSecondaryText(selectedEntity) }))] })] }), jsx("button", { type: "button", onClick: handleClearSelection, className: "transition-colors text-neutral-400 hover:text-neutral-600", disabled: disabled, children: jsx(X, { className: "w-4 h-4" }) })] }) })), showDropdown && entities?.length > 0 && (jsx("div", { className: "overflow-auto absolute z-10 mt-1 w-full max-h-60 bg-white rounded-md shadow-lg", children: jsx("ul", { className: "py-1", children: entities.map((entity) => (jsx("li", { className: "px-4 py-2 cursor-pointer hover:bg-gray-100", onClick: () => handleEntitySelect(entity), children: jsxs("div", { className: "flex items-center", children: [React.createElement(icon, {
|
|
620
620
|
className: "w-4 h-4 text-gray-400",
|
|
621
|
-
}), jsxs("div", { className: "ml-2", children: [jsx("div", { className: "font-medium", children: getDisplayValue(entity) }), getSecondaryText && getSecondaryText(entity) && (jsx("div", { className: "text-xs text-gray-500", children: getSecondaryText(entity) }))] })] }) }, entity.id))) }) })), showDropdown && searchError && (jsx("div", { className: "absolute z-10 p-4 mt-1 w-full text-center text-red-600 bg-white rounded-md
|
|
621
|
+
}), jsxs("div", { className: "ml-2", children: [jsx("div", { className: "font-medium", children: getDisplayValue(entity) }), getSecondaryText && getSecondaryText(entity) && (jsx("div", { className: "text-xs text-gray-500", children: getSecondaryText(entity) }))] })] }) }, entity.id))) }) })), showDropdown && searchError && (jsx("div", { className: "absolute z-10 p-4 mt-1 w-full text-center text-red-600 bg-white rounded-md border border-red-200 shadow-lg", children: jsxs("div", { className: "flex justify-center items-center", children: [jsx(X, { className: "mr-2 w-4 h-4" }), "Error: ", searchError] }) })), showDropdown && error && !searchError && (jsx("div", { className: "absolute z-10 p-4 mt-1 w-full text-center text-red-600 bg-white rounded-md border border-red-200 shadow-lg", children: jsxs("div", { className: "flex justify-center items-center", children: [jsx(X, { className: "mr-2 w-4 h-4" }), error] }) })), showDropdown &&
|
|
622
622
|
debouncedSearchTerm &&
|
|
623
623
|
entities?.length === 0 &&
|
|
624
624
|
!isLoading &&
|
|
625
625
|
!searchError &&
|
|
626
626
|
!error && (jsx("div", { className: "absolute z-10 p-4 mt-1 w-full text-center text-gray-500 bg-white rounded-md shadow-lg", children: debouncedSearchTerm.length < minSearchLength
|
|
627
627
|
? `Type at least ${minSearchLength} characters to search`
|
|
628
|
-
: "No results found. Try a different search term." })), isLoading && showDropdown && (jsx("div", { className: "absolute z-10 p-4 mt-1 w-full text-center text-gray-500 bg-white rounded-md shadow-lg", children: jsxs("div", { className: "flex
|
|
628
|
+
: "No results found. Try a different search term." })), isLoading && showDropdown && (jsx("div", { className: "absolute z-10 p-4 mt-1 w-full text-center text-gray-500 bg-white rounded-md shadow-lg", children: jsxs("div", { className: "flex justify-center items-center", children: [jsx("div", { className: "mr-2 w-4 h-4 rounded-full border-b-2 animate-spin border-ews-primary" }), "Loading..."] }) }))] }));
|
|
629
629
|
}
|
|
630
630
|
|
|
631
631
|
function MultiSearchAutocomplete({ items, selectedItems, onSelectionChange, onSearch, getEntityById, getPrimaryText, getSecondaryText, placeholder, disabled = false, loading = false, multiple = true, className, renderSelectedItem, renderListItem, keepOpenOnSelect = true, error, minSearchLength = 2, debounceTime = 300, }) {
|