sea-react-components 1.3.18 → 1.3.20

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 (56) hide show
  1. package/dist/components/button/index.js +1 -1
  2. package/dist/components/file-input/components/file-item/index.js +1 -1
  3. package/dist/components/list-item/index.d.ts +2 -1
  4. package/dist/components/list-item/index.d.ts.map +1 -1
  5. package/dist/components/list-item/index.js +2 -2
  6. package/dist/components/notifications-menu/index.d.ts.map +1 -1
  7. package/dist/components/notifications-menu/index.js +3 -3
  8. package/dist/components/searchable-select/index.d.ts +9 -0
  9. package/dist/components/searchable-select/index.d.ts.map +1 -0
  10. package/dist/components/searchable-select/index.js +28 -0
  11. package/dist/components/select/index.d.ts +5 -2
  12. package/dist/components/select/index.d.ts.map +1 -1
  13. package/dist/components/select/index.js +71 -26
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +1 -0
  17. package/dist/tsconfig.tsbuildinfo +1 -1
  18. package/dist/utils/validation/index.d.ts.map +1 -1
  19. package/dist/utils/validation/index.js +1 -1
  20. package/package.json +2 -2
  21. package/dist/components/auto-complete/auto-complete-context copy.d.ts +0 -16
  22. package/dist/components/auto-complete/auto-complete-context copy.d.ts.map +0 -1
  23. package/dist/components/auto-complete/auto-complete-context copy.js +0 -8
  24. package/dist/components/auto-complete/component.d.ts +0 -29
  25. package/dist/components/auto-complete/component.d.ts.map +0 -1
  26. package/dist/components/auto-complete/component.js +0 -47
  27. package/dist/components/auto-complete-input copy/index.d.ts +0 -27
  28. package/dist/components/auto-complete-input copy/index.d.ts.map +0 -1
  29. package/dist/components/auto-complete-input copy/index.js +0 -75
  30. package/dist/components/auto-complete-input2/auto-complete-context.d.ts +0 -16
  31. package/dist/components/auto-complete-input2/auto-complete-context.d.ts.map +0 -1
  32. package/dist/components/auto-complete-input2/auto-complete-context.js +0 -8
  33. package/dist/components/auto-complete-input2/auto-complete-dropdown.d.ts +0 -2
  34. package/dist/components/auto-complete-input2/auto-complete-dropdown.d.ts.map +0 -1
  35. package/dist/components/auto-complete-input2/auto-complete-dropdown.js +0 -9
  36. package/dist/components/auto-complete-input2/auto-complete-input copy.d.ts +0 -2
  37. package/dist/components/auto-complete-input2/auto-complete-input copy.d.ts.map +0 -1
  38. package/dist/components/auto-complete-input2/auto-complete-input copy.js +0 -9
  39. package/dist/components/auto-complete-input2/auto-complete-input.d.ts +0 -2
  40. package/dist/components/auto-complete-input2/auto-complete-input.d.ts.map +0 -1
  41. package/dist/components/auto-complete-input2/auto-complete-input.js +0 -9
  42. package/dist/components/auto-complete-input2/auto-complete.d.ts +0 -14
  43. package/dist/components/auto-complete-input2/auto-complete.d.ts.map +0 -1
  44. package/dist/components/auto-complete-input2/auto-complete.js +0 -20
  45. package/dist/components/auto-complete-input2/component.d.ts +0 -29
  46. package/dist/components/auto-complete-input2/component.d.ts.map +0 -1
  47. package/dist/components/auto-complete-input2/component.js +0 -47
  48. package/dist/components/auto-complete-input2/index.d.ts +0 -3
  49. package/dist/components/auto-complete-input2/index.d.ts.map +0 -1
  50. package/dist/components/auto-complete-input2/index.js +0 -2
  51. package/dist/components/auto-complete-input2/use-autocomplete.d.ts +0 -21
  52. package/dist/components/auto-complete-input2/use-autocomplete.d.ts.map +0 -1
  53. package/dist/components/auto-complete-input2/use-autocomplete.js +0 -56
  54. package/dist/components/auto-complete-input2/useAutocomplete.d.ts +0 -21
  55. package/dist/components/auto-complete-input2/useAutocomplete.d.ts.map +0 -1
  56. package/dist/components/auto-complete-input2/useAutocomplete.js +0 -59
@@ -11,5 +11,5 @@ const classes = {
11
11
  };
12
12
  export default function Button({ loading = false, disabled, className, children, variant = "primary", ...props }) {
13
13
  const classVariants = variant != "other" ? classes[variant] || classes["primary"] : className;
14
- return (_jsx("button", { className: clsx("flex px-4 py-2 rounded-lg items-center justify-center custom-animation", classVariants), disabled: disabled, ...props, children: loading ? (_jsx(Icon, { icon: "line-md:loading-loop", className: "w-6 h-6" })) : (children) }));
14
+ return (_jsx("button", { className: clsx("flex px-4 py-2 rounded-lg gap-1 items-center justify-center custom-animation", classVariants), disabled: disabled, ...props, children: loading ? (_jsx(Icon, { icon: "line-md:loading-loop", className: "w-6 h-6" })) : (children) }));
15
15
  }
@@ -31,5 +31,5 @@ export default function FileItem({ file, handleUploadFile, handleDeleteFile, dis
31
31
  }
32
32
  return (_jsx("div", { className: "w-full h-28 flex items-center justify-center bg-white rounded-md mb-1", children: _jsx(Icon, { icon: "mdi:file-outline", className: "w-10 h-10 text-gray-400" }) }));
33
33
  };
34
- return (_jsxs("div", { className: "px-2 py-1 rounded-lg max-w-52", children: [renderPreview(), _jsxs("div", { className: "grid grid-cols-4 gap-2 items-center", children: [_jsx("div", { className: "col-span-3", children: _jsxs("div", { children: [_jsx("p", { className: "text-sm text-text font-semibold truncate", children: file.name }), _jsx("p", { className: "text-sm text-info", children: Utils.Number.numeralUtils(file.size).format("0.0 b") })] }) }), _jsx("div", { className: "col-span-1", children: _jsxs("div", { className: "flex items-center justify-end gap-1", children: [file.status === UploadStatuses.Failed && (_jsxs(_Fragment, { children: [_jsx(Icon, { icon: "mdi:cloud-remove-outline", className: "w-5 h-5 text-error" }), _jsx(Button, { type: "button", className: "bg-transparent", onClick: () => handleUploadFile === null || handleUploadFile === void 0 ? void 0 : handleUploadFile(file), children: _jsx(Icon, { icon: "pajamas:retry", className: "w-5 h-5 text-primary hover:text-opacity-50 transition-all duration-300 ease-in-out" }) })] })), [UploadStatuses.Pending, UploadStatuses.Uploading].includes(file.status) && (_jsx(Icon, { icon: "line-md:uploading-loop", className: "w-5 h-5 text-info" })), file.status === UploadStatuses.Uploaded && !displayMode && (_jsxs(_Fragment, { children: [_jsx(Icon, { icon: "ic:outline-cloud-done", className: "w-5 h-5 text-primary" }), _jsx(Button, { type: "button", className: "bg-transparent", onClick: () => handleDeleteFile === null || handleDeleteFile === void 0 ? void 0 : handleDeleteFile(file), children: _jsx(Icon, { icon: "famicons:close", className: "w-5 h-5 text-error hover:text-opacity-70 custom-animation" }) })] }))] }) })] })] }));
34
+ return (_jsxs("div", { className: "px-2 py-1 rounded-lg max-w-52", children: [renderPreview(), _jsxs("div", { className: "grid grid-cols-4 gap-2 items-center", children: [_jsx("div", { className: "col-span-3", children: _jsxs("div", { children: [_jsx("p", { className: "text-sm text-text font-semibold truncate", children: file.name }), _jsx("p", { className: "text-sm text-info", children: Utils.Number.numeralUtils(file.size).format("0.0 b") })] }) }), _jsx("div", { className: "col-span-1", children: _jsxs("div", { className: "flex items-center justify-end gap-1", children: [file.status === UploadStatuses.Failed && (_jsxs(_Fragment, { children: [_jsx(Icon, { icon: "mdi:cloud-remove-outline", className: "w-5 h-5 text-error" }), _jsx(Button, { type: "button", className: "bg-transparent", onClick: () => handleUploadFile === null || handleUploadFile === void 0 ? void 0 : handleUploadFile(file), children: _jsx(Icon, { icon: "pajamas:retry", className: "w-5 h-5 text-primary hover:text-opacity-50 transition-all duration-300 ease-in-out" }) })] })), [UploadStatuses.Pending, UploadStatuses.Uploading].includes(file.status) && (_jsx(Icon, { icon: "line-md:uploading-loop", className: "w-5 h-5 text-info" })), file.status === UploadStatuses.Uploaded && !displayMode && (_jsxs(_Fragment, { children: [_jsx(Icon, { icon: "ic:outline-cloud-done", className: "w-5 h-5 text-primary" }), _jsx(Button, { type: "button", variant: "secondary", onClick: () => handleDeleteFile === null || handleDeleteFile === void 0 ? void 0 : handleDeleteFile(file), children: _jsx(Icon, { icon: "famicons:close", className: "w-5 h-5 text-error hover:text-opacity-70 custom-animation" }) })] }))] }) })] })] }));
35
35
  }
@@ -22,6 +22,7 @@ export type Props<K> = {
22
22
  showFiltersRow?: boolean;
23
23
  children?: React.ReactNode;
24
24
  headerComponent?: React.ReactNode;
25
+ itemName?: string;
25
26
  };
