@arkyn/components 3.0.1-beta.91 → 3.0.1-beta.93

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 (34) hide show
  1. package/dist/bundle.js +3434 -3280
  2. package/dist/bundle.umd.cjs +40 -40
  3. package/dist/components/pagination/chevronButton/index.d.ts +9 -0
  4. package/dist/components/pagination/chevronButton/index.d.ts.map +1 -0
  5. package/dist/components/pagination/chevronButton/index.js +9 -0
  6. package/dist/components/pagination/currentButton/index.d.ts +7 -0
  7. package/dist/components/pagination/currentButton/index.d.ts.map +1 -0
  8. package/dist/components/pagination/currentButton/index.js +6 -0
  9. package/dist/components/pagination/index.d.ts +51 -0
  10. package/dist/components/pagination/index.d.ts.map +1 -0
  11. package/dist/components/pagination/index.js +37 -0
  12. package/dist/components/pagination/pageButton/index.d.ts +8 -0
  13. package/dist/components/pagination/pageButton/index.d.ts.map +1 -0
  14. package/dist/components/pagination/pageButton/index.js +7 -0
  15. package/dist/components/pagination/paginationService.d.ts +26 -0
  16. package/dist/components/pagination/paginationService.d.ts.map +1 -0
  17. package/dist/components/pagination/paginationService.js +62 -0
  18. package/dist/components/pagination/spread/index.d.ts +4 -0
  19. package/dist/components/pagination/spread/index.d.ts.map +1 -0
  20. package/dist/components/pagination/spread/index.js +7 -0
  21. package/dist/hooks/useAutomation.d.ts +17 -22
  22. package/dist/hooks/useAutomation.d.ts.map +1 -1
  23. package/dist/hooks/useAutomation.js +30 -26
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +1 -0
  27. package/dist/style.css +1 -1
  28. package/dist/templates/badResponses.d.ts +3 -0
  29. package/dist/templates/badResponses.d.ts.map +1 -0
  30. package/dist/templates/badResponses.js +12 -0
  31. package/dist/templates/successResponses.d.ts +3 -0
  32. package/dist/templates/successResponses.d.ts.map +1 -0
  33. package/dist/templates/successResponses.js +2 -0
  34. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ import "./styles.css";
