@lerianstudio/sindarian-ui 1.0.0-beta.1

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 (201) hide show
  1. package/README.md +235 -0
  2. package/dist/components/breadcrumb/get-breadcrumb-paths.d.ts +10 -0
  3. package/dist/components/breadcrumb/get-breadcrumb-paths.d.ts.map +1 -0
  4. package/dist/components/breadcrumb/get-breadcrumb-paths.js +15 -0
  5. package/dist/components/breadcrumb/index.d.ts +10 -0
  6. package/dist/components/breadcrumb/index.d.ts.map +1 -0
  7. package/dist/components/breadcrumb/index.js +13 -0
  8. package/dist/components/entity-box/index.d.ts +17 -0
  9. package/dist/components/entity-box/index.d.ts.map +1 -0
  10. package/dist/components/entity-box/index.js +39 -0
  11. package/dist/components/entity-data-table/index.d.ts +17 -0
  12. package/dist/components/entity-data-table/index.d.ts.map +1 -0
  13. package/dist/components/entity-data-table/index.js +20 -0
  14. package/dist/components/form/combo-box-field/index.d.ts +14 -0
  15. package/dist/components/form/combo-box-field/index.d.ts.map +1 -0
  16. package/dist/components/form/combo-box-field/index.js +35 -0
  17. package/dist/components/form/country-field/index.d.ts +4 -0
  18. package/dist/components/form/country-field/index.d.ts.map +1 -0
  19. package/dist/components/form/country-field/index.js +11 -0
  20. package/dist/components/form/index.d.ts +8 -0
  21. package/dist/components/form/index.d.ts.map +1 -0
  22. package/dist/components/form/index.js +23 -0
  23. package/dist/components/form/input-field/index.d.ts +23 -0
  24. package/dist/components/form/input-field/index.d.ts.map +1 -0
  25. package/dist/components/form/input-field/index.js +14 -0
  26. package/dist/components/form/pagination-limit-field/index.d.ts +8 -0
  27. package/dist/components/form/pagination-limit-field/index.d.ts.map +1 -0
  28. package/dist/components/form/pagination-limit-field/index.js +10 -0
  29. package/dist/components/form/password-field/index.d.ts +12 -0
  30. package/dist/components/form/password-field/index.d.ts.map +1 -0
  31. package/dist/components/form/password-field/index.js +15 -0
  32. package/dist/components/form/select-field/index.d.ts +18 -0
  33. package/dist/components/form/select-field/index.d.ts.map +1 -0
  34. package/dist/components/form/select-field/index.js +14 -0
  35. package/dist/components/form/state-field/index.d.ts +8 -0
  36. package/dist/components/form/state-field/index.d.ts.map +1 -0
  37. package/dist/components/form/state-field/index.js +42 -0
  38. package/dist/components/form/switch-field/index.d.ts +14 -0
  39. package/dist/components/form/switch-field/index.d.ts.map +1 -0
  40. package/dist/components/form/switch-field/index.js +11 -0
  41. package/dist/components/page/index.d.ts +4 -0
  42. package/dist/components/page/index.d.ts.map +1 -0
  43. package/dist/components/page/index.js +16 -0
  44. package/dist/components/page-header/index.d.ts +33 -0
  45. package/dist/components/page-header/index.d.ts.map +1 -0
  46. package/dist/components/page-header/index.js +47 -0
  47. package/dist/components/pagination/index.d.ts +8 -0
  48. package/dist/components/pagination/index.d.ts.map +1 -0
  49. package/dist/components/pagination/index.js +10 -0
  50. package/dist/components/table/id-table-cell.d.ts +6 -0
  51. package/dist/components/table/id-table-cell.d.ts.map +1 -0
  52. package/dist/components/table/id-table-cell.js +16 -0
  53. package/dist/components/table/index.d.ts +3 -0
  54. package/dist/components/table/index.d.ts.map +1 -0
  55. package/dist/components/table/index.js +18 -0
  56. package/dist/components/table/locked-table-actions.d.ts +6 -0
  57. package/dist/components/table/locked-table-actions.d.ts.map +1 -0
  58. package/dist/components/table/locked-table-actions.js +11 -0
  59. package/dist/components/table/name-table-cell.d.ts +6 -0
  60. package/dist/components/table/name-table-cell.d.ts.map +1 -0
  61. package/dist/components/table/name-table-cell.js +10 -0
  62. package/dist/components/ui/alert/index.d.ts +11 -0
  63. package/dist/components/ui/alert/index.d.ts.map +1 -0
  64. package/dist/components/ui/alert/index.js +31 -0
  65. package/dist/components/ui/autocomplete/index.d.ts +54 -0
  66. package/dist/components/ui/autocomplete/index.d.ts.map +1 -0
  67. package/dist/components/ui/autocomplete/index.js +324 -0
  68. package/dist/components/ui/autosize-textarea/index.d.ts +15 -0
  69. package/dist/components/ui/autosize-textarea/index.d.ts.map +1 -0
  70. package/dist/components/ui/autosize-textarea/index.js +89 -0
  71. package/dist/components/ui/avatar/index.d.ts +7 -0
  72. package/dist/components/ui/avatar/index.d.ts.map +1 -0
  73. package/dist/components/ui/avatar/index.js +51 -0
  74. package/dist/components/ui/badge/index.d.ts +11 -0
  75. package/dist/components/ui/badge/index.d.ts.map +1 -0
  76. package/dist/components/ui/badge/index.js +28 -0
  77. package/dist/components/ui/breadcrumb/index.d.ts +12 -0
  78. package/dist/components/ui/breadcrumb/index.d.ts.map +1 -0
  79. package/dist/components/ui/breadcrumb/index.js +35 -0
  80. package/dist/components/ui/button/index.d.ts +17 -0
  81. package/dist/components/ui/button/index.d.ts.map +1 -0
  82. package/dist/components/ui/button/index.js +72 -0
  83. package/dist/components/ui/card/index.d.ts +10 -0
  84. package/dist/components/ui/card/index.d.ts.map +1 -0
  85. package/dist/components/ui/card/index.js +32 -0
  86. package/dist/components/ui/checkbox/index.d.ts +5 -0
  87. package/dist/components/ui/checkbox/index.d.ts.map +1 -0
  88. package/dist/components/ui/checkbox/index.js +44 -0
  89. package/dist/components/ui/collapsible/index.d.ts +6 -0
  90. package/dist/components/ui/collapsible/index.d.ts.map +1 -0
  91. package/dist/components/ui/collapsible/index.js +50 -0
  92. package/dist/components/ui/command/index.d.ts +14 -0
  93. package/dist/components/ui/command/index.d.ts.map +1 -0
  94. package/dist/components/ui/command/index.js +45 -0
  95. package/dist/components/ui/dialog/index.d.ts +16 -0
  96. package/dist/components/ui/dialog/index.d.ts.map +1 -0
  97. package/dist/components/ui/dialog/index.js +80 -0
  98. package/dist/components/ui/dropdown-menu/index.d.ts +27 -0
  99. package/dist/components/ui/dropdown-menu/index.d.ts.map +1 -0
  100. package/dist/components/ui/dropdown-menu/index.js +107 -0
  101. package/dist/components/ui/form.d.ts +37 -0
  102. package/dist/components/ui/form.d.ts.map +1 -0
  103. package/dist/components/ui/form.js +110 -0
  104. package/dist/components/ui/input/index.d.ts +4 -0
  105. package/dist/components/ui/input/index.d.ts.map +1 -0
  106. package/dist/components/ui/input/index.js +10 -0
  107. package/dist/components/ui/input-with-icon/index.d.ts +12 -0
  108. package/dist/components/ui/input-with-icon/index.d.ts.map +1 -0
  109. package/dist/components/ui/input-with-icon/index.js +57 -0
  110. package/dist/components/ui/label/index.d.ts +7 -0
  111. package/dist/components/ui/label/index.d.ts.map +1 -0
  112. package/dist/components/ui/label/index.js +45 -0
  113. package/dist/components/ui/label/label.stories.d.ts +5 -0
  114. package/dist/components/ui/label/label.stories.d.ts.map +1 -0
  115. package/dist/components/ui/label/label.stories.js +24 -0
  116. package/dist/components/ui/loading-button/index.d.ts +7 -0
  117. package/dist/components/ui/loading-button/index.d.ts.map +1 -0
  118. package/dist/components/ui/loading-button/index.js +9 -0
  119. package/dist/components/ui/multiple-select/index.d.ts +91 -0
  120. package/dist/components/ui/multiple-select/index.d.ts.map +1 -0
  121. package/dist/components/ui/multiple-select/index.js +233 -0
  122. package/dist/components/ui/paper/index.d.ts +4 -0
  123. package/dist/components/ui/paper/index.d.ts.map +1 -0
  124. package/dist/components/ui/paper/index.js +8 -0
  125. package/dist/components/ui/popover/index.d.ts +8 -0
  126. package/dist/components/ui/popover/index.d.ts.map +1 -0
  127. package/dist/components/ui/popover/index.js +55 -0
  128. package/dist/components/ui/progress/index.d.ts +8 -0
  129. package/dist/components/ui/progress/index.d.ts.map +1 -0
  130. package/dist/components/ui/progress/index.js +43 -0
  131. package/dist/components/ui/select/index.d.ts +19 -0
  132. package/dist/components/ui/select/index.d.ts.map +1 -0
  133. package/dist/components/ui/select/index.js +101 -0
  134. package/dist/components/ui/separator/index.d.ts +5 -0
  135. package/dist/components/ui/separator/index.d.ts.map +1 -0
  136. package/dist/components/ui/separator/index.js +43 -0
  137. package/dist/components/ui/sheet/index.d.ts +19 -0
  138. package/dist/components/ui/sheet/index.d.ts.map +1 -0
  139. package/dist/components/ui/sheet/index.js +94 -0
  140. package/dist/components/ui/skeleton/index.d.ts +3 -0
  141. package/dist/components/ui/skeleton/index.d.ts.map +1 -0
  142. package/dist/components/ui/skeleton/index.js +8 -0
  143. package/dist/components/ui/stepper/index.d.ts +18 -0
  144. package/dist/components/ui/stepper/index.d.ts.map +1 -0
  145. package/dist/components/ui/stepper/index.js +29 -0
  146. package/dist/components/ui/switch/index.d.ts +5 -0
  147. package/dist/components/ui/switch/index.d.ts.map +1 -0
  148. package/dist/components/ui/switch/index.js +43 -0
  149. package/dist/components/ui/table/index.d.ts +21 -0
  150. package/dist/components/ui/table/index.d.ts.map +1 -0
  151. package/dist/components/ui/table/index.js +56 -0
  152. package/dist/components/ui/tabs/index.d.ts +8 -0
  153. package/dist/components/ui/tabs/index.d.ts.map +1 -0
  154. package/dist/components/ui/tabs/index.js +55 -0
  155. package/dist/components/ui/textarea/index.d.ts +4 -0
  156. package/dist/components/ui/textarea/index.d.ts.map +1 -0
  157. package/dist/components/ui/textarea/index.js +8 -0
  158. package/dist/components/ui/toast/index.d.ts +17 -0
  159. package/dist/components/ui/toast/index.d.ts.map +1 -0
  160. package/dist/components/ui/toast/index.js +80 -0
  161. package/dist/components/ui/toast/toaster.d.ts +2 -0
  162. package/dist/components/ui/toast/toaster.d.ts.map +1 -0
  163. package/dist/components/ui/toast/toaster.js +13 -0
  164. package/dist/components/ui/tooltip/index.d.ts +11 -0
  165. package/dist/components/ui/tooltip/index.d.ts.map +1 -0
  166. package/dist/components/ui/tooltip/index.js +66 -0
  167. package/dist/hooks/use-click-away.d.ts +9 -0
  168. package/dist/hooks/use-click-away.d.ts.map +1 -0
  169. package/dist/hooks/use-click-away.js +29 -0
  170. package/dist/hooks/use-click-away.test.d.ts +2 -0
  171. package/dist/hooks/use-click-away.test.d.ts.map +1 -0
  172. package/dist/hooks/use-click-away.test.js +39 -0
  173. package/dist/hooks/use-pagination.d.ts +13 -0
  174. package/dist/hooks/use-pagination.d.ts.map +1 -0
  175. package/dist/hooks/use-pagination.js +41 -0
  176. package/dist/hooks/use-stepper.d.ts +11 -0
  177. package/dist/hooks/use-stepper.d.ts.map +1 -0
  178. package/dist/hooks/use-stepper.js +26 -0
  179. package/dist/hooks/use-stepper.test.d.ts +2 -0
  180. package/dist/hooks/use-stepper.test.d.ts.map +1 -0
  181. package/dist/hooks/use-stepper.test.js +45 -0
  182. package/dist/hooks/use-toast.d.ts +45 -0
  183. package/dist/hooks/use-toast.d.ts.map +1 -0
  184. package/dist/hooks/use-toast.js +164 -0
  185. package/dist/index.d.ts +45 -0
  186. package/dist/index.d.ts.map +1 -0
  187. package/dist/index.js +64 -0
  188. package/dist/lib/utils.d.ts +3 -0
  189. package/dist/lib/utils.d.ts.map +1 -0
  190. package/dist/lib/utils.js +8 -0
  191. package/dist/public/countries.json +21210 -0
  192. package/dist/types/metadata-type.d.ts +2 -0
  193. package/dist/types/metadata-type.d.ts.map +1 -0
  194. package/dist/types/metadata-type.js +2 -0
  195. package/dist/utils/country-utils.d.ts +17 -0
  196. package/dist/utils/country-utils.d.ts.map +1 -0
  197. package/dist/utils/country-utils.js +25 -0
  198. package/dist/utils/currency-codes.d.ts +5 -0
  199. package/dist/utils/currency-codes.d.ts.map +1 -0
  200. package/dist/utils/currency-codes.js +184 -0
  201. package/package.json +76 -0
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ /**
3
+ * Detects clicks outside of a specified component and triggers a callback function.
4
+ *
5
+ * @param ref Component reference
6
+ * @param onClickAway Callback function to be called when a click is detected outside the component
7
+ */
8
+ export declare const useClickAway: (ref: React.RefObject<HTMLElement | null>, onClickAway: (event: MouseEvent | TouchEvent) => void) => void;
9
+ //# sourceMappingURL=use-click-away.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-click-away.d.ts","sourceRoot":"","sources":["../../src/hooks/use-click-away.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GACvB,KAAK,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACxC,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,KAAK,IAAI,SAoBtD,CAAA"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useClickAway = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ /**
9
+ * Detects clicks outside of a specified component and triggers a callback function.
10
+ *
11
+ * @param ref Component reference
12
+ * @param onClickAway Callback function to be called when a click is detected outside the component
13
+ */
14
+ const useClickAway = (ref, onClickAway) => {
15
+ const handleClick = react_1.default.useCallback((event) => {
16
+ if (ref.current && !ref.current.contains(event.target)) {
17
+ onClickAway(event);
18
+ }
19
+ }, [ref, onClickAway]);
20
+ react_1.default.useEffect(() => {
21
+ document.addEventListener('mousedown', handleClick);
22
+ document.addEventListener('touchend', handleClick);
23
+ return () => {
24
+ document.removeEventListener('mousedown', handleClick);
25
+ document.removeEventListener('touchend', handleClick);
26
+ };
27
+ }, [ref, handleClick]);
28
+ };
29
+ exports.useClickAway = useClickAway;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-click-away.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-click-away.test.d.ts","sourceRoot":"","sources":["../../src/hooks/use-click-away.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("@testing-library/react");
4
+ const use_click_away_1 = require("./use-click-away");
5
+ describe('useClickAway', () => {
6
+ let ref;
7
+ let onClickAway;
8
+ beforeEach(() => {
9
+ ref = { current: document.createElement('div') };
10
+ onClickAway = jest.fn();
11
+ document.body.appendChild(ref.current);
12
+ });
13
+ afterEach(() => {
14
+ document.body.removeChild(ref.current);
15
+ jest.clearAllMocks();
16
+ });
17
+ it('should call onClickAway when clicking outside the ref element', () => {
18
+ (0, react_1.renderHook)(() => (0, use_click_away_1.useClickAway)(ref, onClickAway));
19
+ const outsideElement = document.createElement('div');
20
+ document.body.appendChild(outsideElement);
21
+ outsideElement.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));
22
+ expect(onClickAway).toHaveBeenCalledTimes(1);
23
+ document.body.removeChild(outsideElement);
24
+ });
25
+ it('should not call onClickAway when clicking inside the ref element', () => {
26
+ (0, react_1.renderHook)(() => (0, use_click_away_1.useClickAway)(ref, onClickAway));
27
+ ref.current.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));
28
+ expect(onClickAway).not.toHaveBeenCalled();
29
+ });
30
+ it('should clean up event listeners on unmount', () => {
31
+ const { unmount } = (0, react_1.renderHook)(() => (0, use_click_away_1.useClickAway)(ref, onClickAway));
32
+ unmount();
33
+ const outsideElement = document.createElement('div');
34
+ document.body.appendChild(outsideElement);
35
+ outsideElement.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));
36
+ expect(onClickAway).not.toHaveBeenCalled();
37
+ document.body.removeChild(outsideElement);
38
+ });
39
+ });
@@ -0,0 +1,13 @@
1
+ export type UsePaginationProps = {
2
+ total?: number;
3
+ };
4
+ export declare function usePagination({ total }: UsePaginationProps): {
5
+ page: number;
6
+ limit: number;
7
+ setLimit: (limit: number) => void;
8
+ setPage: (page: number) => void;
9
+ nextPage: () => void;
10
+ previousPage: () => void;
11
+ };
12
+ export type UsePaginationReturn = ReturnType<typeof usePagination>;
13
+ //# sourceMappingURL=use-pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-pagination.d.ts","sourceRoot":"","sources":["../../src/hooks/use-pagination.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAgB,aAAa,CAAC,EAAE,KAAS,EAAE,EAAE,kBAAkB;;;sBA8BpC,MAAM;oBARR,MAAM;;;EAwB9B;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePagination = usePagination;
4
+ const react_1 = require("react");
5
+ function usePagination({ total = 1 }) {
6
+ const [page, _setPage] = (0, react_1.useState)(1);
7
+ const [limit, _setLimit] = (0, react_1.useState)(10);
8
+ const totalPages = Math.ceil(total / limit);
9
+ const nextPage = () => {
10
+ if (page + 1 > totalPages) {
11
+ return;
12
+ }
13
+ _setPage((page) => page + 1);
14
+ };
15
+ const previousPage = () => {
16
+ if (page - 1 < 1) {
17
+ return;
18
+ }
19
+ _setPage((page) => page - 1);
20
+ };
21
+ const setPage = (page) => {
22
+ if (page < 1 || page > totalPages) {
23
+ return;
24
+ }
25
+ _setPage(page);
26
+ };
27
+ const setLimit = (limit) => {
28
+ if (limit < 1) {
29
+ return;
30
+ }
31
+ _setLimit(limit);
32
+ };
33
+ return {
34
+ page,
35
+ limit,
36
+ setLimit,
37
+ setPage,
38
+ nextPage,
39
+ previousPage
40
+ };
41
+ }
@@ -0,0 +1,11 @@
1
+ export type UseStepperProps = {
2
+ defaultStep?: number;
3
+ maxSteps?: number;
4
+ };
5
+ export declare const useStepper: ({ defaultStep, maxSteps }: UseStepperProps) => {
6
+ step: number;
7
+ setStep: import("react").Dispatch<import("react").SetStateAction<number>>;
8
+ handleNext: () => void;
9
+ handlePrevious: () => void;
10
+ };
11
+ //# sourceMappingURL=use-stepper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-stepper.d.ts","sourceRoot":"","sources":["../../src/hooks/use-stepper.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,2BAGxB,eAAe;;;;;CAyBjB,CAAA"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useStepper = void 0;
4
+ const react_1 = require("react");
5
+ const useStepper = ({ defaultStep = 0, maxSteps = 2 }) => {
6
+ const [step, setStep] = (0, react_1.useState)(defaultStep);
7
+ const handleNext = () => {
8
+ if (maxSteps && step >= maxSteps - 1) {
9
+ return;
10
+ }
11
+ setStep((prev) => prev + 1);
12
+ };
13
+ const handlePrevious = () => {
14
+ if (step <= 0) {
15
+ return;
16
+ }
17
+ setStep((prev) => prev - 1);
18
+ };
19
+ return {
20
+ step,
21
+ setStep,
22
+ handleNext,
23
+ handlePrevious
24
+ };
25
+ };
26
+ exports.useStepper = useStepper;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-stepper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-stepper.test.d.ts","sourceRoot":"","sources":["../../src/hooks/use-stepper.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("@testing-library/react");
4
+ const use_stepper_1 = require("./use-stepper");
5
+ describe('useStepper', () => {
6
+ it('should initialize with the correct step', () => {
7
+ const { result } = (0, react_1.renderHook)(() => (0, use_stepper_1.useStepper)({}));
8
+ expect(result.current.step).toBe(0);
9
+ });
10
+ it('should go to the next step', () => {
11
+ const { result } = (0, react_1.renderHook)(() => (0, use_stepper_1.useStepper)({}));
12
+ (0, react_1.act)(() => {
13
+ result.current.handleNext();
14
+ });
15
+ expect(result.current.step).toBe(1);
16
+ });
17
+ it('should go to the previous step', () => {
18
+ const { result } = (0, react_1.renderHook)(() => (0, use_stepper_1.useStepper)({ defaultStep: 1 }));
19
+ (0, react_1.act)(() => {
20
+ result.current.handlePrevious();
21
+ });
22
+ expect(result.current.step).toBe(0);
23
+ });
24
+ it('should not go below step 0', () => {
25
+ const { result } = (0, react_1.renderHook)(() => (0, use_stepper_1.useStepper)({}));
26
+ (0, react_1.act)(() => {
27
+ result.current.handlePrevious();
28
+ });
29
+ expect(result.current.step).toBe(0);
30
+ });
31
+ it('should not exceed the maximum steps', () => {
32
+ const { result } = (0, react_1.renderHook)(() => (0, use_stepper_1.useStepper)({ maxSteps: 2 }));
33
+ expect(result.current.step).toBe(0);
34
+ (0, react_1.act)(() => {
35
+ result.current.handleNext();
36
+ });
37
+ (0, react_1.act)(() => {
38
+ result.current.handleNext();
39
+ });
40
+ (0, react_1.act)(() => {
41
+ result.current.handleNext();
42
+ });
43
+ expect(result.current.step).toBe(1);
44
+ });
45
+ });
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+ import type { ToastActionElement, ToastProps } from '../components/ui/toast';
3
+ type ToasterToast = ToastProps & {
4
+ id: string;
5
+ title?: React.ReactNode;
6
+ description?: React.ReactNode;
7
+ action?: ToastActionElement;
8
+ };
9
+ declare const actionTypes: {
10
+ readonly ADD_TOAST: "ADD_TOAST";
11
+ readonly UPDATE_TOAST: "UPDATE_TOAST";
12
+ readonly DISMISS_TOAST: "DISMISS_TOAST";
13
+ readonly REMOVE_TOAST: "REMOVE_TOAST";
14
+ };
15
+ type ActionType = typeof actionTypes;
16
+ type Action = {
17
+ type: ActionType['ADD_TOAST'];
18
+ toast: ToasterToast;
19
+ } | {
20
+ type: ActionType['UPDATE_TOAST'];
21
+ toast: Partial<ToasterToast>;
22
+ } | {
23
+ type: ActionType['DISMISS_TOAST'];
24
+ toastId?: ToasterToast['id'];
25
+ } | {
26
+ type: ActionType['REMOVE_TOAST'];
27
+ toastId?: ToasterToast['id'];
28
+ };
29
+ interface State {
30
+ toasts: ToasterToast[];
31
+ }
32
+ export declare const reducer: (state: State, action: Action) => State;
33
+ type Toast = Omit<ToasterToast, 'id'>;
34
+ declare function toast({ ...props }: Toast): {
35
+ id: string;
36
+ dismiss: () => void;
37
+ update: (props: ToasterToast) => void;
38
+ };
39
+ declare function useToast(): {
40
+ toast: typeof toast;
41
+ dismiss: (toastId?: string) => void;
42
+ toasts: ToasterToast[];
43
+ };
44
+ export { useToast, toast };
45
+ //# sourceMappingURL=use-toast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-toast.d.ts","sourceRoot":"","sources":["../../src/hooks/use-toast.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAK3E,KAAK,YAAY,GAAG,UAAU,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,MAAM,CAAC,EAAE,kBAAkB,CAAA;CAC5B,CAAA;AAED,QAAA,MAAM,WAAW;;;;;CAKP,CAAA;AASV,KAAK,UAAU,GAAG,OAAO,WAAW,CAAA;AAEpC,KAAK,MAAM,GACP;IACE,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;IAC7B,KAAK,EAAE,YAAY,CAAA;CACpB,GACD;IACE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IAChC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAC7B,GACD;IACE,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IACjC,OAAO,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;CAC7B,GACD;IACE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IAChC,OAAO,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;CAC7B,CAAA;AAEL,UAAU,KAAK;IACb,MAAM,EAAE,YAAY,EAAE,CAAA;CACvB;AAoBD,eAAO,MAAM,OAAO,GAAI,OAAO,KAAK,EAAE,QAAQ,MAAM,KAAG,KAoDtD,CAAA;AAaD,KAAK,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAErC,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK;;;oBAGT,YAAY;EAwBpC;AAED,iBAAS,QAAQ;;wBAgBO,MAAM;YArIpB,YAAY,EAAE;EAuIvB;AAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA"}
@@ -0,0 +1,164 @@
1
+ 'use client';
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.reducer = void 0;
38
+ exports.useToast = useToast;
39
+ exports.toast = toast;
40
+ const React = __importStar(require("react"));
41
+ const TOAST_LIMIT = 1;
42
+ const TOAST_REMOVE_DELAY = 1000000;
43
+ const actionTypes = {
44
+ ADD_TOAST: 'ADD_TOAST',
45
+ UPDATE_TOAST: 'UPDATE_TOAST',
46
+ DISMISS_TOAST: 'DISMISS_TOAST',
47
+ REMOVE_TOAST: 'REMOVE_TOAST'
48
+ };
49
+ let count = 0;
50
+ function genId() {
51
+ count = (count + 1) % Number.MAX_SAFE_INTEGER;
52
+ return count.toString();
53
+ }
54
+ const toastTimeouts = new Map();
55
+ const addToRemoveQueue = (toastId) => {
56
+ if (toastTimeouts.has(toastId)) {
57
+ return;
58
+ }
59
+ const timeout = setTimeout(() => {
60
+ toastTimeouts.delete(toastId);
61
+ dispatch({
62
+ type: 'REMOVE_TOAST',
63
+ toastId: toastId
64
+ });
65
+ }, TOAST_REMOVE_DELAY);
66
+ toastTimeouts.set(toastId, timeout);
67
+ };
68
+ const reducer = (state, action) => {
69
+ switch (action.type) {
70
+ case 'ADD_TOAST':
71
+ return {
72
+ ...state,
73
+ toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)
74
+ };
75
+ case 'UPDATE_TOAST':
76
+ return {
77
+ ...state,
78
+ toasts: state.toasts.map((t) => t.id === action.toast.id ? { ...t, ...action.toast } : t)
79
+ };
80
+ case 'DISMISS_TOAST': {
81
+ const { toastId } = action;
82
+ // but I'll keep it here for simplicity
83
+ if (toastId) {
84
+ addToRemoveQueue(toastId);
85
+ }
86
+ else {
87
+ state.toasts.forEach((toast) => {
88
+ addToRemoveQueue(toast.id);
89
+ });
90
+ }
91
+ return {
92
+ ...state,
93
+ toasts: state.toasts.map((t) => t.id === toastId || toastId === undefined
94
+ ? {
95
+ ...t,
96
+ open: false
97
+ }
98
+ : t)
99
+ };
100
+ }
101
+ case 'REMOVE_TOAST':
102
+ if (action.toastId === undefined) {
103
+ return {
104
+ ...state,
105
+ toasts: []
106
+ };
107
+ }
108
+ return {
109
+ ...state,
110
+ toasts: state.toasts.filter((t) => t.id !== action.toastId)
111
+ };
112
+ }
113
+ };
114
+ exports.reducer = reducer;
115
+ const listeners = [];
116
+ let memoryState = { toasts: [] };
117
+ function dispatch(action) {
118
+ memoryState = (0, exports.reducer)(memoryState, action);
119
+ listeners.forEach((listener) => {
120
+ listener(memoryState);
121
+ });
122
+ }
123
+ function toast({ ...props }) {
124
+ const id = genId();
125
+ const update = (props) => dispatch({
126
+ type: 'UPDATE_TOAST',
127
+ toast: { ...props, id }
128
+ });
129
+ const dismiss = () => dispatch({ type: 'DISMISS_TOAST', toastId: id });
130
+ dispatch({
131
+ type: 'ADD_TOAST',
132
+ toast: {
133
+ ...props,
134
+ id,
135
+ open: true,
136
+ onOpenChange: (open) => {
137
+ if (!open)
138
+ dismiss();
139
+ }
140
+ }
141
+ });
142
+ return {
143
+ id: id,
144
+ dismiss,
145
+ update
146
+ };
147
+ }
148
+ function useToast() {
149
+ const [state, setState] = React.useState(memoryState);
150
+ React.useEffect(() => {
151
+ listeners.push(setState);
152
+ return () => {
153
+ const index = listeners.indexOf(setState);
154
+ if (index > -1) {
155
+ listeners.splice(index, 1);
156
+ }
157
+ };
158
+ }, [state]);
159
+ return {
160
+ ...state,
161
+ toast,
162
+ dismiss: (toastId) => dispatch({ type: 'DISMISS_TOAST', toastId })
163
+ };
164
+ }
@@ -0,0 +1,45 @@
1
+ export * from './components/ui/alert';
2
+ export * from './components/ui/autocomplete';
3
+ export * from './components/ui/autosize-textarea';
4
+ export * from './components/ui/avatar';
5
+ export * from './components/ui/badge';
6
+ export * from './components/ui/breadcrumb';
7
+ export * from './components/ui/button';
8
+ export * from './components/ui/card';
9
+ export * from './components/ui/checkbox';
10
+ export * from './components/ui/collapsible';
11
+ export * from './components/ui/command';
12
+ export * from './components/ui/dialog';
13
+ export * from './components/ui/dropdown-menu';
14
+ export * from './components/ui/input';
15
+ export * from './components/ui/input-with-icon';
16
+ export * from './components/ui/label';
17
+ export * from './components/ui/loading-button';
18
+ export * from './components/ui/multiple-select';
19
+ export * from './components/ui/paper';
20
+ export * from './components/ui/popover';
21
+ export * from './components/ui/progress';
22
+ export * from './components/ui/select';
23
+ export * from './components/ui/separator';
24
+ export * from './components/ui/sheet';
25
+ export * from './components/ui/skeleton';
26
+ export * from './components/ui/stepper';
27
+ export * from './hooks/use-stepper';
28
+ export * from './components/ui/switch';
29
+ export * from './components/ui/table';
30
+ export * from './components/ui/tabs';
31
+ export * from './components/ui/textarea';
32
+ export * from './components/ui/toast';
33
+ export * from './hooks/use-toast';
34
+ export * from './components/ui/tooltip';
35
+ export * from './components/ui/form';
36
+ export { Breadcrumb as ApplicationBreadcrumb } from './components/breadcrumb';
37
+ export * from './components/breadcrumb/get-breadcrumb-paths';
38
+ export * from './components/entity-box';
39
+ export * from './components/entity-data-table';
40
+ export * from './components/form';
41
+ export * from './components/page';
42
+ export * from './components/page-header';
43
+ export * from './components/pagination';
44
+ export * from './components/table';
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,uBAAuB,CAAA;AACrC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AAGpC,OAAO,EAAE,UAAU,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC7E,cAAc,8CAA8C,CAAA;AAC5D,cAAc,yBAAyB,CAAA;AACvC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ApplicationBreadcrumb = void 0;
18
+ // Primitives
19
+ __exportStar(require("./components/ui/alert"), exports);
20
+ __exportStar(require("./components/ui/autocomplete"), exports);
21
+ __exportStar(require("./components/ui/autosize-textarea"), exports);
22
+ __exportStar(require("./components/ui/avatar"), exports);
23
+ __exportStar(require("./components/ui/badge"), exports);
24
+ __exportStar(require("./components/ui/breadcrumb"), exports);
25
+ __exportStar(require("./components/ui/button"), exports);
26
+ __exportStar(require("./components/ui/card"), exports);
27
+ __exportStar(require("./components/ui/checkbox"), exports);
28
+ __exportStar(require("./components/ui/collapsible"), exports);
29
+ __exportStar(require("./components/ui/command"), exports);
30
+ __exportStar(require("./components/ui/dialog"), exports);
31
+ __exportStar(require("./components/ui/dropdown-menu"), exports);
32
+ __exportStar(require("./components/ui/input"), exports);
33
+ __exportStar(require("./components/ui/input-with-icon"), exports);
34
+ __exportStar(require("./components/ui/label"), exports);
35
+ __exportStar(require("./components/ui/loading-button"), exports);
36
+ __exportStar(require("./components/ui/multiple-select"), exports);
37
+ __exportStar(require("./components/ui/paper"), exports);
38
+ __exportStar(require("./components/ui/popover"), exports);
39
+ __exportStar(require("./components/ui/progress"), exports);
40
+ __exportStar(require("./components/ui/select"), exports);
41
+ __exportStar(require("./components/ui/separator"), exports);
42
+ __exportStar(require("./components/ui/sheet"), exports);
43
+ __exportStar(require("./components/ui/skeleton"), exports);
44
+ __exportStar(require("./components/ui/stepper"), exports);
45
+ __exportStar(require("./hooks/use-stepper"), exports);
46
+ __exportStar(require("./components/ui/switch"), exports);
47
+ __exportStar(require("./components/ui/table"), exports);
48
+ __exportStar(require("./components/ui/tabs"), exports);
49
+ __exportStar(require("./components/ui/textarea"), exports);
50
+ __exportStar(require("./components/ui/toast"), exports);
51
+ __exportStar(require("./hooks/use-toast"), exports);
52
+ __exportStar(require("./components/ui/tooltip"), exports);
53
+ __exportStar(require("./components/ui/form"), exports);
54
+ // Components
55
+ var breadcrumb_1 = require("./components/breadcrumb");
56
+ Object.defineProperty(exports, "ApplicationBreadcrumb", { enumerable: true, get: function () { return breadcrumb_1.Breadcrumb; } });
57
+ __exportStar(require("./components/breadcrumb/get-breadcrumb-paths"), exports);
58
+ __exportStar(require("./components/entity-box"), exports);
59
+ __exportStar(require("./components/entity-data-table"), exports);
60
+ __exportStar(require("./components/form"), exports);
61
+ __exportStar(require("./components/page"), exports);
62
+ __exportStar(require("./components/page-header"), exports);
63
+ __exportStar(require("./components/pagination"), exports);
64
+ __exportStar(require("./components/table"), exports);
@@ -0,0 +1,3 @@
1
+ import { type ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAA;AAG5C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cn = cn;
4
+ const clsx_1 = require("clsx");
5
+ const tailwind_merge_1 = require("tailwind-merge");
6
+ function cn(...inputs) {
7
+ return (0, tailwind_merge_1.twMerge)((0, clsx_1.clsx)(inputs));
8
+ }