26
- export default function ListItem<K>({ title, name, filters, totalPages, query, setQuery, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam, rowsPerPageOptions, QueryDebouncedTime, bulkActionFeature, loading, showPaginationRow, showFiltersRow, headerComponent, children, }: Props<K>): import("react/jsx-runtime").JSX.Element;
27
+ export default function ListItem<K>({ title, name, filters, totalPages, query, setQuery, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam, rowsPerPageOptions, QueryDebouncedTime, bulkActionFeature, loading, showPaginationRow, showFiltersRow, headerComponent, children, itemName, }: Props<K>): import("react/jsx-runtime").JSX.Element;
27
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/list-item/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKjD,OAAO,EACL,iBAAiB,EACjB,MAAM,EAEP,MAAM,mCAAmC,CAAC;AAM3C,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,kBAAkB,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,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E,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,kBAAkB,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvD,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,EAAE,EAClC,KAAK,EACL,IAAI,EACJ,OAAY,EACZ,UAAU,EACV,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,WAAW,EACX,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,kBAAwB,EACxB,iBAA6B,EAC7B,OAAe,EACf,iBAAwB,EACxB,cAAqB,EACrB,eAAe,EACf,QAAQ,EACR,QAAiB,GAClB,EAAE,KAAK,CAAC,CAAC,CAAC,2CAiHV"}
@@ -10,7 +10,7 @@ import { useFilters } from "../..//hooks/list-items-hook/useFilters";
10
10
  import { usePagination } from "../../hooks/list-items-hook/usePagination";
11
11
  import { useBulkActions } from "../../hooks/list-items-hook/useBulkActions";
12
12
  import Loader from "../loader";