2
+ type ChevronButtonProps = {
3
+ orientation: "left" | "right";
4
+ disabled: boolean;
5
+ handlePageChange: () => void;
6
+ };
7
+ declare function ChevronButton(props: ChevronButtonProps): import("react/jsx-runtime").JSX.Element;
8
+ export { ChevronButton };
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/pagination/chevronButton/index.tsx"],"names":[],"mappings":"AACA,OAAO,cAAc,CAAC;AAEtB,KAAK,kBAAkB,GAAG;IACxB,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAa/C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ChevronLeft, ChevronRight } from "lucide-react";
3
+ import "./styles.css";
4
+ function ChevronButton(props) {
5
+ const { orientation, handlePageChange, disabled } = props;
6
+ const icon = { left: _jsx(ChevronLeft, {}), right: _jsx(ChevronRight, {}) };
7
+ return (_jsx("button", { className: "arkynChevronPageButton", disabled: disabled, onClick: handlePageChange, children: icon[orientation] }));
8
+ }
9
+ export { ChevronButton };
@@ -0,0 +1,7 @@
1
+ import "./styles.css";
2
+ type CurrentButtonProps = {
3
+ currentPage: number;
4
+ };
5
+ declare function CurrentButton({ currentPage }: CurrentButtonProps): import("react/jsx-runtime").JSX.Element;
6
+ export { CurrentButton };
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/pagination/currentButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,KAAK,kBAAkB,GAAG;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,iBAAS,aAAa,CAAC,EAAE,WAAW,EAAE,EAAE,kBAAkB,2CAMzD;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ function CurrentButton({ currentPage }) {
4
+ return (_jsx("button", { className: "arkynPaginationCurrentButton", disabled: true, children: currentPage }));
5
+ }
6
+ export { CurrentButton };
@@ -0,0 +1,51 @@
1
+ import { HTMLAttributes } from "react";
2
+ import "./styles.css";
3
+ /**
4
+ * Props for the Pagination component.
5
+ */
6
+ type PaginationProps = {
7
+ /**
8
+ * Number of sibling pages to show on each side of the current page.
9
+ * @default 1
10
+ */
11
+ siblingsCount?: number;
12
+ /**
13
+ * Total number of records/items to paginate.
14
+ */
15
+ totalCountRegisters: number;
16
+ /**
17
+ * The currently active page number (1-indexed).
18
+ */
19
+ currentPage: number;
20
+ /**
21
+ * Number of records to display per page.
22
+ * @default 10
23
+ */
24
+ registerPerPage?: number;
25
+ /**
26
+ * Callback function triggered when the page changes.
27
+ * @param page - The new page number
28
+ */
29
+ onChange?: (page: number) => void;
30
+ } & Omit<HTMLAttributes<HTMLDivElement>, "onChange">;
31
+ /**
32
+ * Pagination component for navigating through paginated data.
33
+ *
34
+ * @component
35
+ * @example
36
+ * ```tsx
37
+ * <Pagination
38
+ * totalCountRegisters={100}
39
+ * currentPage={1}
40
+ * registerPerPage={10}
41
+ * siblingsCount={1}
42
+ * onChange={(page) => console.log('Page changed to:', page)}
43
+ * />
44
+ * ```
45
+ *
46
+ * @param props - The component props
47
+ * @returns A pagination navigation component with page numbers and navigation buttons
48
+ */
49
+ declare function Pagination(props: PaginationProps): import("react/jsx-runtime").JSX.Element;
50
+ export { Pagination };
51
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/pagination/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAQvC,OAAO,cAAc,CAAC;AAEtB;;GAEG;AACH,KAAK,eAAe,GAAG;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC;AAErD;;;;;;;;;;;;;;;;;GAiBG;AAEH,iBAAS,UAAU,CAAC,KAAK,EAAE,eAAe,2CA6EzC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronButton } from "./chevronButton";
3
+ import { CurrentButton } from "./currentButton";
4
+ import { PageButton } from "./pageButton";
5
+ import { PaginationService } from "./paginationService";
6
+ import { Spread } from "./spread";
7
+ import "./styles.css";
8
+ /**
9
+ * Pagination component for navigating through paginated data.
10
+ *
11
+ * @component
12
+ * @example
13
+ * ```tsx
14
+ * <Pagination
15
+ * totalCountRegisters={100}
16
+ * currentPage={1}
17
+ * registerPerPage={10}
18
+ * siblingsCount={1}
19
+ * onChange={(page) => console.log('Page changed to:', page)}
20
+ * />
21
+ * ```
22
+ *
23
+ * @param props - The component props
24
+ * @returns A pagination navigation component with page numbers and navigation buttons
25
+ */
26
+ function Pagination(props) {
27
+ const { totalCountRegisters: baseTotalCountRegisters, siblingsCount: baseSiblingsCount, currentPage: baseCurrentPage, registerPerPage: baseRegisterPerPage, onChange: baseOnChange, ...rest } = props;
28
+ const { currentPage, siblingsCount, previousPages, nextPages, lastPage, handlePageChange, handleMinusChange, handlePlusChange, } = new PaginationService({
29
+ totalCountRegisters: baseTotalCountRegisters,
30
+ currentPage: baseCurrentPage,
31
+ registerPerPage: baseRegisterPerPage,
32
+ siblingsCount: baseSiblingsCount,
33
+ onChange: baseOnChange,
34
+ });
35
+ return (_jsxs("div", { className: "arkynPagination", ...rest, children: [_jsx(ChevronButton, { orientation: "left", handlePageChange: handleMinusChange, disabled: currentPage <= 1 }), currentPage > 1 + siblingsCount && (_jsxs(_Fragment, { children: [_jsx(PageButton, { page: 1, handlePageChange: () => handlePageChange(1) }), currentPage > 2 + siblingsCount && _jsx(Spread, {})] })), previousPages.map((page, index) => (_jsx(PageButton, { page: page, handlePageChange: handleMinusChange }, index))), _jsx(CurrentButton, { currentPage: currentPage }), nextPages.map((page, index) => (_jsx(PageButton, { page: page, handlePageChange: handlePlusChange }, index))), currentPage + siblingsCount < lastPage && (_jsxs(_Fragment, { children: [currentPage + 1 + siblingsCount < lastPage && _jsx(Spread, {}), _jsx(PageButton, { page: lastPage, handlePageChange: () => handlePageChange(lastPage) })] })), _jsx(ChevronButton, { orientation: "right", handlePageChange: handlePlusChange, disabled: currentPage >= lastPage })] }));
36
+ }
37
+ export { Pagination };
@@ -0,0 +1,8 @@
1
+ import "./styles.css";
2
+ type PageButtonProps = {
3
+ page: number;
4
+ handlePageChange: () => void;
5
+ };
6
+ declare function PageButton(props: PageButtonProps): import("react/jsx-runtime").JSX.Element;
7
+ export { PageButton };
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/pagination/pageButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,iBAAS,UAAU,CAAC,KAAK,EAAE,eAAe,2CAOzC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ function PageButton(props) {
4
+ const { page, handlePageChange } = props;
5
+ return (_jsx("button", { className: "arkynPaginationPageButton", onClick: handlePageChange, children: page }));
6
+ }
7
+ export { PageButton };
@@ -0,0 +1,26 @@
1
+ type PaginationServiceConstructor = {
2
+ currentPage: number;
3
+ totalCountRegisters: number;
4
+ registerPerPage?: number;
5
+ siblingsCount?: number;
6
+ onChange?: (page: number) => void;
7
+ };
8
+ declare class PaginationService {
9
+ currentPage: number;
10
+ totalCountRegisters: number;
11
+ registerPerPage: number;
12
+ siblingsCount: number;
13
+ lastPage: number;
14
+ onChange?: (page: number) => void;
15
+ previousPages: number[];
16
+ nextPages: number[];
17
+ private generatePagesArray;
18
+ private generatePreviousPages;
19
+ private generateNextPages;
20
+ constructor(props: PaginationServiceConstructor);
21
+ handlePageChange: (page: number) => void;
22
+ handlePlusChange: () => void;
23
+ handleMinusChange: () => void;
24
+ }
25
+ export { PaginationService };
26
+ //# sourceMappingURL=paginationService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paginationService.d.ts","sourceRoot":"","sources":["../../../src/components/pagination/paginationService.ts"],"names":[],"mappings":"AAAA,KAAK,4BAA4B,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,cAAM,iBAAiB;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,iBAAiB;gBAQb,KAAK,EAAE,4BAA4B;IAiB/C,gBAAgB,GAAI,MAAM,MAAM,UAO9B;IAEF,gBAAgB,aAMd;IAEF,iBAAiB,aAMf;CACH;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,62 @@
1
+ class PaginationService {
2
+ currentPage;
3
+ totalCountRegisters;
4
+ registerPerPage;
5
+ siblingsCount;
6
+ lastPage;
7
+ onChange;
8
+ previousPages;
9
+ nextPages;
10
+ generatePagesArray(from, to) {
11
+ return [...new Array(to - from)]
12
+ .map((_, index) => from + index + 1)
13
+ .filter((page) => page > 0);
14
+ }
15
+ generatePreviousPages(currentPage, siblingsCount) {
16
+ if (!(currentPage > 1))
17
+ return [];
18
+ return this.generatePagesArray(currentPage - 1 - siblingsCount, currentPage - 1);
19
+ }
20
+ generateNextPages(currentPage, siblingsCount) {
21
+ if (!(currentPage < this.lastPage))
22
+ return [];
23
+ return this.generatePagesArray(currentPage, Math.min(currentPage + siblingsCount, this.lastPage));
24
+ }
25
+ constructor(props) {
26
+ this.totalCountRegisters = props.totalCountRegisters;
27
+ this.currentPage = props.currentPage;
28
+ this.registerPerPage = props?.registerPerPage || 20;
29
+ this.siblingsCount = props?.siblingsCount || 2;
30
+ this.lastPage = Math.ceil(this.totalCountRegisters / this.registerPerPage);
31
+ this.onChange = props?.onChange;
32
+ this.previousPages = this.generatePreviousPages(this.currentPage, this.siblingsCount);
33
+ this.nextPages = this.generateNextPages(this.currentPage, this.siblingsCount);
34
+ }
35
+ handlePageChange = (page) => {
36
+ if (page < 1)
37
+ return;
38
+ if (page > this.lastPage)
39
+ return;
40
+ if (this.onChange) {
41
+ this.currentPage = page;
42
+ this.onChange(this.currentPage);
43
+ }
44
+ };
45
+ handlePlusChange = () => {
46
+ if (this.currentPage >= this.lastPage)
47
+ return;
48
+ if (this.onChange) {
49
+ this.currentPage += 1;
50
+ this.onChange(this.currentPage);
51
+ }
52
+ };
53
+ handleMinusChange = () => {
54
+ if (this.currentPage <= 1)
55
+ return;
56
+ if (this.onChange) {
57
+ this.currentPage -= 1;
58
+ this.onChange(this.currentPage);
59
+ }
60
+ };
61
+ }
62
+ export { PaginationService };
@@ -0,0 +1,4 @@
1
+ import "./styles.css";
2
+ declare function Spread(): import("react/jsx-runtime").JSX.Element;
3
+ export { Spread };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/pagination/spread/index.tsx"],"names":[],"mappings":"AACA,OAAO,cAAc,CAAC;AAEtB,iBAAS,MAAM,4CAMd;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Ellipsis } from "lucide-react";
3
+ import "./styles.css";
4
+ function Spread() {
5
+ return (_jsx("p", { className: "arkynPaginationSpread", children: _jsx(Ellipsis, {}) }));
6
+ }
7
+ export { Spread };
@@ -1,45 +1,40 @@
1
1
  /**
2
- * Hook for automating actions based on form data.
2
+ * Hook for automating actions based on form response data.
3
3
  *
4
- * This hook automates the closing of modals and the display of giveaways
5
- * based on the properties provided in the formResponseData object.
4
+ * This hook automates the closing of modals and the display of toast notifications
5
+ * based on the properties provided in the form response data object.
6
6
  *
7
- * @param {Object} formResponseData - Object containing form data for automation
7
+ * @param {Object} formResponseData - Object containing form response data for automation
8
8
  * @param {boolean} [formResponseData.closeModal] - If true, closes all open modals
9
- * @param {string} [formResponseData.message] - Message to be displayed in the giveaway
10
- * @param {"success" | "danger"} [formResponseData.type] - Type of giveaway to be displayed
9
+ * @param {string} [formResponseData.message] - Message to be displayed in the toast notification
10
+ * @param {string} [formResponseData.name] - Response name used to check against known error responses
11
+ * @param {"success" | "danger"} [formResponseData.type] - Type of toast notification to be displayed
11
12
  *
12
13
  * @example
13
14
  * ```tsx
14
- * // Basic usage example
15
- * const formResponseData = {
15
+ * // Complete usage with success notification
16
+ * const responseData = {
16
17
  * closeModal: true,
17
- * message: "Operation successfully completed!",
18
+ * message: "Operation completed successfully!",
18
19
  * type: "success"
19
20
  * };
20
21
  *
21
- * useAutomation(formResponseData);
22
+ * useAutomation(responseData);
22
23
  * ```
23
24
  *
24
25
  * @example
25
26
  * ```tsx
26
- * // Use with only modal closing
27
- * const formResponseData = {
28
- * closeModal: true
29
- * };
30
- *
31
- * useAutomation(formResponseData);
27
+ * // Close modal only
28
+ * useAutomation({ closeModal: true });
32
29
  * ```
33
30
  *
34
31
  * @example
35
32
  * ```tsx
36
- * // Use with only error message display
37
- * const formResponseData = {
33
+ * // Display error notification
34
+ * useAutomation({
38
35
  * message: "Error processing request",
39
- * type: "danger" // "success" | "danger"
40
- * };
41
- *
42
- * useAutomation(formResponseData);
36
+ * type: "danger"
37
+ * });
43
38
  * ```
44
39
  */
