sea-react-components 1.3.14 → 1.3.16
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/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.d.ts.map +1 -1
- package/dist/components/accordion/index.js +5 -2
- package/dist/components/activity-message/index.d.ts.map +1 -1
- package/dist/components/activity-message/index.js +2 -2
- package/dist/components/auto-complete/auto-complete-context copy.d.ts +16 -0
- package/dist/components/auto-complete/auto-complete-context copy.d.ts.map +1 -0
- package/dist/components/auto-complete/auto-complete-context copy.js +8 -0
- package/dist/components/auto-complete/auto-complete-context.d.ts +22 -0
- package/dist/components/auto-complete/auto-complete-context.d.ts.map +1 -0
- package/dist/components/auto-complete/auto-complete-context.js +9 -0
- package/dist/components/auto-complete/auto-complete-dropdown.d.ts +7 -0
- package/dist/components/auto-complete/auto-complete-dropdown.d.ts.map +1 -0
- package/dist/components/auto-complete/auto-complete-dropdown.js +11 -0
- package/dist/components/auto-complete/auto-complete-input.d.ts +2 -0
- package/dist/components/auto-complete/auto-complete-input.d.ts.map +1 -0
- package/dist/components/auto-complete/auto-complete-input.js +8 -0
- package/dist/components/auto-complete/auto-complete-selected.d.ts +7 -0
- package/dist/components/auto-complete/auto-complete-selected.d.ts.map +1 -0
- package/dist/components/auto-complete/auto-complete-selected.js +9 -0
- package/dist/components/auto-complete/auto-complete.d.ts +19 -0
- package/dist/components/auto-complete/auto-complete.d.ts.map +1 -0
- package/dist/components/auto-complete/auto-complete.js +35 -0
- package/dist/components/auto-complete/component.d.ts +29 -0
- package/dist/components/auto-complete/component.d.ts.map +1 -0
- package/dist/components/auto-complete/component.js +47 -0
- package/dist/components/auto-complete/index.d.ts +7 -0
- package/dist/components/auto-complete/index.d.ts.map +1 -0
- package/dist/components/auto-complete/index.js +6 -0
- package/dist/components/auto-complete/use-autocomplete.d.ts +20 -0
- package/dist/components/auto-complete/use-autocomplete.d.ts.map +1 -0
- package/dist/components/auto-complete/use-autocomplete.js +57 -0
- package/dist/components/auto-complete-input/index.d.ts +2 -1
- package/dist/components/auto-complete-input/index.d.ts.map +1 -1
- package/dist/components/auto-complete-input/index.js +2 -2
- package/dist/components/auto-complete-input copy/index.d.ts +27 -0
- package/dist/components/auto-complete-input copy/index.d.ts.map +1 -0
- package/dist/components/auto-complete-input copy/index.js +75 -0
- package/dist/components/auto-complete-input2/auto-complete-context.d.ts +16 -0
- package/dist/components/auto-complete-input2/auto-complete-context.d.ts.map +1 -0
- package/dist/components/auto-complete-input2/auto-complete-context.js +8 -0
- package/dist/components/auto-complete-input2/auto-complete-dropdown.d.ts +2 -0
- package/dist/components/auto-complete-input2/auto-complete-dropdown.d.ts.map +1 -0
- package/dist/components/auto-complete-input2/auto-complete-dropdown.js +9 -0
- package/dist/components/auto-complete-input2/auto-complete-input copy.d.ts +2 -0
- package/dist/components/auto-complete-input2/auto-complete-input copy.d.ts.map +1 -0
- package/dist/components/auto-complete-input2/auto-complete-input copy.js +9 -0
- package/dist/components/auto-complete-input2/auto-complete-input.d.ts +2 -0
- package/dist/components/auto-complete-input2/auto-complete-input.d.ts.map +1 -0
- package/dist/components/auto-complete-input2/auto-complete-input.js +9 -0
- package/dist/components/auto-complete-input2/auto-complete.d.ts +14 -0
- package/dist/components/auto-complete-input2/auto-complete.d.ts.map +1 -0
- package/dist/components/auto-complete-input2/auto-complete.js +20 -0
- package/dist/components/auto-complete-input2/component.d.ts +29 -0
- package/dist/components/auto-complete-input2/component.d.ts.map +1 -0
- package/dist/components/auto-complete-input2/component.js +47 -0
- package/dist/components/auto-complete-input2/index.d.ts +3 -0
- package/dist/components/auto-complete-input2/index.d.ts.map +1 -0
- package/dist/components/auto-complete-input2/index.js +2 -0
- package/dist/components/auto-complete-input2/use-autocomplete.d.ts +21 -0
- package/dist/components/auto-complete-input2/use-autocomplete.d.ts.map +1 -0
- package/dist/components/auto-complete-input2/use-autocomplete.js +56 -0
- package/dist/components/auto-complete-input2/useAutocomplete.d.ts +21 -0
- package/dist/components/auto-complete-input2/useAutocomplete.d.ts.map +1 -0
- package/dist/components/auto-complete-input2/useAutocomplete.js +59 -0
- package/dist/components/break-line/index.d.ts +7 -0
- package/dist/components/break-line/index.d.ts.map +1 -0
- package/dist/components/break-line/index.js +12 -0
- package/dist/components/button/index.d.ts +4 -1
- package/dist/components/button/index.d.ts.map +1 -1
- package/dist/components/button/index.js +11 -2
- package/dist/components/cards-list/index.d.ts +5 -1
- package/dist/components/cards-list/index.d.ts.map +1 -1
- package/dist/components/cards-list/index.js +6 -2
- package/dist/components/comments-container/comment-event-bus/index.d.ts.map +1 -1
- package/dist/components/comments-container/comment-event-bus/index.js +1 -0
- package/dist/components/comments-container/comment-form/index.d.ts.map +1 -1
- package/dist/components/comments-container/comment-item/index.d.ts.map +1 -1
- package/dist/components/comments-container/comments-list/index.d.ts.map +1 -1
- package/dist/components/comments-container/comments-list/index.js +1 -1
- package/dist/components/comments-container/constants/index.d.ts.map +1 -1
- package/dist/components/comments-container/constants/index.js +1 -0
- package/dist/components/comments-container/index.d.ts.map +1 -1
- package/dist/components/comments-container/index.js +8 -4
- package/dist/components/confirm/index.d.ts +9 -0
- package/dist/components/confirm/index.d.ts.map +1 -0
- package/dist/components/confirm/index.js +40 -0
- package/dist/components/expandable-text/index.d.ts +2 -1
- package/dist/components/expandable-text/index.d.ts.map +1 -1
- package/dist/components/expandable-text/index.js +2 -2
- package/dist/components/icon/index.d.ts.map +1 -1
- package/dist/components/input/index.d.ts +2 -1
- package/dist/components/input/index.d.ts.map +1 -1
- package/dist/components/input/index.js +3 -3
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modal/index.d.ts.map +1 -1
- package/dist/components/modal/index.js +1 -1
- package/dist/components/notifications-menu/index.js +1 -1
- package/dist/components/search-input/index.d.ts.map +1 -1
- package/dist/components/search-input/index.js +1 -2
- package/dist/components/select/index.d.ts +5 -2
- package/dist/components/select/index.d.ts.map +1 -1
- package/dist/components/select/index.js +37 -15
- package/dist/components/tab/index.d.ts +20 -9
- package/dist/components/tab/index.d.ts.map +1 -1
- package/dist/components/tab/index.js +23 -8
- package/dist/components/textarea/index.d.ts +1 -1
- package/dist/components/textarea/index.d.ts.map +1 -1
- package/dist/components/textarea/index.js +2 -2
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/auth-axios/index.d.ts.map +1 -1
- package/dist/utils/auth-axios/index.js +2 -0
- package/dist/utils/axios/index.d.ts +1 -0
- package/dist/utils/axios/index.d.ts.map +1 -1
- package/dist/utils/axios/index.js +20 -5
- package/dist/utils/cookie/index.d.ts +8 -0
- package/dist/utils/cookie/index.d.ts.map +1 -1
- package/dist/utils/cookie/index.js +31 -0
- package/dist/utils/device/index.d.ts +2 -0
- package/dist/utils/device/index.d.ts.map +1 -0
- package/dist/utils/device/index.js +12 -0
- package/package.json +4 -3
- package/dist/components/comments-container/comments-list copy/index.d.ts +0 -1
- package/dist/components/comments-container/comments-list copy/index.d.ts.map +0 -1
- package/dist/components/comments-container/comments-list copy/index.js +0 -75
- package/dist/hooks/aaaa/useHasApplicationAccess.d.ts +0 -3
- package/dist/hooks/aaaa/useHasApplicationAccess.d.ts.map +0 -1
- package/dist/hooks/aaaa/useHasApplicationAccess.js +0 -8
- package/dist/hooks/user-has-application-access/useHasApplicationAccess.d.ts +0 -3
- package/dist/hooks/user-has-application-access/useHasApplicationAccess.d.ts.map +0 -1
- package/dist/hooks/user-has-application-access/useHasApplicationAccess.js +0 -8
- package/dist/middleware/firebase-token-handler/index.d.ts +0 -8
- package/dist/middleware/firebase-token-handler/index.d.ts.map +0 -1
- package/dist/middleware/firebase-token-handler/index.js +0 -28
- package/dist/utils/firebase/index.d.ts +0 -1
- package/dist/utils/firebase/index.d.ts.map +0 -1
- package/dist/utils/firebase/index.js +0 -0
- package/dist/utils/firebase-client/config.d.ts +0 -1
- package/dist/utils/firebase-client/config.d.ts.map +0 -1
- package/dist/utils/firebase-client/config.js +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/break-line/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAWxC,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,IAAW,EACX,SAAyB,GAC1B,EAAE,KAAK,2CAOP"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
const height = {
|
|
4
|
+
xs: 1,
|
|
5
|
+
sm: 3,
|
|
6
|
+
md: 5,
|
|
7
|
+
lg: 7,
|
|
8
|
+
xl: 9,
|
|
9
|
+
};
|
|
10
|
+
export default function BreakLine({ size = "xs", className = "bg-gray-200", }) {
|
|
11
|
+
return (_jsx("div", { className: clsx("w-full", className), style: { height: `${height[size]}px` } }));
|
|
12
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
type variants = "primary" | "secondary" | "danger" | "warning" | "success" | "other";
|
|
2
3
|
export type Props = {
|
|
4
|
+
variant?: variants;
|
|
3
5
|
loading?: boolean;
|
|
4
6
|
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
5
|
-
export default function Button({ loading, disabled, className, children, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default function Button({ loading, disabled, className, children, variant, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
6
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/button/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAClD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,OAAe,EACf,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,2CAmBP"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/button/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,KAAK,QAAQ,GACT,SAAS,GACT,WAAW,GACX,QAAQ,GACR,SAAS,GACT,SAAS,GACT,OAAO,CAAC;AAWZ,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAClD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,OAAe,EACf,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAmB,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,2CAmBP"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { Icon } from "@iconify/react";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const classes = {
|
|
5
|
+
primary: "bg-primary disabled:bg-gray-200 text-white hover:bg-opacity-70",
|
|
6
|
+
secondary: "disabled:bg-gray-200 border-gray-200 text-black bg-transparent border hover:bg-primary/5 hover:text-primary",
|
|
7
|
+
danger: "bg-red-500 text-white",
|
|
8
|
+
warning: "bg-warning",
|
|
9
|
+
success: "bg-success",
|
|
10
|
+
other: "",
|
|
11
|
+
};
|
|
12
|
+
export default function Button({ loading = false, disabled, className, children, variant = "primary", ...props }) {
|
|
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) }));
|
|
6
15
|
}
|
|
@@ -15,6 +15,10 @@ export type Props<T> = {
|
|
|
15
15
|
id: string;
|
|
16
16
|
} & T;
|
|
17
17
|
}> | undefined;
|
|
18
|
+
classes?: {
|
|
19
|
+
containerClasses: string;
|
|
20
|
+
cardClasses: string;
|
|
21
|
+
};
|
|
18
22
|
};
|
|
19
|
-
export default function CardsList<T>({ CardComponent, rows, bulkActionFeature, loading, }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export default function CardsList<T>({ CardComponent, rows, bulkActionFeature, classes, loading, }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
20
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/cards-list/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/cards-list/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAGtE,eAAO,MAAM,wCAAwC;;;GAKpD,CAAC;AAEF,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,IAAI,EAAE,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IAC7B,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,GAAG,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,GAAG,CAAC,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;IAClE,OAAO,CAAC,EAAE;QACR,gBAAgB,EAAE,MAAM,CAAC;QACzB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,EAAE,EACnC,aAAa,EACb,IAAI,EACJ,iBAAiB,EACjB,OAGC,EACD,OAAe,GAChB,EAAE,KAAK,CAAC,CAAC,CAAC,2CAsCV"}
|
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import Checkbox from "../checkbox";
|
|
4
4
|
import Loader from "../loader";
|
|
5
|
+
import clsx from "clsx";
|
|
5
6
|
export const DEFAULT_CARDS_LIST_ROWS_PER_PAGE_OPTIONS = [4, 8, 12, 16].map((item) => ({
|
|
6
7
|
label: item.toString(),
|
|
7
8
|
value: item,
|
|
8
9
|
}));
|
|
9
|
-
export default function CardsList({ CardComponent, rows, bulkActionFeature,
|
|
10
|
-
|
|
10
|
+
export default function CardsList({ CardComponent, rows, bulkActionFeature, classes = {
|
|
11
|
+
containerClasses: "grid grid-cols-4 gap-4",
|
|
12
|
+
cardClasses: "col-span-4 md:col-span-2 lg:col-span-1",
|
|
13
|
+
}, loading = false, }) {
|
|
14
|
+
return (_jsx("div", { className: "py-1", children: loading ? (_jsx("div", { className: "flex items-center justify-center", children: _jsx(Loader, {}) })) : (_jsx("div", { className: clsx(classes.containerClasses), children: rows.map((row) => (_jsxs("div", { className: clsx(classes.cardClasses), children: [bulkActionFeature && (_jsx(Checkbox, { checked: bulkActionFeature.selectedRowIds.length === rows.length, onChange: (checked) => {
|
|
11
15
|
if (checked) {
|
|
12
16
|
bulkActionFeature.setSelectedRowIds(rows.map((r) => r.id));
|
|
13
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-event-bus/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-event-bus/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,QAAA,MAAM,QAAQ,uBAAqB,CAAC;AAEpC,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-form/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-form/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAK3B,eAAO,MAAM,0BAA0B;;;;MAItC,CAAC;AASF,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC;IAExB,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACrC,gBAAgB,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IAEtE,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACtC,iBAAiB,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IAEvE,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;IACjE,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;CAChE,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,KAAK,EACL,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,GACrB,EAAE,KAAK,2CA4GP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-item/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-item/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAS,MAAM,sBAAsB,CAAC;AAKlD,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACpE,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACjE,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,WAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,eAAe,EACf,QAAQ,EACR,KAAK,GACN,EAAE,KAAK,2CAuGP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comments-list/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comments-list/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAQ3C,KAAK,KAAK,GAAG;IACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACjE,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,CAClB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,EAC7B,WAAW,EAAE;QACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;QACjE,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;QACpE,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,KACE,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,eAAe,EACf,QAAQ,EACR,eAAe,EACf,KAAU,EACV,iBAAiB,GAClB,EAAE,KAAK,2CAgGP"}
|
|
@@ -31,5 +31,5 @@ export default function CommentsList({ currentAccountId, highlightCommentId, edi
|
|
|
31
31
|
highlightCommentId,
|
|
32
32
|
})) : (_jsx(CommentItem, { comment: comment, isHighlight: highlightCommentId === comment.id, currentAccountId: currentAccountId, editComment: editComment, replyOnComment: replyOnComment, commentsBaseUrl: commentsBaseUrl, objectId: objectId, limit: limit }, comment.id))) }), loading && (_jsx("div", { className: "flex flex-col gap-3", children: Array(3)
|
|
33
33
|
.fill(null)
|
|
34
|
-
.map((_, i) => (_jsx(Skeleton, { className: "h-20 w-full rounded-lg" }, `comment-loading-${i}`))) })), totalCount !== 0 && !isReplyList && (_jsxs("p", { className: "text-gray-500 text-xs text-right mt-1", children: ["Showing ", comments.length, " of ", totalCount, " comments"] })), hasMoreComments && !loading && (_jsx("div", { className: clsx("flex justify-center mt-2"), children: _jsx(Button, { type: "button", onClick: loadMoreComments,
|
|
34
|
+
.map((_, i) => (_jsx(Skeleton, { className: "h-20 w-full rounded-lg" }, `comment-loading-${i}`))) })), totalCount !== 0 && !isReplyList && (_jsxs("p", { className: "text-gray-500 text-xs text-right mt-1", children: ["Showing ", comments.length, " of ", totalCount, " comments"] })), hasMoreComments && !loading && (_jsx("div", { className: clsx("flex justify-center mt-2"), children: _jsx(Button, { type: "button", onClick: loadMoreComments, variant: "secondary", children: "Load More" }) }))] })) }));
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/constants/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/constants/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;CAG1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/comments-container/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAa,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/comments-container/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAa,MAAM,sBAAsB,CAAC;AAQtD,MAAM,MAAM,KAAK,GAAG;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,iBAAiB,CAAC,EAAE,CAClB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,EAC7B,WAAW,EAAE;QACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;QACjE,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;QACpE,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,KACE,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,eAAe,EACf,QAAQ,EACR,KAAK,EACL,KAAU,EACV,kBAAkB,EAClB,iBAAiB,GAClB,EAAE,KAAK,2CAkDP"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
4
|
import { CONSTANTS } from "sea-platform-helpers";
|
|
5
5
|
import { getCookie } from "../../utils/cookie";
|
|
6
6
|
import { jwtDecode } from "../../utils/jwt";
|
|
7
7
|
import CommentForm from "./comment-form";
|
|
8
8
|
import CommentsList from "./comments-list";
|
|
9
9
|
import CommentItem from "./comment-item";
|
|
10
|
-
const accessToken = getCookie(CONSTANTS.JWT.JWTCookieKey);
|
|
11
|
-
const payload = jwtDecode(accessToken);
|
|
12
|
-
const accountId = payload.id;
|
|
13
10
|
export default function CommentsContainer({ commentsBaseUrl, objectId, model, limit = 10, highlightCommentId, renderCommentItem, }) {
|
|
11
|
+
const [accountId, setAccountId] = useState("");
|
|
14
12
|
const [commentToEdit, setCommentToEdit] = useState();
|
|
15
13
|
const [replyOnComment, setReplyOnComment] = useState();
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const accessToken = (_a = getCookie(CONSTANTS.JWT.JWTCookieKey)) !== null && _a !== void 0 ? _a : "";
|
|
17
|
+
const payload = (_b = jwtDecode(accessToken)) !== null && _b !== void 0 ? _b : null;
|
|
18
|
+
setAccountId((payload === null || payload === void 0 ? void 0 : payload.id) || "");
|
|
19
|
+
}, []);
|
|
16
20
|
return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx(CommentForm, { commentsBaseUrl: commentsBaseUrl, objectId: objectId, model: model, commentToEdit: commentToEdit, setCommentToEdit: setCommentToEdit, replyOnComment: replyOnComment, setReplyOnComment: setReplyOnComment, onCreateCommentSuccess: () => {
|
|
17
21
|
setCommentToEdit(undefined);
|
|
18
22
|
setReplyOnComment(undefined);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/confirm/index.tsx"],"names":[],"mappings":"AAKA,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAoDF,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,gBAAgB,EAAE,MAAM,GAAG,cAAc,GACxC,OAAO,CAAC,OAAO,CAAC,CA0BlB"}
|