13
- export default function ListItem({ title, name, filters = [], totalPages, query, setQuery, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam, rowsPerPageOptions, QueryDebouncedTime = 500, bulkActionFeature = undefined, loading = false, showPaginationRow = true, showFiltersRow = true, headerComponent, children, }) {
13
+ export default function ListItem({ title, name, filters = [], totalPages, query, setQuery, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam, rowsPerPageOptions, QueryDebouncedTime = 500, bulkActionFeature = undefined, loading = false, showPaginationRow = true, showFiltersRow = true, headerComponent, children, itemName = "Item", }) {
14
14
  useFilters(name, filters, updateParams, getParam);
15
15
  usePagination(name, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam);
16
16
  useBulkActions(bulkActionFeature, filters, query);
@@ -19,5 +19,5 @@ export default function ListItem({ title, name, filters = [], totalPages, query,
19
19
  : "justify-end"), children: [showFiltersRow && (_jsxs("div", { className: "flex items-end gap-2 flex-wrap", children: [_jsx(SearchInput, { placeholder: `search about ${name}`, value: query, onDebouncedChange: setQuery, QueryDebouncedTime: QueryDebouncedTime }), filters.map((f, i) => (_jsxs("div", { className: "flex flex-col gap-1", children: [f.label && (_jsx("p", { className: "text-text font-semibold", children: f.label })), _jsx(Select, { name: `table-${name}-filter-${f.label}-${i}`, values: [f.value], setValues: (newValues) => f.setValue(newValues[0]), options: [
20
20
  { label: "All", value: DEFAULT_FILTER_VALUE },
21
21
  ...f.options,
22
- ], placeholder: f.label })] }, `table-${name}-filter-${f.label}-${i}`)))] })), bulkActionFeature && (_jsx("div", { className: "flex items-center gap-2 justify-end w-full md:w-fit", children: bulkActionFeature.bulkActions.map((a, i) => (_jsx(Button, { ...a, disabled: bulkActionFeature.selectedRowIds.length === 0 }, `table-${name}-bulk-action-${i}`))) })), headerComponent] }), _jsx("div", { className: "overflow-x-auto", children: loading ? (_jsx("div", { className: "flex items-center justify-center", children: _jsx(Loader, {}) })) : (_jsx(_Fragment, { children: children })) }), showPaginationRow && (_jsxs("div", { className: "flex items-center justify-end gap-5", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("p", { className: "text-text text-sm", children: "Rows per page" }), _jsx(Select, { name: `${name}-select`, values: [rowsPerPage], setValues: (newValues) => setRowsPerPage(newValues[0]), options: rowsPerPageOptions })] }), totalPages >= 1 && (_jsx(Pagination, { name: name, page: page, setPage: setPage, totalPages: totalPages }))] }))] }));
22
+ ], placeholder: f.label })] }, `table-${name}-filter-${f.label}-${i}`)))] })), bulkActionFeature && (_jsx("div", { className: "flex items-center gap-2 justify-end w-full md:w-fit", children: bulkActionFeature.bulkActions.map((a, i) => (_jsx(Button, { ...a, disabled: bulkActionFeature.selectedRowIds.length === 0 }, `table-${name}-bulk-action-${i}`))) })), headerComponent] }), _jsx("div", { className: "overflow-x-auto", children: loading ? (_jsx("div", { className: "flex items-center justify-center", children: _jsx(Loader, {}) })) : (_jsx(_Fragment, { children: totalPages > 0 ? (_jsx(_Fragment, { children: children })) : (_jsxs("p", { className: "text-center text-text", children: ["No ", itemName, " found!"] })) })) }), showPaginationRow && (_jsxs("div", { className: "flex items-center justify-end gap-5", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("p", { className: "text-text text-sm", children: "Rows per page" }), _jsx(Select, { name: `${name}-select`, values: [rowsPerPage], setValues: (newValues) => setRowsPerPage(newValues[0]), options: rowsPerPageOptions })] }), totalPages >= 1 && (_jsx(Pagination, { name: name, page: page, setPage: setPage, totalPages: totalPages }))] }))] }));
23
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/notifications-menu/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAc,MAAM,sBAAsB,CAAC;AAoB7D,MAAM,MAAM,KAAK,GAAG;IAClB,cAAc,EACV,SAAS,CAAC,WAAW,CAAC,eAAe,GACrC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAC3B,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE,MAAM,CAAC,CACtD,CAAC;IACF,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,cAAc,EACd,mBAAmB,EACnB,KAAyC,EACzC,oBAAoB,EACpB,QAAQ,GACT,EAAE,KAAK,2CA8UP"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/notifications-menu/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAc,MAAM,sBAAsB,CAAC;AAkB7D,MAAM,MAAM,KAAK,GAAG;IAClB,cAAc,EACV,SAAS,CAAC,WAAW,CAAC,eAAe,GACrC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAC3B,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE,MAAM,CAAC,CACtD,CAAC;IACF,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,cAAc,EACd,mBAAmB,EACnB,KAAyC,EACzC,oBAAoB,EACpB,QAAQ,GACT,EAAE,KAAK,2CA8UP"}
@@ -109,7 +109,7 @@ export default function NotificationMenu({ applicationKey, notificationBaseUrl,
109
109
  var _a, _b, _c, _d, _e;
110
110
  let title = _jsx(_Fragment, {}), description = _jsx(_Fragment, {}), icon = _jsx(_Fragment, {}), link = undefined;
111
111
  switch (notification.type) {
112
- case CONSTANTS.Notification.NotificationTypes.TaskAssignedToYou: {
112
+ case CONSTANTS.AccountAlertSetting.AlertActions.TaskAssignedToYou: {
113
113
  const task = ((_a = notification.objects) !== null && _a !== void 0 ? _a : {}).task;
114
114
  icon = (_jsx(Icon, { icon: "fluent-mdl2:assign", className: "h-10 w-10 transform" }));
115
115
  title = (_jsx("p", { className: "font-semibold line-clamp-2", children: "New task assigned to you" }));
@@ -117,7 +117,7 @@ export default function NotificationMenu({ applicationKey, notificationBaseUrl,
117
117
  link = `${applicationsBaseUrls[CONSTANTS.Application.ApplicationKeys.StrategyApplication]}/tasks/${task.id}`;
118
118
  break;
119
119
  }
120
- case CONSTANTS.Notification.NotificationTypes.TaskUnassignedFromYou: {
120
+ case CONSTANTS.AccountAlertSetting.AlertActions.TaskUnassignedFromYou: {
121
121
  const task = ((_b = notification.objects) !== null && _b !== void 0 ? _b : {}).task;
122
122
  icon = (_jsx(Icon, { icon: "fluent-mdl2:assign", className: "h-10 w-10 transform scale-x-[-1]" }));
123
123
  title = (_jsx("p", { className: "font-semibold line-clamp-2", children: "Task unassigned from you" }));
@@ -125,7 +125,7 @@ export default function NotificationMenu({ applicationKey, notificationBaseUrl,
125
125
  link = `${applicationsBaseUrls[CONSTANTS.Application.ApplicationKeys.StrategyApplication]}/tasks/${task.id}`;
126
126
  break;
127
127
  }
128
- case CONSTANTS.Notification.NotificationTypes.NewCommentAdded: {
128
+ case CONSTANTS.AccountAlertSetting.AlertActions.NewCommentAdded: {
129
129
  const addedBy = ((_c = notification.objects) !== null && _c !== void 0 ? _c : {})
130
130
  .addedBy;
131
131
  const objectName = ((_d = notification.objects) !== null && _d !== void 0 ? _d : {}).objectName;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { SelectProps } from "../../";
3
+ export type Props<T, K> = Omit<SelectProps<T>, "options" | "onChangeSearchInput"> & {
4
+ getItems: (q: string) => Promise<K[]>;
5
+ getLabel: (item: K) => React.ReactNode;
6
+ getValue: (item: K) => T;
7
+ };
8
+ export default function SearchableSelect<T, K>({ getItems, getLabel, getValue, ...props }: Props<T, K>): import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/searchable-select/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoD,MAAM,OAAO,CAAC;AACzE,OAAO,EAAwB,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE3D,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAC5B,WAAW,CAAC,CAAC,CAAC,EACd,SAAS,GAAG,qBAAqB,CAClC,GAAG;IACF,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACtC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IACvC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;CAC1B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,EAC7C,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,2CAsCb"}
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useCallback, useEffect, useMemo, useState } from "react";
4
+ import { Select } from "../../";
5
+ export default function SearchableSelect({ getItems, getLabel, getValue, ...props }) {
6
+ const [query, setQuery] = useState("");
7
+ const [options, setOptions] = useState([]);
8
+ // --- Memoize callbacks if not already ---
9
+ const memoGetItems = useCallback(getItems, [getItems]);
10
+ const memoGetLabel = useCallback(getLabel, [getLabel]);
11
+ const memoGetValue = useCallback(getValue, [getValue]);
12
+ useEffect(() => {
13
+ let active = true;
14
+ memoGetItems(query).then((items) => {
15
+ if (active)
16
+ setOptions(items);
17
+ });
18
+ return () => {
19
+ active = false; // cancel stale promises
20
+ };
21
+ }, [query, memoGetItems]);
22
+ // --- Memoize mapped options ---
23
+ const mappedOptions = useMemo(() => options.map((item) => ({
24
+ label: memoGetLabel(item),
25
+ value: memoGetValue(item),
26
+ })), [options, memoGetLabel, memoGetValue]);
27
+ return (_jsx(Select, { ...props, options: mappedOptions, onChangeSearchInput: setQuery, isSearchable: true, isRemote: true }));
28
+ }
@@ -11,13 +11,16 @@ export type Props<T> = {
11
11
  errorMessage?: string | boolean;
12
12
  buttonClassName?: string;
13
13
  placeholder?: string;
14
- IconPlaceholderLeft?: any;
14
+ IconPlaceholderLeft?: React.ReactNode;
15
15
  multiselect?: boolean;
16
16
  disabled?: boolean;
17
17
  label?: string;
18
18
  isSearchable?: boolean;
19
19
  required?: boolean;
20
20
  onChangeSearchInput?: (value: string) => void;
21
+ onRemove?: () => void;
22
+ searchDebounceTimeout?: number;
23
+ isRemote?: boolean;
21
24
  };
22
- export default function Select<T>({ name, options, values, setValues, errorMessage, buttonClassName, placeholder, multiselect, disabled, label, isSearchable, required, IconPlaceholderLeft, onChangeSearchInput, }: Props<T>): import("react/jsx-runtime").JSX.Element;
25
+ export default function Select<T>({ name, options, values, setValues, errorMessage, buttonClassName, placeholder, multiselect, disabled, label, isSearchable, required, IconPlaceholderLeft, onChangeSearchInput, onRemove, searchDebounceTimeout, isRemote, }: Props<T>): import("react/jsx-runtime").JSX.Element;
23
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/select/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAC5B,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EA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SAAS,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAEpC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACtC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAGF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,CAAC,EAAE,EAChC,IAAI,EACJ,OAAO,EACP,MAAM,EACN,SAAS,EACT,YAAY,EACZ,eAAe,EACf,WAAyB,EACzB,WAAmB,EACnB,QAAgB,EAChB,KAAK,EACL,YAAoB,EACpB,QAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,QAAQ,EACR,qBAA2B,EAC3B,QAAgB,GACjB,EAAE,KAAK,CAAC,CAAC,CAAC,2CA6RV"}
@@ -1,56 +1,95 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState, useRef, useEffect } from "react";
3
+ import { useState, useRef, useEffect, useMemo, } from "react";
4
4
  import { Icon } from "@iconify/react";
5
5
  import clsx from "clsx";
6
- export default function Select({ name, options, values, setValues, errorMessage, buttonClassName, placeholder = "Select...", multiselect = false, disabled = false, label, isSearchable = false, required = false, IconPlaceholderLeft, onChangeSearchInput, }) {
6
+ // ---------- Component ----------
7
+ export default function Select({ name, options, values, setValues, errorMessage, buttonClassName, placeholder = "Select...", multiselect = false, disabled = false, label, isSearchable = false, required = false, IconPlaceholderLeft, onChangeSearchInput, onRemove, searchDebounceTimeout = 500, isRemote = false, }) {
7
8
  const [isOpen, setIsOpen] = useState(false);
8
9
  const [show, setShow] = useState(false);
9
10
  const [animate, setAnimate] = useState(false);
10
11
  const [search, setSearch] = useState("");
12
+ const [selectedCache, setSelectedCache] = useState([]);
11
13
  const containerRef = useRef(null);
14
+ // ---------- Debounced Search ----------
15
+ useEffect(() => {
16
+ if (!onChangeSearchInput)
17
+ return;
18
+ const timeout = setTimeout(() => onChangeSearchInput(search), searchDebounceTimeout);
19
+ return () => clearTimeout(timeout);
20
+ }, [search, onChangeSearchInput, searchDebounceTimeout]);
12
21
  const handleSearchInputChange = (e) => {
13
- const val = e.target.value;
14
- setSearch(val);
15
- onChangeSearchInput === null || onChangeSearchInput === void 0 ? void 0 : onChangeSearchInput(val);
22
+ setSearch(e.target.value);
16
23
  };
17
- const selectedOptions = options.filter((o) => values.some((v) => Object.is(v, o.value)));
18
- const filteredOptions = isSearchable
19
- ? options.filter((o) => String(o.label).toLowerCase().includes(search.toLowerCase()))
20
- : options;
24
+ // ---------- Derived Values ----------
25
+ const mergedOptions = useMemo(() => [
26
+ ...options,
27
+ ...selectedCache.filter((cached) => !options.some((o) => Object.is(o.value, cached.value))),
28
+ ], [options, selectedCache]);
29
+ const selectedOptions = useMemo(() => mergedOptions.filter((o) => values.some((v) => Object.is(v, o.value))), [mergedOptions, values]);
30
+ const filteredOptions = useMemo(() => {
31
+ // Case 1: Not searchable => just return options
32
+ if (!isSearchable)
33
+ return mergedOptions;
34
+ // Case 2: Remote mode => skip local filtering (server handles it)
35
+ if (isRemote)
36
+ return mergedOptions;
37
+ // Case 3: Local filtering
38
+ if (!search.trim())
39
+ return mergedOptions;
40
+ const lower = search.toLowerCase();
41
+ return mergedOptions.filter((o) => String(o.label).toLowerCase().includes(lower));
42
+ }, [isSearchable, mergedOptions, search, isRemote]);
43
+ // ---------- Selection Logic ----------
21
44
  const toggleOption = (option) => {
22
45
  if (disabled)
23
46
  return;
47
+ const isSelected = values.some((v) => Object.is(v, option.value));
48
+ let updatedValues;
24
49
  if (multiselect) {
25
- const isSelected = values.some((v) => Object.is(v, option.value));
26
- const updated = isSelected
50
+ updatedValues = isSelected
27
51
  ? values.filter((v) => !Object.is(v, option.value))
28
52
  : [...values, option.value];
29
- setValues(updated);
53
+ setSelectedCache((prev) => isSelected
54
+ ? prev.filter((s) => !Object.is(s.value, option.value))
55
+ : [...prev, option]);
30
56
  }
31
57
  else {
32
- setValues([option.value]);
58
+ updatedValues = [option.value];
59
+ setSelectedCache([option]);
33
60
  setIsOpen(false);
34
61
  }
62
+ setValues(updatedValues);
35
63
  };
36
64
  const removeSelected = (option) => {
37
65
  if (disabled)
38
66
  return;
39
67
  setValues(values.filter((v) => !Object.is(v, option.value)));
68
+ setSelectedCache((prev) => prev.filter((s) => !Object.is(s.value, option.value)));
40
69
  };
41
- const handleClickOutside = (e) => {
42
- if (containerRef.current &&
43
- !containerRef.current.contains(e.target))
44
- setIsOpen(false);
70
+ const handleClear = (e) => {
71
+ e.stopPropagation();
72
+ if (disabled)
73
+ return;
74
+ setValues([]);
75
+ setSelectedCache([]);
76
+ onRemove === null || onRemove === void 0 ? void 0 : onRemove();
45
77
  };
78
+ // ---------- Dropdown Visibility ----------
46
79
  useEffect(() => {
80
+ const handleClickOutside = (e) => {
81
+ if (containerRef.current &&
82
+ !containerRef.current.contains(e.target)) {
83
+ setIsOpen(false);
84
+ }
85
+ };
47
86
  document.addEventListener("mousedown", handleClickOutside);
48
87
  return () => document.removeEventListener("mousedown", handleClickOutside);
49
88
  }, []);
50
89
  useEffect(() => {
51
90
  if (isOpen) {
52
91
  setShow(true);
53
- setTimeout(() => setAnimate(true), 20);
92
+ requestAnimationFrame(() => setAnimate(true));
54
93
  }
55
94
  else {
56
95
  setAnimate(false);
@@ -58,22 +97,28 @@ export default function Select({ name, options, values, setValues, errorMessage,
58
97
  return () => clearTimeout(timeout);
59
98
  }
60
99
  }, [isOpen]);
61
- return (_jsxs("div", { className: "flex flex-col gap-1", children: [label && (_jsxs("label", { htmlFor: name, className: "pl-1 text-sm text-foreground font-medium mb-2", children: [label, " ", required && _jsx("span", { className: "font-bold", children: "*" })] })), _jsxs("div", { ref: containerRef, className: "relative w-full", children: [_jsxs("div", { onClick: () => !disabled && setIsOpen((o) => !o), className: clsx("text-text flex items-center justify-between gap-2 px-3 py-2 rounded-md border-0.5 hover:border-primary", disabled
100
+ // ---------- Render ----------
101
+ const renderSelectedChips = () => selectedOptions.map((o, i) => (_jsxs("div", { className: "bg-primary bg-opacity-50 px-2 py-1 rounded-2xl flex items-center gap-1", children: [_jsx("span", { className: "text-black text-sm", children: o.label }), !disabled && (_jsx("button", { type: "button", onClick: (e) => {
102
+ e.stopPropagation();
103
+ removeSelected(o);
104
+ }, children: _jsx(Icon, { icon: "line-md:close-small", className: "w-4 h-4" }) }))] }, `${name}-${i}`)));
105
+ const renderPlaceholder = () => (_jsxs("div", { className: "flex gap-2 items-center overflow-hidden", children: [IconPlaceholderLeft, _jsx("p", { className: "text-gray-500 truncate line-clamp-1", children: placeholder })] }));
106
+ return (_jsxs("div", { className: "flex flex-col gap-1", children: [label && (_jsxs("label", { htmlFor: name, className: "pl-1 text-sm text-foreground font-medium mb-2", children: [label, " ", required && _jsx("span", { className: "font-bold", children: "*" })] })), _jsxs("div", { ref: containerRef, className: "relative w-full", children: [_jsxs("div", { onClick: () => !disabled && setIsOpen((o) => !o), className: clsx("text-text flex items-center justify-between gap-2 px-3 py-2 rounded-md border-0.5 hover:border-primary transition-all", disabled
62
107
  ? "bg-gray-100 text-gray-400 cursor-not-allowed"
63
108
  : "bg-white cursor-pointer", errorMessage
64
109
  ? "border-error"
65
110
  : isOpen
66
111
  ? "border-primary"
67
- : "border-gray-200", buttonClassName), children: [multiselect ? (selectedOptions.length ? (_jsx("div", { className: "flex flex-wrap gap-2", id: `${name}`, children: selectedOptions.map((o, i) => (_jsxs("div", { className: "bg-primary bg-opacity-50 px-2 py-1 rounded-2xl flex items-center gap-1", children: [_jsx("div", { className: "text-black text-sm", children: o.label }), !disabled && (_jsx("button", { type: "button", onClick: (e) => {
68
- e.stopPropagation();
69
- removeSelected(o);
70
- }, children: _jsx(Icon, { icon: "line-md:close-small", className: "w-4 h-4" }) }))] }, `${name}-${i}`))) })) : (_jsxs("div", { className: "flex gap-2 items-center ", children: [IconPlaceholderLeft, _jsx("p", { className: "text-gray-500", children: placeholder })] }))) : selectedOptions[0] ? (_jsx("div", { className: "text-text", children: selectedOptions[0].label })) : (_jsxs("div", { className: "flex gap-2 items-center", children: [IconPlaceholderLeft, _jsx("p", { className: "text-gray-500", children: placeholder })] })), _jsx(Icon, { icon: "iconamoon:arrow-down-2" })] }), show && !disabled && (_jsxs("div", { className: clsx("absolute left-0 mt-1 z-50 bg-white border border-gray-200 rounded-md shadow-lg max-h-64 overflow-auto", "max-w-[360px] min-w-[260px] w-full", "transition-all duration-200 ease-out", animate
71
- ? "opacity-100 translate-y-0 scale-[1]"
72
- : "opacity-0 translate-y-[-5px] scale-[0.98]"), children: [isSearchable && (_jsxs("div", { className: "sticky top-0 bg-white border-b border-gray-100 px-2 py-1 flex items-center gap-2", onClick: (e) => e.stopPropagation(), children: [_jsx(Icon, { icon: "mdi:magnify", className: "text-gray-500 w-5 h-5" }), _jsx("input", { type: "text", placeholder: "Search...", value: search, onChange: handleSearchInputChange, className: "w-full outline-none text-sm bg-transparent py-1" })] })), filteredOptions.length > 0 ? (filteredOptions.map((o, i) => {
112
+ : "border-gray-200", buttonClassName), children: [multiselect ? (selectedOptions.length ? (_jsx("div", { className: "flex flex-wrap gap-2", id: name, children: renderSelectedChips() })) : (renderPlaceholder())) : selectedOptions[0] ? (_jsx("div", { className: "text-text truncate line-clamp-1", children: selectedOptions[0].label })) : (renderPlaceholder()), _jsxs("div", { className: "flex items-center gap-1", children: [!disabled &&
113
+ (multiselect
114
+ ? selectedOptions.length > 0
115
+ : !!selectedOptions[0]) && (_jsx("button", { type: "button", onClick: handleClear, title: "Clear selection", className: "text-gray-500 hover:text-primary", children: _jsx(Icon, { icon: "line-md:close-small", className: "w-5 h-5" }) })), _jsx(Icon, { icon: "iconamoon:arrow-down-2", className: clsx("transition-transform duration-200", isOpen && "rotate-180") })] })] }), show && !disabled && (_jsxs("div", { className: clsx("absolute left-0 mt-1 z-50 bg-white border border-gray-200 rounded-md shadow-lg max-h-64 overflow-auto max-w-[360px] min-w-[260px] w-full transition-all duration-200 ease-out", animate
116
+ ? "opacity-100 translate-y-0 scale-100"
117
+ : "opacity-0 -translate-y-1 scale-95"), children: [isSearchable && (_jsxs("div", { className: "sticky top-0 bg-white border-b border-gray-100 px-2 py-1 flex items-center gap-2", onClick: (e) => e.stopPropagation(), children: [_jsx(Icon, { icon: "mdi:magnify", className: "text-gray-500 w-5 h-5" }), _jsx("input", { type: "text", placeholder: "Search...", value: search, onChange: handleSearchInputChange, className: "w-full outline-none text-sm bg-transparent py-1" })] })), filteredOptions.length > 0 ? (filteredOptions.map((o, i) => {
73
118
  const isSelected = selectedOptions.some((s) => Object.is(s.value, o.value));
74
119
  return (_jsxs("div", { onClick: () => {
75
120
  setSearch("");
76
121
  toggleOption(o);
77
- }, className: clsx("mx-1 px-3 py-2 cursor-pointer flex items-center gap-2 rounded hover:text-primary hover:bg-primary hover:bg-opacity-20 text-sm"), children: [isSelected ? (_jsx("div", { className: "text-primary", children: _jsx(Icon, { icon: "mdi:check", className: "w-4 h-4" }) })) : (_jsx("div", { className: "w-4 h-4" })), o.label] }, `${name}-option-${i}`));
122
+ }, className: clsx("mx-1 px-3 py-2 cursor-pointer flex items-center gap-2 rounded text-sm hover:text-primary hover:bg-primary/20", isSelected && "bg-primary/10 text-primary"), children: [isSelected ? (_jsx(Icon, { icon: "mdi:check", className: "w-4 h-4 text-primary" })) : (_jsx("div", { className: "w-4 h-4" })), o.label] }, `${name}-option-${i}`));
78
123
  })) : (_jsx("div", { className: "px-3 py-2 text-gray-400 text-sm", children: "No results" }))] }))] }), errorMessage && (_jsx("p", { className: "pl-1 text-sm text-error", children: errorMessage }))] }));
79
124
  }
package/dist/index.d.ts CHANGED
@@ -20,6 +20,7 @@ export { default as MenuItem, Props as MenuItemProps, } from "./components/menu/
20
20
  export { default as NativeMenu, Props as NativeMenuProps, } from "./components/native-menu";
21
21
  export { default as NativeMenuItem, Props as NativeMenuItemProps, } from "./components/native-menu/native-menu-item";
22
22
  export { default as Select, Props as SelectProps, SelectOption, } from "./components/select";
23
+ export { default as SearchableSelect, Props as SearchableSelectProps, } from "./components/searchable-select";
23
24
  export { default as Paper, Props as PaperProps } from "./components/paper";
24
25
  export { default as Input, Props as InputProps } from "./components/input";
25
26
  export { default as SearchInput, Props as SearchInputProps, } from "./components/search-input";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,aAAa,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EACL,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,OAAO,IAAI,IAAI,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AgB,GAC1B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EACL,OAAO,IAAI,SAAS,EACpB,KAAK,IAAI,cAAc,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,IAAI,cAAc,EACzB,KAAK,IAAI,mBAAmB,GAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,OAAO,IAAI,YAAY,EACvB,KAAK,IAAI,iBAAiB,GAC3B,MAAM,6BAA6B,CAAC;AAErC,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EACL,OAAO,IAAI,iBAAiB,EAC5B,KAAK,IAAI,sBAAsB,GAChC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,OAAO,IAAI,iBAAiB,EAC5B,KAAK,IAAI,sBAAsB,GAChC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EACL,OAAO,IAAI,iBAAiB,EAC5B,KAAK,IAAI,sBAAsB,GAChC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,OAAO,IAAI,oBAAoB,EAC/B,KAAK,IAAI,yBAAyB,GACnC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,qCAAqC,CAAC"}
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ export { default as MenuItem, } from "./components/menu/menu-item";
25
25
  export { default as NativeMenu, } from "./components/native-menu";
26
26
  export { default as NativeMenuItem, } from "./components/native-menu/native-menu-item";
27
27
  export { default as Select, } from "./components/select";
28
+ export { default as SearchableSelect, } from "./components/searchable-select";
28
29
  export { default as Paper } from "./components/paper";
29
30
  export { default as Input } from "./components/input";
30
31
  export { default as SearchInput, } from "./components/search-input";
@@ -1 +1 @@
1
- {"root":["../src/index.ts","../src/hoc/can-access-application/index.tsx","../src/hoc/with-authorization/index.tsx","../src/components/accordion/index.tsx","../src/components/activity-message/index.tsx","../src/components/alert/index.tsx","../src/components/auto-complete/auto-complete-context.tsx","../src/components/auto-complete/auto-complete-dropdown.tsx","../src/components/auto-complete/auto-complete-input.tsx","../src/components/auto-complete/auto-complete-selected.tsx","../src/components/auto-complete/auto-complete.tsx","../src/components/auto-complete/index.tsx","../src/components/auto-complete/use-autocomplete.ts","../src/components/auto-complete-input/index.tsx","../src/components/avatar/index.tsx","../src/components/badge/index.tsx","../src/components/breadcrumb/index.tsx","../src/components/break-line/index.tsx","../src/components/button/index.tsx","../src/components/calendar/index.tsx","../src/components/cards-list/index.tsx","../src/components/carousel/index.tsx","../src/components/checkbox/index.tsx","../src/components/color-picker/index.tsx","../src/components/comments-container/index.tsx","../src/components/comments-container/comment-event-bus/index.ts","../src/components/comments-container/comment-form/index.tsx","../src/components/comments-container/comment-item/index.tsx","../src/components/comments-container/comments-list/index.tsx","../src/components/comments-container/constants/index.ts","../src/components/comments-container/use-comments/index.tsx","../src/components/confirm/index.tsx","../src/components/count-down/index.tsx","../src/components/day-calendar/index.tsx","../src/components/drawer/index.tsx","../src/components/editable-text/index.tsx","../src/components/expandable-text/index.tsx","../src/components/file-input/index.tsx","../src/components/file-input/components/file-item/index.tsx","../src/components/firebase-token-handler/index.tsx","../src/components/icon/index.tsx","../src/components/input/index.tsx","../src/components/item-not-found/index.tsx","../src/components/list-item/index.tsx","../src/components/list-item/components/page-button/index.tsx","../src/components/list-item/components/pagination/index.tsx","../src/components/loader/index.tsx","../src/components/menu/index.tsx","../src/components/menu/menu-item/index.tsx","../src/components/modal/index.tsx","../src/components/month-calendar/index.tsx","../src/components/native-menu/index.tsx","../src/components/native-menu/native-menu-item/index.tsx","../src/components/not-authorized/index.tsx","../src/components/notifications-menu/index.tsx","../src/components/otp-input/index.tsx","../src/components/paper/index.tsx","../src/components/progress-bar/index.tsx","../src/components/radio-button/index.tsx","../src/components/search-input/index.tsx","../src/components/select/index.tsx","../src/components/skeleton/index.tsx","../src/components/stacked-avatars/index.tsx","../src/components/tab/index.tsx","../src/components/table/index.tsx","../src/components/text-editor/index.tsx","../src/components/text-editor/components/toolbar/index.tsx","../src/components/text-editor/utils/index.ts","../src/components/textarea/index.tsx","../src/components/toggle/index.tsx","../src/components/tooltip/index.tsx","../src/components/tree-checkbox/index.tsx","../src/components/tree-checkbox/components/tree-checkbox-item/index.tsx","../src/components/tree-checkbox/utils/index.ts","../src/components/week-calendar/index.tsx","../src/constants/index.ts","../src/hooks/list-items-hook/types.ts","../src/hooks/list-items-hook/usebulkactions.ts","../src/hooks/list-items-hook/usefilters.ts","../src/hooks/list-items-hook/usepagination.ts","../src/hooks/use-has-permission-access/index.ts","../src/hooks/user-has-application-access/index.ts","../src/middleware/must-auth/index.tsx","../src/utils/auth-axios/index.ts","../src/utils/axios/index.ts","../src/utils/color/index.ts","../src/utils/cookie/index.ts","../src/utils/device/index.ts","../src/utils/file/index.ts","../src/utils/firebase-client/firebase.ts","../src/utils/firebase-client/index.ts","../src/utils/firebase-client/types.ts","../src/utils/jwt/index.ts","../src/utils/notification-localstorage/index.ts","../src/utils/validation/index.ts"],"version":"5.6.3"}
1
+ {"root":["../src/index.ts","../src/hoc/can-access-application/index.tsx","../src/hoc/with-authorization/index.tsx","../src/components/accordion/index.tsx","../src/components/activity-message/index.tsx","../src/components/alert/index.tsx","../src/components/auto-complete/auto-complete-context.tsx","../src/components/auto-complete/auto-complete-dropdown.tsx","../src/components/auto-complete/auto-complete-input.tsx","../src/components/auto-complete/auto-complete-selected.tsx","../src/components/auto-complete/auto-complete.tsx","../src/components/auto-complete/index.tsx","../src/components/auto-complete/use-autocomplete.ts","../src/components/auto-complete-input/index.tsx","../src/components/avatar/index.tsx","../src/components/badge/index.tsx","../src/components/breadcrumb/index.tsx","../src/components/break-line/index.tsx","../src/components/button/index.tsx","../src/components/calendar/index.tsx","../src/components/cards-list/index.tsx","../src/components/carousel/index.tsx","../src/components/checkbox/index.tsx","../src/components/color-picker/index.tsx","../src/components/comments-container/index.tsx","../src/components/comments-container/comment-event-bus/index.ts","../src/components/comments-container/comment-form/index.tsx","../src/components/comments-container/comment-item/index.tsx","../src/components/comments-container/comments-list/index.tsx","../src/components/comments-container/constants/index.ts","../src/components/comments-container/use-comments/index.tsx","../src/components/confirm/index.tsx","../src/components/count-down/index.tsx","../src/components/day-calendar/index.tsx","../src/components/drawer/index.tsx","../src/components/editable-text/index.tsx","../src/components/expandable-text/index.tsx","../src/components/file-input/index.tsx","../src/components/file-input/components/file-item/index.tsx","../src/components/firebase-token-handler/index.tsx","../src/components/icon/index.tsx","../src/components/input/index.tsx","../src/components/item-not-found/index.tsx","../src/components/list-item/index.tsx","../src/components/list-item/components/page-button/index.tsx","../src/components/list-item/components/pagination/index.tsx","../src/components/loader/index.tsx","../src/components/menu/index.tsx","../src/components/menu/menu-item/index.tsx","../src/components/modal/index.tsx","../src/components/month-calendar/index.tsx","../src/components/native-menu/index.tsx","../src/components/native-menu/native-menu-item/index.tsx","../src/components/not-authorized/index.tsx","../src/components/notifications-menu/index.tsx","../src/components/otp-input/index.tsx","../src/components/paper/index.tsx","../src/components/progress-bar/index.tsx","../src/components/radio-button/index.tsx","../src/components/search-input/index.tsx","../src/components/searchable-select/index.tsx","../src/components/select/index.tsx","../src/components/skeleton/index.tsx","../src/components/stacked-avatars/index.tsx","../src/components/tab/index.tsx","../src/components/table/index.tsx","../src/components/text-editor/index.tsx","../src/components/text-editor/components/toolbar/index.tsx","../src/components/text-editor/utils/index.ts","../src/components/textarea/index.tsx","../src/components/toggle/index.tsx","../src/components/tooltip/index.tsx","../src/components/tree-checkbox/index.tsx","../src/components/tree-checkbox/components/tree-checkbox-item/index.tsx","../src/components/tree-checkbox/utils/index.ts","../src/components/week-calendar/index.tsx","../src/constants/index.ts","../src/hooks/list-items-hook/types.ts","../src/hooks/list-items-hook/usebulkactions.ts","../src/hooks/list-items-hook/usefilters.ts","../src/hooks/list-items-hook/usepagination.ts","../src/hooks/use-has-permission-access/index.ts","../src/hooks/user-has-application-access/index.ts","../src/middleware/must-auth/index.tsx","../src/utils/auth-axios/index.ts","../src/utils/axios/index.ts","../src/utils/color/index.ts","../src/utils/cookie/index.ts","../src/utils/device/index.ts","../src/utils/file/index.ts","../src/utils/firebase-client/firebase.ts","../src/utils/firebase-client/index.ts","../src/utils/firebase-client/types.ts","../src/utils/jwt/index.ts","../src/utils/notification-localstorage/index.ts","../src/utils/validation/index.ts"],"version":"5.6.3"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,eAAO,MAAM,IAAI,wDAAoD,CAAC;AACtE,eAAO,MAAM,WAAW,wDAAkD,CAAC;AAC3E,eAAO,MAAM,SAAS,wDAAoC,CAAC;AAC3D,eAAO,MAAM,KAAK,wDAA4C,CAAC;AAC/D,eAAO,MAAM,WAAW,wDAKpB,CAAC;AACL,eAAO,MAAM,QAAQ,wDAA2C,CAAC;AACjE,eAAO,MAAM,eAAe,wDAEe,CAAC;AAE5C,eAAO,MAAM,UAAU,wDASpB,CAAC;AAEJ,eAAO,MAAM,OAAO,WAAY,MAAM,2DAGb,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,eAAO,MAAM,IAAI,wDAAoD,CAAC;AACtE,eAAO,MAAM,WAAW,wDAAkD,CAAC;AAC3E,eAAO,MAAM,SAAS,wDAA0B,CAAC;AACjD,eAAO,MAAM,KAAK,wDAA4C,CAAC;AAC/D,eAAO,MAAM,WAAW,wDAKpB,CAAC;AACL,eAAO,MAAM,QAAQ,wDAA2C,CAAC;AACjE,eAAO,MAAM,eAAe,wDAEe,CAAC;AAE5C,eAAO,MAAM,UAAU,wDASpB,CAAC;AAEJ,eAAO,MAAM,OAAO,WAAY,MAAM,2DAGb,CAAC"}
@@ -2,7 +2,7 @@ import * as Yup from "yup";
2
2
  import { Utils } from "sea-platform-helpers";
3
3
  export const name = Yup.string().min(3).max(255).required("Required");
4
4
  export const description = Yup.string().trim().optional().min(3).max(1000);
5
- export const birthDate = Yup.string().required("Required");
5
+ export const birthDate = Yup.string().optional();
6
6
  export const email = Yup.string().email().required("Required");
7
7
  export const phoneNumber = Yup.string()
8
8
  .optional()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sea-react-components",
3
3
  "description": "SEA react components library",
4
- "version": "1.3.18",
4
+ "version": "1.3.20",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "build": "tsc --build && npx postcss src/styles.css -o dist/styles.css && npx postcss src/components/text-editor/style.css -o dist/components/text-editor/style.css",
@@ -48,7 +48,7 @@
48
48
  "jwt-decode": "^4.0.0",
49
49
  "lowlight": "^3.3.0",
50
50
  "react-dom": "^18.3.1",
51
- "sea-platform-helpers": "^1.5.16",
51
+ "sea-platform-helpers": "^1.5.18",
52
52
  "sea-react-components": "file:",
53
53
  "uuid": "^13.0.0",
54
54
  "yup": "^1.5.0"
@@ -1,16 +0,0 @@
1
- import { SelectOption } from "../select";
2
- export type AutocompleteContextType<T> = {
3
- inputValue: string;
4
- setInputValue: (v: string) => void;
5
- open: boolean;
6
- setOpen: (v: boolean) => void;
7
- filteredOptions: SelectOption<T>[];
8
- select: (option: T) => void;
9
- remove: (option: T) => void;
10
- highlightedIndex: number;
11
- setHighlightedIndex: (i: number) => void;
12
- selected: T[];
13
- };
14
- export declare const AutocompleteContext: import("react").Context<AutocompleteContextType<any>>;
15
- export declare function useAutocompleteContext<T>(): AutocompleteContextType<T>;
16
- //# sourceMappingURL=auto-complete-context%20copy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-complete-context copy.d.ts","sourceRoot":"","sources":["../../../src/components/auto-complete/auto-complete-context copy.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9B,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACnC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,CAAC,EAAE,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,mBAAmB,uDAC0B,CAAC;AAE3D,wBAAgB,sBAAsB,CAAC,CAAC,KAMxB,uBAAuB,CAAC,CAAC,CAAC,CACzC"}
@@ -1,8 +0,0 @@
1
- import { createContext, useContext } from "react";
2
- export const AutocompleteContext = createContext(null);
3
- export function useAutocompleteContext() {
4
- const ctx = useContext(AutocompleteContext);
5
- if (!ctx)
6
- throw new Error("Autocomplete compound components must be used within <Autocomplete>");
7
- return ctx;
8
- }
@@ -1,29 +0,0 @@
1
- import React from "react";
2
- import SearchInput from "../search-input";
3
- import { SelectOption } from "../select";
4
- export type Props<T extends string | number | {
5
- id: string;
6
- }> = {
7
- label?: string;
8
- name?: string;
9
- options: SelectOption<T>[];
10
- selectedOptions?: T[];
11
- setSelectedOptions?: (opts: T[]) => void;
12
- onOptionSelect?: (option: SelectOption<T>) => void;
13
- multiselect?: boolean;
14
- loading?: boolean;
15
- renderSelectedOptions?: (selected: T[], remove: (option: T) => void) => React.ReactNode;
16
- renderOption?: (option: SelectOption<T>, isHighlighted: boolean) => React.ReactNode;
17
- renderContainer?: (content: {
18
- input: React.ReactNode;
19
- dropdown: React.ReactNode;
20
- selected: React.ReactNode;
21
- multiselect: boolean;
22
- }) => React.ReactNode;
23
- } & Omit<React.ComponentProps<typeof SearchInput>, "onDebouncedChange"> & {
24
- onDebouncedChange?: (val: string) => void;
25
- };
26
- export default function AutoCompleteInput<T extends string | number | {
27
- id: string;
28
- }>({ label, name, options, selectedOptions, setSelectedOptions, onOptionSelect, value, onChange, onDebouncedChange, loading, multiselect, renderSelectedOptions, renderOption, renderContainer, ...rest }: Props<T>): import("react/jsx-runtime").JSX.Element;
29
- //# sourceMappingURL=component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/auto-complete/component.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAG1C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,IAAI;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC;IACtB,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IACzC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACnD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qBAAqB,CAAC,EAAE,CACtB,QAAQ,EAAE,CAAC,EAAE,EACb,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,KACxB,KAAK,CAAC,SAAS,CAAC;IACrB,YAAY,CAAC,EAAE,CACb,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EACvB,aAAa,EAAE,OAAO,KACnB,KAAK,CAAC,SAAS,CAAC;IACrB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE;QAC1B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,WAAW,EAAE,OAAO,CAAC;KACtB,KAAK,KAAK,CAAC,SAAS,CAAC;CACvB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,EAAE,mBAAmB,CAAC,GAAG;IACtE,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEJ,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAC1C,EACA,KAAK,EACL,IAAI,EACJ,OAAO,EACP,eAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,KAAK,EACL,QAAQ,EACR,iBAAiB,EACjB,OAAe,EACf,WAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,eAAe,EACf,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,CAAC,CAAC,2CAsGV"}
@@ -1,47 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useRef, useEffect } from "react";
4
- import SearchInput from "../search-input";
5
- import Loader from "../loader";
6
- import clsx from "clsx";
7
- import { useAutocomplete } from "./use-autocomplete";
8
- export default function AutoCompleteInput({ label, name, options, selectedOptions = [], setSelectedOptions, onOptionSelect, value, onChange, onDebouncedChange, loading = false, multiselect = true, renderSelectedOptions, renderOption, renderContainer, ...rest }) {
9
- const containerRef = useRef(null);
10
- const { inputValue, setInputValue, open, setOpen, filteredOptions, select, remove, highlightedIndex, setHighlightedIndex, selected, } = useAutocomplete({
11
- options,
12
- selected: selectedOptions,
13
- multiselect,
14
- onSelect: setSelectedOptions,
15
- });
16
- // Click outside to close
17
- useEffect(() => {
18
- const handler = (e) => {
19
- var _a;
20
- if (!((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)))
21
- setOpen(false);
22
- };
23
- document.addEventListener("mousedown", handler);
24
- return () => document.removeEventListener("mousedown", handler);
25
- }, []);
26
- const handleOptionSelect = (option) => {
27
- select(option.value);
28
- onOptionSelect === null || onOptionSelect === void 0 ? void 0 : onOptionSelect(option);
29
- };
30
- const input = (_jsx(SearchInput, { label: label, name: name, value: inputValue, onFocus: () => setOpen(true), onChange: (e) => {
31
- setInputValue(e.target.value);
32
- onChange === null || onChange === void 0 ? void 0 : onChange(e);
33
- }, onDebouncedChange: (val) => {
34
- setOpen(true);
35
- onDebouncedChange === null || onDebouncedChange === void 0 ? void 0 : onDebouncedChange(val);
36
- }, autoComplete: "off", ...rest }));
37
- const dropdown = open ? (_jsx("div", { className: "absolute z-10 w-full mt-1 bg-white border rounded shadow max-h-60 overflow-y-auto", children: loading ? (_jsx("div", { className: "p-4 flex justify-center items-center", children: _jsx(Loader, {}) })) : filteredOptions.length > 0 ? (filteredOptions.map((o, i) => (_jsx("div", { className: clsx("px-4 py-2 cursor-pointer custom-animation hover:bg-primary hover:bg-opacity-20", highlightedIndex === i && "bg-gray-100"), onMouseEnter: () => setHighlightedIndex(i), onClick: () => handleOptionSelect(o), children: renderOption ? renderOption(o, highlightedIndex === i) : o.label }, `${name}-option-${i}`)))) : (_jsx("div", { className: "p-4 text-center text-gray-400", children: "No options found" })) })) : null;
38
- const selectedNode = selected.length
39
- ? renderSelectedOptions === null || renderSelectedOptions === void 0 ? void 0 : renderSelectedOptions(selected, remove)
40
- : null;
41
- return (_jsx("div", { ref: containerRef, className: "relative w-full", children: renderContainer ? (renderContainer({
42
- input,
43
- dropdown,
44
- selected: selectedNode,
45
- multiselect,
46
- })) : (_jsxs(_Fragment, { children: [selectedNode, input, dropdown] })) }));
47
- }
@@ -1,27 +0,0 @@
1
- import React from "react";
2
- import SearchInput from "../search-input";
3
- import { SelectOption } from "../select";
4
- export type Props<T extends string | number | {
5
- id: string;
6
- }> = {
7
- label?: string;
8
- options: SelectOption<T>[];
9
- selectedOptions?: T[];
10
- setSelectedOptions?: (opts: T[]) => void;
11
- onOptionSelect?: (option: SelectOption<T>) => void;
12
- multiselect?: boolean;
13
- loading?: boolean;
14
- renderSelectedOptions?: (selected: T[]) => React.ReactNode;
15
- renderContainer?: (content: {
16
- input: React.ReactNode;
17
- dropdown: React.ReactNode;
18
- selected: React.ReactNode;
19
- multiselect: boolean;
20
- }) => React.ReactNode;
21
- } & Omit<React.ComponentProps<typeof SearchInput>, "onDebouncedChange"> & {
22
- onDebouncedChange?: (val: string) => void;
23
- };
24
- export default function AutoCompleteInput<T extends string | number | {
25
- id: string;
26
- }>({ label, name, options, selectedOptions, setSelectedOptions, onOptionSelect, value, onChange, onDebouncedChange, loading, multiselect, renderSelectedOptions, renderContainer, ...rest }: Props<T>): import("react/jsx-runtime").JSX.Element;
27
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/auto-complete-input copy/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAIzC,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM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AK,CAAC,CAAC,CAAC,2CAiIV"}
@@ -1,75 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState, useRef, useEffect } from "react";
4
- import SearchInput from "../search-input";
5
- import clsx from "clsx";
6
- import Loader from "../loader";
7
- export default function AutoCompleteInput({ label, name, options, selectedOptions = [], setSelectedOptions, onOptionSelect, value, onChange, onDebouncedChange, loading = false, multiselect = true, renderSelectedOptions, renderContainer, ...rest }) {
8
- var _a;
9
- const [show, setShow] = useState(false);
10
- const [inputValue, setInputValue] = useState((_a = value === null || value === void 0 ? void 0 : value.toString()) !== null && _a !== void 0 ? _a : "");
11
- const containerRef = useRef(null);
12
- useEffect(() => {
13
- const handler = (e) => {
14
- var _a;
15
- if (!((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
16
- setShow(false);
17
- }
18
- };
19
- document.addEventListener("mousedown", handler);
20
- return () => document.removeEventListener("mousedown", handler);
21
- }, []);
22
- const isAlreadySelected = (option) => {
23
- return selectedOptions.some((selected) => {
24
- if ((typeof selected === "string" || typeof selected === "number") &&
25
- (typeof option.value === "string" || typeof option.value === "number")) {
26
- return selected === option.value;
27
- }
28
- if (typeof selected === "object" &&
29
- typeof option.value === "object" &&
30
- "id" in selected &&
31
- "id" in option.value) {
32
- return selected.id === option.value.id;
33
- }
34
- return false;
35
- });
36
- };
37
- const filteredOptions = multiselect
38
- ? options.filter((o) => !isAlreadySelected(o))
39
- : options;
40
- const handleSelect = (option) => {
41
- setInputValue("");
42
- onChange === null || onChange === void 0 ? void 0 : onChange({ target: { name, value: "" } });
43
- if (multiselect) {
44
- if (!isAlreadySelected(option)) {
45
- setSelectedOptions === null || setSelectedOptions === void 0 ? void 0 : setSelectedOptions([...selectedOptions, option.value]);
46
- }
47
- }
48
- else {
49
- setSelectedOptions === null || setSelectedOptions === void 0 ? void 0 : setSelectedOptions([option.value]); // Only one selection
50
- setShow(false); // Hide dropdown immediately
51
- }
52
- onOptionSelect === null || onOptionSelect === void 0 ? void 0 : onOptionSelect(option);
53
- };
54
- useEffect(() => {
55
- var _a;
56
- setInputValue((_a = value === null || value === void 0 ? void 0 : value.toString()) !== null && _a !== void 0 ? _a : "");
57
- }, [value]);
58
- const input = (_jsx(SearchInput, { label: label, name: name, value: inputValue, onFocus: () => setShow(true), onChange: (e) => {
59
- setInputValue(e.target.value);
60
- onChange === null || onChange === void 0 ? void 0 : onChange(e);
61
- }, onDebouncedChange: (val) => {
62
- setShow(true);
63
- onDebouncedChange === null || onDebouncedChange === void 0 ? void 0 : onDebouncedChange(val);
64
- }, autoComplete: "off", ...rest }));
65
- const dropdown = show && inputValue.trim() !== "" ? (_jsx("div", { className: "absolute z-10 w-full mt-1 bg-white border rounded shadow max-h-60 overflow-y-auto", children: loading ? (_jsx("div", { className: "p-4 flex justify-center items-center", children: _jsx(Loader, {}) })) : filteredOptions.length > 0 ? (filteredOptions.map((o, i) => (_jsx("div", { className: clsx("px-4 py-2 cursor-pointer custom-animation hover:bg-primary hover:bg-opacity-20"), onClick: () => handleSelect(o), children: o.label }, `${name}-option-${i}`)))) : (_jsx("div", { className: "p-4 text-center text-gray-400", children: "No options found" })) })) : null;
66
- const selected = selectedOptions.length
67
- ? renderSelectedOptions === null || renderSelectedOptions === void 0 ? void 0 : renderSelectedOptions(selectedOptions)
68
- : null;
69
- return (_jsx("div", { ref: containerRef, children: renderContainer ? (_jsx("div", { className: "relative", children: renderContainer({
70
- input,
71
- dropdown,
72
- selected,
73
- multiselect,
74
- }) })) : (_jsxs("div", { className: "relative", children: [selected, input, dropdown] })) }));
75
- }
@@ -1,16 +0,0 @@
1
- import { SelectOption } from "../select";
2
- export type AutocompleteContextType<T> = {
3
- inputValue: string;
4
- setInputValue: (v: string) => void;
5
- open: boolean;
6
- setOpen: (v: boolean) => void;
7
- filteredOptions: SelectOption<T>[];
8
- select: (option: T) => void;
9
- remove: (option: T) => void;
10
- highlightedIndex: number;
11
- setHighlightedIndex: (i: number) => void;
12
- selected: T[];
13
- };
14
- export declare const AutocompleteContext: import("react").Context<AutocompleteContextType<any>>;
15
- export declare function useAutocompleteContext<T>(): AutocompleteContextType<T>;
16
- //# sourceMappingURL=auto-complete-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-complete-context.d.ts","sourceRoot":"","sources":["../../../src/components/auto-complete-input2/auto-complete-context.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9B,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACnC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,CAAC,EAAE,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,mBAAmB,uDAC0B,CAAC;AAE3D,wBAAgB,sBAAsB,CAAC,CAAC,KAMxB,uBAAuB,CAAC,CAAC,CAAC,CACzC"}
@@ -1,8 +0,0 @@
1
- import { createContext, useContext } from "react";
2
- export const AutocompleteContext = createContext(null);
3
- export function useAutocompleteContext() {
4
- const ctx = useContext(AutocompleteContext);
5
- if (!ctx)
6
- throw new Error("Autocomplete compound components must be used within <Autocomplete>");
7
- return ctx;
8
- }
@@ -1,2 +0,0 @@
1
- export declare function Input(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=auto-complete-dropdown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-complete-dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/auto-complete-input2/auto-complete-dropdown.tsx"],"names":[],"mappings":"AAIA,wBAAgB,KAAK,4CAYpB"}
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useAutocompleteContext } from "./auto-complete-context";
3
- import SearchInput from "../search-input";
4
- export function Input() {
5
- const { inputValue, setInputValue, setOpen } = useAutocompleteContext();
6
- return (_jsx(SearchInput, { value: inputValue, onFocus: () => setOpen(true),
7
- // onChange={(e) => setInputValue(e.target.value)}
8
- autoComplete: "off", onDebouncedChange: (value) => setInputValue(value) }));
9
- }
@@ -1,2 +0,0 @@
1
- export declare function Input(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=auto-complete-input%20copy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-complete-input copy.d.ts","sourceRoot":"","sources":["../../../src/components/auto-complete-input2/auto-complete-input copy.tsx"],"names":[],"mappings":"AAIA,wBAAgB,KAAK,4CAYpB"}
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useAutocompleteContext } from "./auto-complete-context";
3
- import SearchInput from "../search-input";
4
- export function Input() {
5
- const { inputValue, setInputValue, setOpen } = useAutocompleteContext();
6
- return (_jsx(SearchInput, { value: inputValue, onFocus: () => setOpen(true),
7
- // onChange={(e) => setInputValue(e.target.value)}
8
- autoComplete: "off", onDebouncedChange: (value) => setInputValue(value) }));
9
- }
@@ -1,2 +0,0 @@
1
- export declare function Input(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=auto-complete-input.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-complete-input.d.ts","sourceRoot":"","sources":["../../../src/components/auto-complete-input2/auto-complete-input.tsx"],"names":[],"mappings":"AAIA,wBAAgB,KAAK,4CAYpB"}
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useAutocompleteContext } from "./auto-complete-context";
3
- import SearchInput from "../search-input";
4
- export function Input() {
5
- const { inputValue, setInputValue, setOpen } = useAutocompleteContext();
6
- return (_jsx(SearchInput, { value: inputValue, onFocus: () => setOpen(true),
7
- // onChange={(e) => setInputValue(e.target.value)}
8
- autoComplete: "off", onDebouncedChange: (value) => setInputValue(value) }));
9
- }
@@ -1,14 +0,0 @@
1
- import React from "react";
2
- import { SelectOption } from "../select";
3
- export type AutocompleteProps<T> = {
4
- options: SelectOption<T>[];
5
- selected?: T[];
6
- onSelect?: (selected: T[]) => void;
7
- multiselect?: boolean;
8
- loading?: boolean;
9
- children: React.ReactNode;
10
- };
11
- export declare function Autocomplete<T extends string | number | {
12
- id: string;
13
- }>({ options, selected, onSelect, multiselect, loading, children, }: AutocompleteProps<T>): import("react/jsx-runtime").JSX.Element;
14
- //# sourceMappingURL=auto-complete.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-complete.d.ts","sourceRoot":"","sources":["../../../src/components/auto-complete-input2/auto-complete.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAOzC,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,EACvE,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,WAAkB,EAClB,OAAe,EACf,QAAQ,GACT,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CAqBtB"}
@@ -1,20 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useRef, useEffect } from "react";
4
- import { AutocompleteContext } from "./auto-complete-context";
5
- import { useAutocomplete } from "./use-autocomplete";
6
- export function Autocomplete({ options, selected, onSelect, multiselect = true, loading = false, children, }) {
7
- const containerRef = useRef(null);
8
- const ac = useAutocomplete({ options, selected, multiselect, onSelect });
9
- // Close dropdown on outside click
10
- useEffect(() => {
11
- const handler = (e) => {
12
- var _a;
13
- if (!((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)))
14
- ac.setOpen(false);
15
- };
16
- document.addEventListener("mousedown", handler);
17
- return () => document.removeEventListener("mousedown", handler);
18
- }, [ac]);
19
- return (_jsx(AutocompleteContext.Provider, { value: ac, children: _jsx("div", { ref: containerRef, className: "relative w-full", children: children }) }));
20
- }
@@ -1,29 +0,0 @@
1
- import React from "react";
2
- import SearchInput from "../search-input";
3
- import { SelectOption } from "../select";
4
- export type Props<T extends string | number | {
5
- id: string;
6
- }> = {
7
- label?: string;
8
- name?: string;
9
- options: SelectOption<T>[];
10
- selectedOptions?: T[];
11
- setSelectedOptions?: (opts: T[]) => void;
12
- onOptionSelect?: (option: SelectOption<T>) => void;
13
- multiselect?: boolean;
14
- loading?: boolean;
15
- renderSelectedOptions?: (selected: T[], remove: (option: T) => void) => React.ReactNode;
16
- renderOption?: (option: SelectOption<T>, isHighlighted: boolean) => React.ReactNode;
17
- renderContainer?: (content: {
18
- input: React.ReactNode;
19
- dropdown: React.ReactNode;
20
- selected: React.ReactNode;
21
- multiselect: boolean;
22
- }) => React.ReactNode;
23
- } & Omit<React.ComponentProps<typeof SearchInput>, "onDebouncedChange"> & {
24
- onDebouncedChange?: (val: string) => void;
25
- };
26
- export default function AutoCompleteInput<T extends string | number | {
27
- id: string;
28
- }>({ label, name, options, selectedOptions, setSelectedOptions, onOptionSelect, value, onChange, onDebouncedChange, loading, multiselect, renderSelectedOptions, renderOption, renderContainer, ...rest }: Props<T>): import("react/jsx-runtime").JSX.Element;
29
- //# sourceMappingURL=component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/auto-complete-input2/component.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAG1C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,IAAI;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC;IACtB,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IACzC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACnD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qBAAqB,CAAC,EAAE,CACtB,QAAQ,EAAE,CAAC,EAAE,EACb,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,KACxB,KAAK,CAAC,SAAS,CAAC;IACrB,YAAY,CAAC,EAAE,CACb,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EACvB,aAAa,EAAE,OAAO,KACnB,KAAK,CAAC,SAAS,CAAC;IACrB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE;QAC1B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,WAAW,EAAE,OAAO,CAAC;KACtB,KAAK,KAAK,CAAC,SAAS,CAAC;CACvB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,EAAE,mBAAmB,CAAC,GAAG;IACtE,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEJ,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAC1C,EACA,KAAK,EACL,IAAI,EACJ,OAAO,EACP,eAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,KAAK,EACL,QAAQ,EACR,iBAAiB,EACjB,OAAe,EACf,WAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,eAAe,EACf,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,CAAC,CAAC,2CAsGV"}
@@ -1,47 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useRef, useEffect } from "react";
4
- import SearchInput from "../search-input";
5
- import Loader from "../loader";
6
- import clsx from "clsx";
7
- import { useAutocomplete } from "./use-autocomplete";
8
- export default function AutoCompleteInput({ label, name, options, selectedOptions = [], setSelectedOptions, onOptionSelect, value, onChange, onDebouncedChange, loading = false, multiselect = true, renderSelectedOptions, renderOption, renderContainer, ...rest }) {
9
- const containerRef = useRef(null);
10
- const { inputValue, setInputValue, open, setOpen, filteredOptions, select, remove, highlightedIndex, setHighlightedIndex, selected, } = useAutocomplete({
11
- options,
12
- selected: selectedOptions,
13
- multiselect,
14
- onSelect: setSelectedOptions,
15
- });
16
- // Click outside to close
17
- useEffect(() => {
18
- const handler = (e) => {
19
- var _a;
20
- if (!((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)))
21
- setOpen(false);
22
- };
23
- document.addEventListener("mousedown", handler);
24
- return () => document.removeEventListener("mousedown", handler);
25
- }, []);
26
- const handleOptionSelect = (option) => {
27
- select(option.value);
28
- onOptionSelect === null || onOptionSelect === void 0 ? void 0 : onOptionSelect(option);
29
- };
30
- const input = (_jsx(SearchInput, { label: label, name: name, value: inputValue, onFocus: () => setOpen(true), onChange: (e) => {
31
- setInputValue(e.target.value);
32
- onChange === null || onChange === void 0 ? void 0 : onChange(e);
33
- }, onDebouncedChange: (val) => {
34
- setOpen(true);
35
- onDebouncedChange === null || onDebouncedChange === void 0 ? void 0 : onDebouncedChange(val);
36
- }, autoComplete: "off", ...rest }));
37
- const dropdown = open ? (_jsx("div", { className: "absolute z-10 w-full mt-1 bg-white border rounded shadow max-h-60 overflow-y-auto", children: loading ? (_jsx("div", { className: "p-4 flex justify-center items-center", children: _jsx(Loader, {}) })) : filteredOptions.length > 0 ? (filteredOptions.map((o, i) => (_jsx("div", { className: clsx("px-4 py-2 cursor-pointer custom-animation hover:bg-primary hover:bg-opacity-20", highlightedIndex === i && "bg-gray-100"), onMouseEnter: () => setHighlightedIndex(i), onClick: () => handleOptionSelect(o), children: renderOption ? renderOption(o, highlightedIndex === i) : o.label }, `${name}-option-${i}`)))) : (_jsx("div", { className: "p-4 text-center text-gray-400", children: "No options found" })) })) : null;
38
- const selectedNode = selected.length
39
- ? renderSelectedOptions === null || renderSelectedOptions === void 0 ? void 0 : renderSelectedOptions(selected, remove)
40
- : null;
41
- return (_jsx("div", { ref: containerRef, className: "relative w-full", children: renderContainer ? (renderContainer({
42
- input,
43
- dropdown,
44
- selected: selectedNode,
45
- multiselect,
46
- })) : (_jsxs(_Fragment, { children: [selectedNode, input, dropdown] })) }));
47
- }
@@ -1,3 +0,0 @@
1
- export { default as AutoCompleteInput2, Props } from "./component";
2
- export * from "./use-autocomplete";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/auto-complete-input2/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACnE,cAAc,oBAAoB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { default as AutoCompleteInput2 } from "./component";
2
- export * from "./use-autocomplete";
@@ -1,21 +0,0 @@
1
- import { SelectOption } from "../select";
2
- export declare function useAutocomplete<T extends string | number | {
3
- id: string;
4
- }>(props: {
5
- options: SelectOption<T>[];
6
- selected?: T[];
7
- multiselect?: boolean;
8
- onSelect?: (selected: T[]) => void;
9
- }): {
10
- inputValue: string;
11
- setInputValue: import("react").Dispatch<import("react").SetStateAction<string>>;
12
- open: boolean;
13
- setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
14
- filteredOptions: SelectOption<T>[];
15
- select: (option: T) => void;
16
- remove: (option: T) => void;
17
- highlightedIndex: number;
18
- setHighlightedIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
19
- selected: T[];
20
- };
21
- //# sourceMappingURL=use-autocomplete.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/auto-complete-input2/use-autocomplete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,wBAAgB,eAAe,CAC7B,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAC1C,KAAK,EAAE;IACP,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;CACpC;;;;;;qBA0ByB,CAAC;qBAWD,CAAC;;;;EA4B1B"}
@@ -1,56 +0,0 @@
1
- import { useState, useMemo } from "react";
2
- export function useAutocomplete(props) {
3
- const { options, selected = [], multiselect = true, onSelect } = props;
4
- const [inputValue, setInputValue] = useState("");
5
- const [open, setOpen] = useState(false);
6
- const [highlightedIndex, setHighlightedIndex] = useState(0);
7
- const filteredOptions = useMemo(() => {
8
- if (!multiselect)
9
- return options;
10
- return options.filter((o) => !selected.some((s) => {
11
- if (typeof s === "string" || typeof s === "number")
12
- return s === o.value;
13
- if (typeof s === "object" &&
14
- "id" in s &&
15
- typeof o.value === "object" &&
16
- "id" in o.value)
17
- return s.id === o.value.id;
18
- return false;
19
- }));
20
- }, [options, selected, multiselect]);
21
- const select = (option) => {
22
- if (multiselect) {
23
- onSelect === null || onSelect === void 0 ? void 0 : onSelect([...selected, option]);
24
- }
25
- else {
26
- onSelect === null || onSelect === void 0 ? void 0 : onSelect([option]);
27
- setOpen(false);
28
- }
29
- setInputValue("");
30
- setHighlightedIndex(0);
31
- };
32
- const remove = (option) => {
33
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(selected.filter((s) => {
34
- if (typeof s === "string" || typeof s === "number")
35
- return s !== option;
36
- if (typeof s === "object" &&
37
- "id" in s &&
38
- typeof option === "object" &&
39
- "id" in option)
40
- return s.id !== option.id;
41
- return true;
42
- }));
43
- };
44
- return {
45
- inputValue,
46
- setInputValue,
47
- open,
48
- setOpen,
49
- filteredOptions,
50
- select,
51
- remove,
52
- highlightedIndex,
53
- setHighlightedIndex,
54
- selected,
55
- };
56
- }
@@ -1,21 +0,0 @@
1
- import { SelectOption } from "../select";
2
- export declare function useAutocomplete<T extends string | number | {
3
- id: string;
4
- }>(props: {
5
- options: SelectOption<T>[];
6
- selected?: T[];
7
- multiselect?: boolean;
8
- onSelect?: (selected: T[]) => void;
9
- }): {
10
- inputValue: string;
11
- setInputValue: import("react").Dispatch<import("react").SetStateAction<string>>;
12
- open: boolean;
13
- setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
14
- filteredOptions: SelectOption<T>[];
15
- select: (option: T) => void;
16
- remove: (option: T) => void;
17
- highlightedIndex: number;
18
- setHighlightedIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
19
- selected: T[];
20
- };
21
- //# sourceMappingURL=useAutocomplete.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAutocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/auto-complete-input2/useAutocomplete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,wBAAgB,eAAe,CAC7B,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAC1C,KAAK,EAAE;IACP,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;CACpC;;;;;;qBA4ByB,CAAC;qBAWD,CAAC;;;;EA6B1B"}
@@ -1,59 +0,0 @@
1
- import { useState, useMemo } from "react";
2
- export function useAutocomplete(props) {
3
- const { options, selected = [], multiselect = true, onSelect } = props;
4
- const [inputValue, setInputValue] = useState("");
5
- const [open, setOpen] = useState(false);
6
- const [highlightedIndex, setHighlightedIndex] = useState(0);
7
- const filteredOptions = useMemo(() => {
8
- if (!multiselect)
9
- return options;
10
- return options.filter((o) => !selected.some((s) => {
11
- if (typeof s === "string" || typeof s === "number") {
12
- return s === o.value;
13
- }
14
- if (typeof s === "object" &&
15
- "id" in s &&
16
- typeof o.value === "object" &&
17
- "id" in o.value) {
18
- return s.id === o.value.id;
19
- }
20
- return false;
21
- }));
22
- }, [options, selected, multiselect]);
23
- const select = (option) => {
24
- if (multiselect) {
25
- onSelect === null || onSelect === void 0 ? void 0 : onSelect([...selected, option]);
26
- }
27
- else {
28
- onSelect === null || onSelect === void 0 ? void 0 : onSelect([option]);
29
- setOpen(false);
30
- }
31
- setInputValue("");
32
- setHighlightedIndex(0);
33
- };
34
- const remove = (option) => {
35
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(selected.filter((s) => {
36
- if (typeof s === "string" || typeof s === "number")
37
- return s !== option;
38
- if (typeof s === "object" &&
39
- "id" in s &&
40
- typeof option === "object" &&
41
- "id" in option) {
42
- return s.id !== option.id;
43
- }
44
- return true;
45
- }));
46
- };
47
- return {
48
- inputValue,
49
- setInputValue,
50
- open,
51
- setOpen,
52
- filteredOptions,
53
- select,
54
- remove,
55
- highlightedIndex,
56
- setHighlightedIndex,
57
- selected,
58
- };
59
- }