45
40
  declare function useAutomation(formResponseData: any): void;
@@ -1 +1 @@
1
- {"version":3,"file":"useAutomation.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutomation.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,iBAAS,aAAa,CAAC,gBAAgB,EAAE,GAAG,QAa3C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"useAutomation.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutomation.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,iBAAS,aAAa,CAAC,gBAAgB,EAAE,GAAG,QAmB3C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,48 +1,45 @@
1
1
  import { useEffect } from "react";
2
2
  import { useModal } from "./useModal";
3
3
  import { useToast } from "./useToast";
4
+ import { badResponses } from "../templates/badResponses";
5
+ import { successResponses } from "../templates/successResponses";
4
6
  /**
5
- * Hook for automating actions based on form data.
7
+ * Hook for automating actions based on form response data.
6
8
  *
7
- * This hook automates the closing of modals and the display of giveaways
8
- * based on the properties provided in the formResponseData object.
9
+ * This hook automates the closing of modals and the display of toast notifications
10
+ * based on the properties provided in the form response data object.
9
11
  *
10
- * @param {Object} formResponseData - Object containing form data for automation
12
+ * @param {Object} formResponseData - Object containing form response data for automation
11
13
  * @param {boolean} [formResponseData.closeModal] - If true, closes all open modals
12
- * @param {string} [formResponseData.message] - Message to be displayed in the giveaway
13
- * @param {"success" | "danger"} [formResponseData.type] - Type of giveaway to be displayed
14
+ * @param {string} [formResponseData.message] - Message to be displayed in the toast notification
15
+ * @param {string} [formResponseData.name] - Response name used to check against known error responses
16
+ * @param {"success" | "danger"} [formResponseData.type] - Type of toast notification to be displayed
14
17
  *
15
18
  * @example
16
19
  * ```tsx
17
- * // Basic usage example
18
- * const formResponseData = {
20
+ * // Complete usage with success notification
21
+ * const responseData = {
19
22
  * closeModal: true,
20
- * message: "Operation successfully completed!",
23
+ * message: "Operation completed successfully!",
21
24
  * type: "success"
22
25
  * };
23
26
  *
24
- * useAutomation(formResponseData);
27
+ * useAutomation(responseData);
25
28
  * ```
26
29
  *
27
30
  * @example
28
31
  * ```tsx
29
- * // Use with only modal closing
30
- * const formResponseData = {
31
- * closeModal: true
32
- * };
33
- *
34
- * useAutomation(formResponseData);
32
+ * // Close modal only
33
+ * useAutomation({ closeModal: true });
35
34
  * ```
36
35
  *
37
36
  * @example
38
37
  * ```tsx
39
- * // Use with only error message display
40
- * const formResponseData = {
38
+ * // Display error notification
39
+ * useAutomation({
41
40
  * message: "Error processing request",
42
- * type: "danger" // "success" | "danger"
43
- * };
44
- *
45
- * useAutomation(formResponseData);
41
+ * type: "danger"
42
+ * });
46
43
  * ```
47
44
  */
48
45
  function useAutomation(formResponseData) {
@@ -50,14 +47,21 @@ function useAutomation(formResponseData) {
50
47
  const { showToast } = useToast();
51
48
  const closeModal = formResponseData?.closeModal;
52
49
  const message = formResponseData?.message;
50
+ const name = formResponseData?.name;
53
51
  const type = formResponseData?.type;
54
52
  useEffect(() => {
55
53
  if (closeModal)
56
54
  closeAll();
57
- if (message && type === "success")
58
- showToast({ message, type: "success" });
59
- if (message && type === "danger")
60
- showToast({ message, type: "danger" });
55
+ if (message) {
56
+ if (type === "success")
57
+ showToast({ message, type: "success" });
58
+ if (type === "danger")
59
+ showToast({ message, type: "danger" });
60
+ if (badResponses.includes(name))
61
+ showToast({ message, type: "danger" });
62
+ if (successResponses.includes(name))
63
+ showToast({ message, type: "success" });
64
+ }
61
65
  }, [formResponseData]);
62
66
  }
63
67
  export { useAutomation };
package/dist/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export { ModalContainer } from "./components/modal/modalContainer";
28
28
  export { ModalFooter } from "./components/modal/modalFooter";
29
29
  export { ModalHeader } from "./components/modal/modalHeader";
30
30
  export { MultiSelect } from "./components/multiSelect";
31
+ export { Pagination } from "./components/pagination";
31
32
  export { PhoneInput } from "./components/phoneInput";
32
33
  export { Popover } from "./components/popover";
33
34
  export { RadioBox } from "./components/radio/radioBox";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OA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AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ export { ModalContainer } from "./components/modal/modalContainer";
29
29
  export { ModalFooter } from "./components/modal/modalFooter";
30
30
  export { ModalHeader } from "./components/modal/modalHeader";
31
31
  export { MultiSelect } from "./components/multiSelect";
32
+ export { Pagination } from "./components/pagination";
32
33
  export { PhoneInput } from "./components/phoneInput";
33
34
  export { Popover } from "./components/popover";
34
35
  export { RadioBox } from "./components/radio/radioBox";