@tsed/react-formio 3.0.0-alpha.10 → 3.0.0-alpha.11

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 (115) hide show
  1. package/dist/hooks/keyboard.constants.d.ts +38 -0
  2. package/dist/hooks/keyboard.constants.js +7 -0
  3. package/dist/hooks/keyboard.constants.js.map +1 -0
  4. package/dist/hooks/useKeyboardControls.d.ts +12 -0
  5. package/dist/hooks/useKeyboardControls.js +35 -0
  6. package/dist/hooks/useKeyboardControls.js.map +1 -0
  7. package/dist/interfaces/Operation.d.ts +12 -2
  8. package/dist/molecules/button/Button.d.ts +18 -5
  9. package/dist/molecules/button/Button.js +29 -30
  10. package/dist/molecules/button/Button.js.map +1 -1
  11. package/dist/molecules/card/Card.js +7 -5
  12. package/dist/molecules/card/Card.js.map +1 -1
  13. package/dist/molecules/forms/input-tags/InputTags.js +14 -14
  14. package/dist/molecules/forms/input-tags/InputTags.js.map +1 -1
  15. package/dist/molecules/table/Table.d.ts +11 -3
  16. package/dist/molecules/table/Table.js +8 -3
  17. package/dist/molecules/table/Table.js.map +1 -1
  18. package/dist/molecules/table/components/DefaultCellOperations.d.ts +12 -4
  19. package/dist/molecules/table/components/DefaultCellOperations.js +12 -6
  20. package/dist/molecules/table/components/DefaultCellOperations.js.map +1 -1
  21. package/dist/molecules/table/components/DefaultOperationButton.d.ts +12 -4
  22. package/dist/molecules/table/components/DefaultOperationButton.js.map +1 -1
  23. package/dist/molecules/table/hooks/useTable.d.ts +12 -4
  24. package/dist/molecules/table/hooks/useTable.js.map +1 -1
  25. package/dist/molecules/tabs/Tab.d.ts +13 -0
  26. package/dist/molecules/tabs/Tab.js +67 -0
  27. package/dist/molecules/tabs/Tab.js.map +1 -0
  28. package/dist/molecules/tabs/TabList.d.ts +2 -0
  29. package/dist/molecules/tabs/TabList.js +24 -0
  30. package/dist/molecules/tabs/TabList.js.map +1 -0
  31. package/dist/molecules/tabs/TabPanel.d.ts +9 -0
  32. package/dist/molecules/tabs/TabPanel.js +27 -0
  33. package/dist/molecules/tabs/TabPanel.js.map +1 -0
  34. package/dist/molecules/tabs/Tabs.d.ts +4 -16
  35. package/dist/molecules/tabs/Tabs.js +7 -67
  36. package/dist/molecules/tabs/Tabs.js.map +1 -1
  37. package/dist/molecules/tabs/TabsBody.d.ts +1 -0
  38. package/dist/molecules/tabs/TabsBody.js +10 -0
  39. package/dist/molecules/tabs/TabsBody.js.map +1 -0
  40. package/dist/molecules/tabs/TabsLegacy.d.ts +17 -0
  41. package/dist/molecules/tabs/TabsLegacy.js +49 -0
  42. package/dist/molecules/tabs/TabsLegacy.js.map +1 -0
  43. package/dist/molecules/tabs/all.d.ts +5 -0
  44. package/dist/molecules/tabs/all.js +13 -0
  45. package/dist/molecules/tabs/all.js.map +1 -0
  46. package/dist/molecules/tabs/context/TabControl.d.ts +52 -0
  47. package/dist/molecules/tabs/context/TabControl.js +85 -0
  48. package/dist/molecules/tabs/context/TabControl.js.map +1 -0
  49. package/dist/molecules/tabs/hooks/tabControl.d.ts +44 -0
  50. package/dist/molecules/tabs/hooks/tabControl.js +34 -0
  51. package/dist/molecules/tabs/hooks/tabControl.js.map +1 -0
  52. package/dist/organisms/form/actions/FormAction.js.map +1 -0
  53. package/dist/organisms/form/builder/FormEdit.d.ts +3 -1
  54. package/dist/organisms/form/builder/FormEdit.js +38 -35
  55. package/dist/organisms/form/builder/FormEdit.js.map +1 -1
  56. package/dist/organisms/form/builder/useFormEdit.js +17 -17
  57. package/dist/organisms/form/builder/useFormEdit.js.map +1 -1
  58. package/dist/organisms/form/exports/FormExport.d.ts +5 -0
  59. package/dist/organisms/form/exports/FormExport.js +55 -0
  60. package/dist/organisms/form/exports/FormExport.js.map +1 -0
  61. package/dist/organisms/form/preview/FormPreview.d.ts +6 -0
  62. package/dist/organisms/form/preview/FormPreview.js +11 -0
  63. package/dist/organisms/form/preview/FormPreview.js.map +1 -0
  64. package/dist/organisms/table/submissions/SubmissionsTable.d.ts +11 -3
  65. package/dist/organisms/table/submissions/SubmissionsTable.js +4 -1
  66. package/dist/organisms/table/submissions/SubmissionsTable.js.map +1 -1
  67. package/dist/organisms/views/FormViews.d.ts +24 -0
  68. package/dist/organisms/views/FormViews.js +96 -0
  69. package/dist/organisms/views/FormViews.js.map +1 -0
  70. package/package.json +3 -3
  71. package/src/hooks/keyboard.constants.ts +40 -0
  72. package/src/hooks/useKeyboardControls.spec.tsx +208 -0
  73. package/src/hooks/useKeyboardControls.ts +84 -0
  74. package/src/interfaces/Operation.ts +9 -3
  75. package/src/molecules/button/Button.tsx +43 -24
  76. package/src/molecules/card/Card.tsx +4 -0
  77. package/src/molecules/forms/input-tags/InputTags.tsx +1 -1
  78. package/src/molecules/pagination/Pagination.stories.tsx +0 -7
  79. package/src/molecules/table/Table.stories.tsx +34 -1
  80. package/src/molecules/table/Table.tsx +12 -6
  81. package/src/molecules/table/components/DefaultCellOperations.tsx +13 -7
  82. package/src/molecules/table/components/DefaultOperationButton.tsx +5 -4
  83. package/src/molecules/table/hooks/useTable.tsx +5 -5
  84. package/src/molecules/tabs/Tab.tsx +106 -0
  85. package/src/molecules/tabs/TabList.tsx +37 -0
  86. package/src/molecules/tabs/TabPanel.tsx +37 -0
  87. package/src/molecules/tabs/Tabs.spec.tsx +126 -73
  88. package/src/molecules/tabs/Tabs.stories.tsx +298 -65
  89. package/src/molecules/tabs/Tabs.tsx +10 -81
  90. package/src/molecules/tabs/TabsBody.tsx +11 -0
  91. package/src/molecules/tabs/TabsLegacy.stories.tsx +103 -0
  92. package/src/molecules/tabs/TabsLegacy.tsx +84 -0
  93. package/src/molecules/tabs/all.ts +5 -0
  94. package/src/molecules/tabs/context/TabControl.tsx +166 -0
  95. package/src/molecules/tabs/hooks/tabControl.spec.tsx +388 -0
  96. package/src/molecules/tabs/hooks/tabControl.ts +52 -0
  97. package/src/organisms/__fixtures__/form-firstname.fixture.json +1 -0
  98. package/src/organisms/__fixtures__/form.fixture.json +1 -0
  99. package/src/organisms/form/actions/FormAction.stories.tsx +422 -0
  100. package/src/organisms/form/builder/FormEdit.tsx +7 -1
  101. package/src/organisms/form/builder/useFormEdit.ts +1 -1
  102. package/src/organisms/form/exports/FormExport.stories.tsx +71 -0
  103. package/src/organisms/form/exports/FormExport.tsx +58 -0
  104. package/src/organisms/form/preview/FormPreview.stories.tsx +61 -0
  105. package/src/organisms/form/preview/FormPreview.tsx +21 -0
  106. package/src/organisms/table/actions/ActionsTable.stories.tsx +36 -34
  107. package/src/organisms/table/submissions/SubmissionsTable.stories.tsx +103 -57
  108. package/src/organisms/table/submissions/SubmissionsTable.tsx +10 -4
  109. package/src/organisms/views/FormViews.stories.tsx +224 -0
  110. package/src/organisms/views/FormViews.tsx +146 -0
  111. package/dist/organisms/form/action/FormAction.js.map +0 -1
  112. package/src/organisms/form/action/FormAction.stories.tsx +0 -364
  113. /package/dist/organisms/form/{action → actions}/FormAction.d.ts +0 -0
  114. /package/dist/organisms/form/{action → actions}/FormAction.js +0 -0
  115. /package/src/organisms/form/{action → actions}/FormAction.tsx +0 -0
@@ -0,0 +1,38 @@
1
+ export declare const enum CODE {
2
+ ENTER = "Enter",
3
+ ESCAPE = "Escape",
4
+ ARROW_LEFT = "ArrowLeft",
5
+ ARROW_UP = "ArrowUp",
6
+ ARROW_RIGHT = "ArrowRight",
7
+ ARROW_DOWN = "ArrowDown",
8
+ SPACE = "Space",
9
+ END = "End",
10
+ HOME = "Home"
11
+ }
12
+ export declare const enum KEY {
13
+ ENTER = "Enter",
14
+ ESCAPE = "Escape",
15
+ ARROW_LEFT = "ArrowLeft",
16
+ ARROW_UP = "ArrowUp",
17
+ ARROW_RIGHT = "ArrowRight",
18
+ ARROW_DOWN = "ArrowDown",
19
+ END = "End",
20
+ HOME = "Home",
21
+ SPACE = " ",
22
+ /**
23
+ * @deprecated
24
+ * Used by old browers, see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#whitespace_keys
25
+ */
26
+ SPACEBAR = "Spacebar"
27
+ }
28
+ export declare const enum KEY_CODE {
29
+ ENTER = 13,
30
+ ESCAPE = 27,
31
+ ARROW_LEFT = 37,
32
+ ARROW_UP = 38,
33
+ ARROW_RIGHT = 39,
34
+ ARROW_DOWN = 40,
35
+ SPACE = 32,
36
+ END = 35,
37
+ HOME = 36
38
+ }
@@ -0,0 +1,7 @@
1
+ var A = /* @__PURE__ */ ((R) => (R.ENTER = "Enter", R.ESCAPE = "Escape", R.ARROW_LEFT = "ArrowLeft", R.ARROW_UP = "ArrowUp", R.ARROW_RIGHT = "ArrowRight", R.ARROW_DOWN = "ArrowDown", R.SPACE = "Space", R.END = "End", R.HOME = "Home", R))(A || {}), r = /* @__PURE__ */ ((R) => (R.ENTER = "Enter", R.ESCAPE = "Escape", R.ARROW_LEFT = "ArrowLeft", R.ARROW_UP = "ArrowUp", R.ARROW_RIGHT = "ArrowRight", R.ARROW_DOWN = "ArrowDown", R.END = "End", R.HOME = "Home", R.SPACE = " ", R.SPACEBAR = "Spacebar", R))(r || {}), W = /* @__PURE__ */ ((R) => (R[R.ENTER = 13] = "ENTER", R[R.ESCAPE = 27] = "ESCAPE", R[R.ARROW_LEFT = 37] = "ARROW_LEFT", R[R.ARROW_UP = 38] = "ARROW_UP", R[R.ARROW_RIGHT = 39] = "ARROW_RIGHT", R[R.ARROW_DOWN = 40] = "ARROW_DOWN", R[R.SPACE = 32] = "SPACE", R[R.END = 35] = "END", R[R.HOME = 36] = "HOME", R))(W || {});
2
+ export {
3
+ A as CODE,
4
+ r as KEY,
5
+ W as KEY_CODE
6
+ };
7
+ //# sourceMappingURL=keyboard.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard.constants.js","sources":["../../src/hooks/keyboard.constants.ts"],"sourcesContent":["export const enum CODE {\n ENTER = \"Enter\",\n ESCAPE = \"Escape\",\n ARROW_LEFT = \"ArrowLeft\",\n ARROW_UP = \"ArrowUp\",\n ARROW_RIGHT = \"ArrowRight\",\n ARROW_DOWN = \"ArrowDown\",\n SPACE = \"Space\",\n END = \"End\",\n HOME = \"Home\"\n}\n\nexport const enum KEY {\n ENTER = \"Enter\",\n ESCAPE = \"Escape\",\n ARROW_LEFT = \"ArrowLeft\",\n ARROW_UP = \"ArrowUp\",\n ARROW_RIGHT = \"ArrowRight\",\n ARROW_DOWN = \"ArrowDown\",\n END = \"End\",\n HOME = \"Home\",\n SPACE = \" \",\n /**\n * @deprecated\n * Used by old browers, see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#whitespace_keys\n */\n SPACEBAR = \"Spacebar\"\n}\n\nexport const enum KEY_CODE {\n ENTER = 13,\n ESCAPE = 27,\n ARROW_LEFT = 37,\n ARROW_UP = 38,\n ARROW_RIGHT = 39,\n ARROW_DOWN = 40,\n SPACE = 32,\n END = 35,\n HOME = 36\n}\n"],"names":["CODE","KEY","KEY_CODE"],"mappings":"AAAkB,IAAAA,sBAAAA,OAChBA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,aAAa,aACbA,EAAA,WAAW,WACXA,EAAA,cAAc,cACdA,EAAA,aAAa,aACbA,EAAA,QAAQ,SACRA,EAAA,MAAM,OACNA,EAAA,OAAO,QATSA,IAAAA,KAAA,CAAA,CAAA,GAYAC,sBAAAA,OAChBA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,aAAa,aACbA,EAAA,WAAW,WACXA,EAAA,cAAc,cACdA,EAAA,aAAa,aACbA,EAAA,MAAM,OACNA,EAAA,OAAO,QACPA,EAAA,QAAQ,KAKRA,EAAA,WAAW,YAdKA,IAAAA,KAAA,CAAA,CAAA,GAiBAC,sBAAAA,OAChBA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SACAA,EAAAA,EAAA,SAAS,EAAT,IAAA,UACAA,EAAAA,EAAA,aAAa,EAAb,IAAA,cACAA,EAAAA,EAAA,WAAW,EAAX,IAAA,YACAA,EAAAA,EAAA,cAAc,EAAd,IAAA,eACAA,EAAAA,EAAA,aAAa,EAAb,IAAA,cACAA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SACAA,EAAAA,EAAA,MAAM,EAAN,IAAA,OACAA,EAAAA,EAAA,OAAO,EAAP,IAAA,QATgBA,IAAAA,KAAA,CAAA,CAAA;"}
@@ -0,0 +1,12 @@
1
+ import { KeyboardEvent } from 'react';
2
+ interface Options {
3
+ up?: VoidFunction;
4
+ down?: VoidFunction;
5
+ left?: VoidFunction;
6
+ right?: VoidFunction;
7
+ start?: VoidFunction;
8
+ end?: VoidFunction;
9
+ activate?: VoidFunction;
10
+ }
11
+ export declare const useKeyboardControls: ({ up, down, left, right, start, end, activate }: Options) => (event: KeyboardEvent<HTMLDivElement | HTMLButtonElement>) => void;
12
+ export {};
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { useCallback as d } from "react";
3
+ import { CODE as u, KEY as c } from "./keyboard.constants.js";
4
+ const t = (o) => o.key === c.ENTER || o.key === c.SPACE || o.key === c.SPACEBAR || o.code === u.ENTER || o.code === u.SPACE, e = () => {
5
+ }, p = ({
6
+ up: o = e,
7
+ down: f = e,
8
+ left: E = e,
9
+ right: R = e,
10
+ start: i = e,
11
+ end: l = e,
12
+ activate: D = e
13
+ }) => d(
14
+ (r) => {
15
+ if (t(r))
16
+ return D();
17
+ if (r.code === u.HOME)
18
+ return r.preventDefault(), i();
19
+ if (r.code === u.END)
20
+ return r.preventDefault(), l();
21
+ if (r.code === u.ARROW_UP)
22
+ return r.preventDefault(), o();
23
+ if (r.code === u.ARROW_DOWN)
24
+ return r.preventDefault(), f();
25
+ if (r.code === u.ARROW_RIGHT)
26
+ return r.preventDefault(), R();
27
+ if (r.code === u.ARROW_LEFT)
28
+ return r.preventDefault(), E();
29
+ },
30
+ [D, f, l, E, R, i, o]
31
+ );
32
+ export {
33
+ p as useKeyboardControls
34
+ };
35
+ //# sourceMappingURL=useKeyboardControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKeyboardControls.js","sources":["../../src/hooks/useKeyboardControls.ts"],"sourcesContent":["\"use client\";\n\nimport { type KeyboardEvent, useCallback } from \"react\";\n\nimport { CODE, KEY } from \"./keyboard.constants\";\n\ninterface Options {\n up?: VoidFunction;\n down?: VoidFunction;\n left?: VoidFunction;\n right?: VoidFunction;\n start?: VoidFunction;\n end?: VoidFunction;\n activate?: VoidFunction;\n}\n\nconst isActivateKey = (event: KeyboardEvent<HTMLDivElement | HTMLButtonElement>) => {\n return (\n event.key === KEY.ENTER ||\n event.key === KEY.SPACE ||\n event.key === KEY.SPACEBAR ||\n event.code === CODE.ENTER ||\n event.code === CODE.SPACE\n );\n};\n\nconst voidFn = () => {};\n\nexport const useKeyboardControls = ({\n up = voidFn,\n down = voidFn,\n left = voidFn,\n right = voidFn,\n start = voidFn,\n end = voidFn,\n activate = voidFn\n}: Options) => {\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement | HTMLButtonElement>) => {\n if (isActivateKey(event)) {\n return activate();\n }\n\n if (event.code === CODE.HOME) {\n event.preventDefault();\n\n return start();\n }\n\n if (event.code === CODE.END) {\n event.preventDefault();\n\n return end();\n }\n\n if (event.code === CODE.ARROW_UP) {\n event.preventDefault();\n\n return up();\n }\n\n if (event.code === CODE.ARROW_DOWN) {\n event.preventDefault();\n\n return down();\n }\n\n if (event.code === CODE.ARROW_RIGHT) {\n event.preventDefault();\n\n return right();\n }\n\n if (event.code === CODE.ARROW_LEFT) {\n event.preventDefault();\n\n return left();\n }\n },\n [activate, down, end, left, right, start, up]\n );\n\n return handleKeyDown;\n};\n"],"names":["isActivateKey","event","KEY","CODE","voidFn","useKeyboardControls","up","down","left","right","start","end","activate","useCallback"],"mappings":";;;AAgBA,MAAMA,IAAgB,CAACC,MAEnBA,EAAM,QAAQC,EAAI,SAClBD,EAAM,QAAQC,EAAI,SAClBD,EAAM,QAAQC,EAAI,YAClBD,EAAM,SAASE,EAAK,SACpBF,EAAM,SAASE,EAAK,OAIlBC,IAAS,MAAM;AAAC,GAETC,IAAsB,CAAC;AAAA,EAClC,IAAAC,IAAKF;AAAA,EACL,MAAAG,IAAOH;AAAA,EACP,MAAAI,IAAOJ;AAAA,EACP,OAAAK,IAAQL;AAAA,EACR,OAAAM,IAAQN;AAAA,EACR,KAAAO,IAAMP;AAAA,EACN,UAAAQ,IAAWR;AACb,MACwBS;AAAA,EACpB,CAACZ,MAA6D;AACxD,QAAAD,EAAcC,CAAK;AACrB,aAAOW,EAAS;AAGd,QAAAX,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAe,GAEdS,EAAM;AAGX,QAAAT,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAe,GAEdU,EAAI;AAGT,QAAAV,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAe,GAEdK,EAAG;AAGR,QAAAL,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAe,GAEdM,EAAK;AAGV,QAAAN,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAe,GAEdQ,EAAM;AAGX,QAAAR,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAe,GAEdO,EAAK;AAAA,EAEhB;AAAA,EACA,CAACI,GAAUL,GAAMI,GAAKH,GAAMC,GAAOC,GAAOJ,CAAE;AAC9C;"}
@@ -1,7 +1,17 @@
1
1
  import { default as React } from 'react';
2
2
  import { OperationButtonProps } from '../molecules/table/components/DefaultOperationButton.js';
3
- export type PermissionsResolver<Data = any> = (data: Data, ctx: any) => void;
4
- export interface Operation<Data = any> {
3
+ import { JSON } from './SubmissionType.js';
4
+ export type CellMetadata = Record<string, unknown>;
5
+ export type PermissionsResolver<Data extends {
6
+ [key: string]: JSON;
7
+ } = {
8
+ [key: string]: JSON;
9
+ }> = (data: Data, metadata: CellMetadata, operation: Operation<Data>) => void;
10
+ export interface Operation<Data extends {
11
+ [key: string]: JSON;
12
+ } = {
13
+ [key: string]: JSON;
14
+ }> {
5
15
  /**
6
16
  * Action identifier
7
17
  */
@@ -1,8 +1,21 @@
1
- import { ButtonHTMLAttributes } from 'react';
1
+ import { ButtonHTMLAttributes, PropsWithChildren } from 'react';
2
2
  export declare const BUTTON_VARIANTS: string[];
3
- export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
3
+ interface BaseButtonProps<T extends HTMLElement> extends ButtonHTMLAttributes<T> {
4
+ tag?: "button" | "a" | "input" | "div";
4
5
  variant?: (typeof BUTTON_VARIANTS)[keyof typeof BUTTON_VARIANTS] | string;
5
6
  }
6
- export declare const Button: import('react').ForwardRefExoticComponent<ButtonProps & {
7
- children?: import('react').ReactNode | undefined;
8
- } & import('react').RefAttributes<HTMLButtonElement>>;
7
+ interface HTMLAnchorProps extends BaseButtonProps<HTMLAnchorElement> {
8
+ tag: "a";
9
+ }
10
+ interface HTMLButtonProps extends BaseButtonProps<HTMLButtonElement> {
11
+ tag?: "button";
12
+ }
13
+ interface HTMLInputProps extends BaseButtonProps<HTMLInputElement> {
14
+ tag: "input";
15
+ }
16
+ interface HTMLDivProps extends BaseButtonProps<HTMLDivElement> {
17
+ tag: "div";
18
+ }
19
+ export type ButtonProps = HTMLAnchorProps | HTMLButtonProps | HTMLInputProps | HTMLDivProps;
20
+ export declare const Button: import('react').ForwardRefExoticComponent<PropsWithChildren<ButtonProps> & import('react').RefAttributes<unknown>>;
21
+ export {};
@@ -1,8 +1,8 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { c as d } from "../../chunks/index.js";
3
- import { forwardRef as u } from "react";
4
- import { registerComponent as c } from "../../registries/components.js";
5
- const k = [
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { c } from "../../chunks/index.js";
3
+ import { forwardRef as m } from "react";
4
+ import { registerComponent as s } from "../../registries/components.js";
5
+ const y = [
6
6
  "primary",
7
7
  "secondary",
8
8
  "success",
@@ -21,32 +21,31 @@ const k = [
21
21
  "outline-light",
22
22
  "outline-dark",
23
23
  "outline-link"
24
- ], m = u(
25
- ({ variant: t, className: e, children: o, ...n }, l) => /* @__PURE__ */ r(
26
- "button",
27
- {
28
- ...n,
29
- ref: l,
30
- className: d(
31
- "btn flex gap-1",
32
- {
33
- disabled: n.disabled
34
- },
35
- `btn-${t}`,
36
- e
37
- ),
38
- disabled: n.disabled,
39
- onClick: (a) => {
40
- var i;
41
- return !n.disabled && ((i = n.onClick) == null ? void 0 : i.call(n, a));
24
+ ], t = m(({ tag: e = "button", variant: o, className: a, children: l, ...n }, r) => /* @__PURE__ */ u(
25
+ e,
26
+ {
27
+ ...n,
28
+ ref: r,
29
+ className: c(
30
+ "btn flex gap-1",
31
+ {
32
+ disabled: n.disabled
42
33
  },
43
- children: o
44
- }
45
- )
46
- );
47
- c("Button", m);
34
+ `btn-${o}`,
35
+ a
36
+ ),
37
+ disabled: n.disabled,
38
+ onClick: (d) => {
39
+ var i;
40
+ return !n.disabled && ((i = n.onClick) == null ? void 0 : i.call(n, d));
41
+ },
42
+ children: l
43
+ }
44
+ ));
45
+ t.displayName = "Button";
46
+ s("Button", t);
48
47
  export {
49
- k as BUTTON_VARIANTS,
50
- m as Button
48
+ y as BUTTON_VARIANTS,
49
+ t as Button
51
50
  };
52
51
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../src/molecules/button/Button.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport { type ButtonHTMLAttributes, forwardRef, type LegacyRef, type PropsWithChildren } from \"react\";\n\nimport { registerComponent } from \"../../registries/components\";\n\nexport const BUTTON_VARIANTS = [\n \"primary\",\n \"secondary\",\n \"success\",\n \"danger\",\n \"warning\",\n \"info\",\n \"light\",\n \"dark\",\n \"link\",\n \"outline-primary\",\n \"outline-secondary\",\n \"outline-success\",\n \"outline-danger\",\n \"outline-warning\",\n \"outline-info\",\n \"outline-light\",\n \"outline-dark\",\n \"outline-link\"\n];\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: (typeof BUTTON_VARIANTS)[keyof typeof BUTTON_VARIANTS] | string;\n}\n\nexport const Button = forwardRef(\n ({ variant, className, children, ...props }: PropsWithChildren<ButtonProps>, ref: LegacyRef<HTMLButtonElement>) => {\n return (\n <button\n {...props}\n ref={ref}\n className={cx(\n \"btn flex gap-1\",\n {\n disabled: props.disabled\n },\n `btn-${variant}`,\n className\n )}\n disabled={props.disabled}\n onClick={(evt) => !props.disabled && props.onClick?.(evt)}\n >\n {children}\n </button>\n );\n }\n);\n\nregisterComponent(\"Button\", Button);\n"],"names":["BUTTON_VARIANTS","Button","forwardRef","variant","className","children","props","ref","jsx","cx","evt","_a","registerComponent"],"mappings":";;;;AAKO,MAAMA,IAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMaC,IAASC;AAAA,EACpB,CAAC,EAAE,SAAAC,GAAS,WAAAC,GAAW,UAAAC,GAAU,GAAGC,KAAyCC,MAEzE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGF;AAAA,MACJ,KAAAC;AAAA,MACA,WAAWE;AAAA,QACT;AAAA,QACA;AAAA,UACE,UAAUH,EAAM;AAAA,QAClB;AAAA,QACA,OAAOH,CAAO;AAAA,QACdC;AAAA,MACF;AAAA,MACA,UAAUE,EAAM;AAAA,MAChB,SAAS,CAACI;;AAAQ,gBAACJ,EAAM,cAAYK,IAAAL,EAAM,YAAN,gBAAAK,EAAA,KAAAL,GAAgBI;AAAA;AAAA,MAEpD,UAAAL;AAAA,IAAA;AAAA,EACH;AAGN;AAEAO,EAAkB,UAAUX,CAAM;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../src/molecules/button/Button.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport { type ButtonHTMLAttributes, forwardRef, type PropsWithChildren } from \"react\";\n\nimport { registerComponent } from \"../../registries/components\";\n\nexport const BUTTON_VARIANTS = [\n \"primary\",\n \"secondary\",\n \"success\",\n \"danger\",\n \"warning\",\n \"info\",\n \"light\",\n \"dark\",\n \"link\",\n \"outline-primary\",\n \"outline-secondary\",\n \"outline-success\",\n \"outline-danger\",\n \"outline-warning\",\n \"outline-info\",\n \"outline-light\",\n \"outline-dark\",\n \"outline-link\"\n];\n\ninterface BaseButtonProps<T extends HTMLElement> extends ButtonHTMLAttributes<T> {\n tag?: \"button\" | \"a\" | \"input\" | \"div\";\n variant?: (typeof BUTTON_VARIANTS)[keyof typeof BUTTON_VARIANTS] | string;\n}\n\ninterface HTMLAnchorProps extends BaseButtonProps<HTMLAnchorElement> {\n tag: \"a\";\n}\n\ninterface HTMLButtonProps extends BaseButtonProps<HTMLButtonElement> {\n tag?: \"button\";\n}\n\ninterface HTMLInputProps extends BaseButtonProps<HTMLInputElement> {\n tag: \"input\";\n}\n\ninterface HTMLDivProps extends BaseButtonProps<HTMLDivElement> {\n tag: \"div\";\n}\n\nexport type ButtonProps = HTMLAnchorProps | HTMLButtonProps | HTMLInputProps | HTMLDivProps;\n\nexport const Button = forwardRef(({ tag: Tag = \"button\", variant, className, children, ...props }: PropsWithChildren<ButtonProps>, ref) => {\n return (\n <Tag\n {...(props as any)}\n ref={ref as any}\n className={cx(\n \"btn flex gap-1\",\n {\n disabled: props.disabled\n },\n `btn-${variant}`,\n className\n )}\n disabled={props.disabled}\n onClick={(evt) => !props.disabled && props.onClick?.(evt as any)}\n >\n {children}\n </Tag>\n );\n});\n\nButton.displayName = \"Button\";\n\nregisterComponent(\"Button\", Button);\n"],"names":["BUTTON_VARIANTS","Button","forwardRef","Tag","variant","className","children","props","ref","jsx","cx","evt","_a","registerComponent"],"mappings":";;;;AAKO,MAAMA,IAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAyBaC,IAASC,EAAW,CAAC,EAAE,KAAKC,IAAM,UAAU,SAAAC,GAAS,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAA,GAAyCC,MAE/H,gBAAAC;AAAA,EAACN;AAAA,EAAA;AAAA,IACE,GAAII;AAAA,IACL,KAAAC;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACA;AAAA,QACE,UAAUH,EAAM;AAAA,MAClB;AAAA,MACA,OAAOH,CAAO;AAAA,MACdC;AAAA,IACF;AAAA,IACA,UAAUE,EAAM;AAAA,IAChB,SAAS,CAACI;;AAAQ,cAACJ,EAAM,cAAYK,IAAAL,EAAM,YAAN,gBAAAK,EAAA,KAAAL,GAAgBI;AAAA;AAAA,IAEpD,UAAAL;AAAA,EAAA;AACH,CAEH;AAEDL,EAAO,cAAc;AAErBY,EAAkB,UAAUZ,CAAM;"}
@@ -1,12 +1,14 @@
1
1
  import { jsxs as d, jsx as r } from "react/jsx-runtime";
2
- import { c as s } from "../../chunks/index.js";
3
- function m({ children: a, label: c, className: e }) {
4
- return /* @__PURE__ */ d("div", { className: s("card", e), children: [
5
- /* @__PURE__ */ r("div", { className: "card-header ", children: /* @__PURE__ */ r("h4", { className: "card-title", children: c }) }),
2
+ import { c as i } from "../../chunks/index.js";
3
+ import { registerComponent as s } from "../../registries/components.js";
4
+ function o({ children: a, label: e, className: c }) {
5
+ return /* @__PURE__ */ d("div", { className: i("card", c), children: [
6
+ /* @__PURE__ */ r("div", { className: "card-header ", children: /* @__PURE__ */ r("h4", { className: "card-title", children: e }) }),
6
7
  /* @__PURE__ */ r("div", { className: "card-body", role: "article", children: a })
7
8
  ] });
8
9
  }
10
+ s("Card", o);
9
11
  export {
10
- m as Card
12
+ o as Card
11
13
  };
12
14
  //# sourceMappingURL=Card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sources":["../../../src/molecules/card/Card.tsx"],"sourcesContent":["import classnames from \"classnames\";\nimport { PropsWithChildren } from \"react\";\n\nexport interface CardProps {\n label: string;\n className?: string;\n}\n\nexport function Card({ children, label, className }: PropsWithChildren<CardProps>) {\n return (\n <div className={classnames(\"card\", className)}>\n <div className={\"card-header \"}>\n <h4 className={\"card-title\"}>{label}</h4>\n </div>\n <div className={\"card-body\"} role={\"article\"}>\n {children}\n </div>\n </div>\n );\n}\n"],"names":["Card","children","label","className","classnames","jsx"],"mappings":";;AAQO,SAASA,EAAK,EAAE,UAAAC,GAAU,OAAAC,GAAO,WAAAC,KAA2C;AACjF,2BACG,OAAI,EAAA,WAAWC,EAAW,QAAQD,CAAS,GAC1C,UAAA;AAAA,IAAC,gBAAAE,EAAA,OAAA,EAAI,WAAW,gBACd,UAAA,gBAAAA,EAAC,QAAG,WAAW,cAAe,aAAM,EACtC,CAAA;AAAA,sBACC,OAAI,EAAA,WAAW,aAAa,MAAM,WAChC,UAAAJ,EACH,CAAA;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"Card.js","sources":["../../../src/molecules/card/Card.tsx"],"sourcesContent":["import classnames from \"classnames\";\nimport { PropsWithChildren } from \"react\";\n\nimport { registerComponent } from \"../../registries/components.js\";\n\nexport interface CardProps {\n label: string;\n className?: string;\n}\n\nexport function Card({ children, label, className }: PropsWithChildren<CardProps>) {\n return (\n <div className={classnames(\"card\", className)}>\n <div className={\"card-header \"}>\n <h4 className={\"card-title\"}>{label}</h4>\n </div>\n <div className={\"card-body\"} role={\"article\"}>\n {children}\n </div>\n </div>\n );\n}\n\nregisterComponent(\"Card\", Card);\n"],"names":["Card","children","label","className","classnames","jsx","registerComponent"],"mappings":";;;AAUO,SAASA,EAAK,EAAE,UAAAC,GAAU,OAAAC,GAAO,WAAAC,KAA2C;AACjF,2BACG,OAAI,EAAA,WAAWC,EAAW,QAAQD,CAAS,GAC1C,UAAA;AAAA,IAAC,gBAAAE,EAAA,OAAA,EAAI,WAAW,gBACd,UAAA,gBAAAA,EAAC,QAAG,WAAW,cAAe,aAAM,EACtC,CAAA;AAAA,sBACC,OAAI,EAAA,WAAW,aAAa,MAAM,WAChC,UAAAJ,EACH,CAAA;AAAA,EAAA,GACF;AAEJ;AAEAK,EAAkB,QAAQN,CAAI;"}
@@ -1,20 +1,20 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { registerComponent as d, getComponent as s } from "../../../registries/components.js";
3
- function I(e) {
4
- const { name: o, id: t = o, label: i, required: n, description: m, before: a, after: c, size: l, className: p, layout: u = "choicesjs", ...g } = e, f = s("FormControl"), C = s([`InputTags.${u}`, "Input"]);
5
- return console.log("VALUE", e.value), /* @__PURE__ */ r(
6
- f,
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { registerComponent as d, getComponent as r } from "../../../registries/components.js";
3
+ function I(s) {
4
+ const { name: o, id: t = o, label: p, required: e, description: i, before: m, after: a, size: c, className: u, layout: l = "choicesjs", ...f } = s, g = r("FormControl"), C = r([`InputTags.${l}`, "Input"]);
5
+ return /* @__PURE__ */ n(
6
+ g,
7
7
  {
8
8
  id: t,
9
9
  name: o,
10
- label: i,
11
- required: n,
12
- description: m,
13
- before: a,
14
- after: c,
15
- size: l,
16
- className: p,
17
- children: /* @__PURE__ */ r(C, { ...g, id: t, name: o, required: n })
10
+ label: p,
11
+ required: e,
12
+ description: i,
13
+ before: m,
14
+ after: a,
15
+ size: c,
16
+ className: u,
17
+ children: /* @__PURE__ */ n(C, { ...f, id: t, name: o, required: e })
18
18
  }
19
19
  );
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InputTags.js","sources":["../../../../src/molecules/forms/input-tags/InputTags.tsx"],"sourcesContent":["import { ComponentType } from \"react\";\n\nimport { getComponent, registerComponent } from \"../../../registries/components\";\nimport { type FormControl as DefaultFormControl } from \"../form-control/FormControl\";\nimport type { InputTagsProps } from \"./InputTags.interface\";\n\nexport function InputTags<Data = string>(props: InputTagsProps) {\n const { name, id = name, label, required, description, before, after, size, className, layout = \"choicesjs\", ...otherProps } = props;\n\n const FormControl = getComponent<typeof DefaultFormControl>(\"FormControl\");\n const Component = getComponent<ComponentType<InputTagsProps<Data>>>([`InputTags.${layout}`, \"Input\"]);\n console.log(\"VALUE\", props.value);\n return (\n <FormControl\n id={id}\n name={name}\n label={label}\n required={required}\n description={description}\n before={before}\n after={after}\n size={size}\n className={className}\n >\n <Component {...(otherProps as any)} id={id} name={name} required={required} />\n </FormControl>\n );\n}\n\nregisterComponent(\"InputTags\", InputTags);\n"],"names":["InputTags","props","name","id","label","required","description","before","after","size","className","layout","otherProps","FormControl","getComponent","Component","jsx","registerComponent"],"mappings":";;AAMO,SAASA,EAAyBC,GAAuB;AAC9D,QAAM,EAAE,MAAAC,GAAM,IAAAC,IAAKD,GAAM,OAAAE,GAAO,UAAAC,GAAU,aAAAC,GAAa,QAAAC,GAAQ,OAAAC,GAAO,MAAAC,GAAM,WAAAC,GAAW,QAAAC,IAAS,aAAa,GAAGC,MAAeX,GAEzHY,IAAcC,EAAwC,aAAa,GACnEC,IAAYD,EAAkD,CAAC,aAAaH,CAAM,IAAI,OAAO,CAAC;AAC5F,iBAAA,IAAI,SAASV,EAAM,KAAK,GAE9B,gBAAAe;AAAA,IAACH;AAAA,IAAA;AAAA,MACC,IAAAV;AAAA,MACA,MAAAD;AAAA,MACA,OAAAE;AAAA,MACA,UAAAC;AAAA,MACA,aAAAC;AAAA,MACA,QAAAC;AAAA,MACA,OAAAC;AAAA,MACA,MAAAC;AAAA,MACA,WAAAC;AAAA,MAEA,4BAACK,GAAW,EAAA,GAAIH,GAAoB,IAAAT,GAAQ,MAAAD,GAAY,UAAAG,EAAoB,CAAA;AAAA,IAAA;AAAA,EAC9E;AAEJ;AAEAY,EAAkB,aAAajB,CAAS;"}
1
+ {"version":3,"file":"InputTags.js","sources":["../../../../src/molecules/forms/input-tags/InputTags.tsx"],"sourcesContent":["import { ComponentType } from \"react\";\n\nimport { getComponent, registerComponent } from \"../../../registries/components\";\nimport { type FormControl as DefaultFormControl } from \"../form-control/FormControl\";\nimport type { InputTagsProps } from \"./InputTags.interface\";\n\nexport function InputTags<Data = string>(props: InputTagsProps) {\n const { name, id = name, label, required, description, before, after, size, className, layout = \"choicesjs\", ...otherProps } = props;\n\n const FormControl = getComponent<typeof DefaultFormControl>(\"FormControl\");\n const Component = getComponent<ComponentType<InputTagsProps<Data>>>([`InputTags.${layout}`, \"Input\"]);\n\n return (\n <FormControl\n id={id}\n name={name}\n label={label}\n required={required}\n description={description}\n before={before}\n after={after}\n size={size}\n className={className}\n >\n <Component {...(otherProps as any)} id={id} name={name} required={required} />\n </FormControl>\n );\n}\n\nregisterComponent(\"InputTags\", InputTags);\n"],"names":["InputTags","props","name","id","label","required","description","before","after","size","className","layout","otherProps","FormControl","getComponent","Component","jsx","registerComponent"],"mappings":";;AAMO,SAASA,EAAyBC,GAAuB;AAC9D,QAAM,EAAE,MAAAC,GAAM,IAAAC,IAAKD,GAAM,OAAAE,GAAO,UAAAC,GAAU,aAAAC,GAAa,QAAAC,GAAQ,OAAAC,GAAO,MAAAC,GAAM,WAAAC,GAAW,QAAAC,IAAS,aAAa,GAAGC,MAAeX,GAEzHY,IAAcC,EAAwC,aAAa,GACnEC,IAAYD,EAAkD,CAAC,aAAaH,CAAM,IAAI,OAAO,CAAC;AAGlG,SAAA,gBAAAK;AAAA,IAACH;AAAA,IAAA;AAAA,MACC,IAAAV;AAAA,MACA,MAAAD;AAAA,MACA,OAAAE;AAAA,MACA,UAAAC;AAAA,MACA,aAAAC;AAAA,MACA,QAAAC;AAAA,MACA,OAAAC;AAAA,MACA,MAAAC;AAAA,MACA,WAAAC;AAAA,MAEA,4BAACK,GAAW,EAAA,GAAIH,GAAoB,IAAAT,GAAQ,MAAAD,GAAY,UAAAG,EAAoB,CAAA;AAAA,IAAA;AAAA,EAC9E;AAEJ;AAEAY,EAAkB,aAAajB,CAAS;"}
@@ -1,9 +1,17 @@
1
- import { RowData } from '@tanstack/react-table';
2
1
  import { PropsWithChildren } from 'react';
2
+ import { JSON } from '../../interfaces/index.js';
3
3
  import { UseTableProps } from './hooks/useTable';
4
- export interface TableProps<Data extends RowData = any> extends UseTableProps<Data> {
4
+ export interface TableProps<Data extends {
5
+ [key: string]: JSON;
6
+ } = {
7
+ [key: string]: JSON;
8
+ }> extends UseTableProps<Data> {
5
9
  className?: string;
6
10
  enableFooter?: boolean;
7
11
  pageSizes?: number[];
8
12
  }
9
- export declare function Table<Data extends RowData = any>({ className, enableFooter, children, ...props }: PropsWithChildren<TableProps<Data>>): import("react/jsx-runtime").JSX.Element;
13
+ export declare function Table<Data extends {
14
+ [key: string]: JSON;
15
+ } = {
16
+ [key: string]: JSON;
17
+ }>({ className, enableFooter, children, ...props }: PropsWithChildren<TableProps<Data>>): import("react/jsx-runtime").JSX.Element;
@@ -4,7 +4,12 @@ import { flexRender as C } from "@tanstack/react-table";
4
4
  import { c as f } from "../../chunks/index.js";
5
5
  import { getComponent as s } from "../../registries/components.js";
6
6
  import { useTable as b } from "./hooks/useTable.js";
7
- function y({ className: g, enableFooter: m, children: u, ...i }) {
7
+ function y({
8
+ className: g,
9
+ enableFooter: m,
10
+ children: u,
11
+ ...i
12
+ }) {
8
13
  const { tableInstance: n, i18n: l } = b(i), p = s("CellHeader"), P = s("CellFooter"), h = s("Pagination"), { pagination: r } = n.getState();
9
14
  return /* @__PURE__ */ d("div", { className: f("table-group table-responsive", g), children: [
10
15
  /* @__PURE__ */ d("table", { className: "table table-striped table-hover", children: [
@@ -30,7 +35,7 @@ function y({ className: g, enableFooter: m, children: u, ...i }) {
30
35
  m && /* @__PURE__ */ a("tfoot", { children: n.getFooterGroups().map((t) => /* @__PURE__ */ a("tr", { children: t.headers.map((e) => /* @__PURE__ */ a("th", { children: e.isPlaceholder ? null : /* @__PURE__ */ a(P, { header: e, i18n: l }) }, e.id)) }, t.id)) })
31
36
  ] }),
32
37
  /* @__PURE__ */ d("div", { className: "overflow-hidden flex flex-wrap", children: [
33
- i.data.length && r && /* @__PURE__ */ a(
38
+ i.data.length && r ? /* @__PURE__ */ a(
34
39
  h,
35
40
  {
36
41
  className: "flex-1",
@@ -47,7 +52,7 @@ function y({ className: g, enableFooter: m, children: u, ...i }) {
47
52
  onClickNextPage: () => n.nextPage(),
48
53
  onPageSizeChange: (t) => n.setPageSize(t)
49
54
  }
50
- ),
55
+ ) : null,
51
56
  /* @__PURE__ */ a("div", { children: u })
52
57
  ] })
53
58
  ] });
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sources":["../../../src/molecules/table/Table.tsx"],"sourcesContent":["import { flexRender, RowData } from \"@tanstack/react-table\";\nimport cx from \"classnames\";\nimport { PropsWithChildren } from \"react\";\n\nimport { getComponent } from \"../../registries/components\";\nimport type { Pagination as DefaultPagination } from \"../pagination/Pagination\";\nimport type { DefaultCellFooter } from \"./components/DefaultCellFooter\";\nimport type { DefaultCellHeader } from \"./components/DefaultCellHeader\";\nimport { useTable, UseTableProps } from \"./hooks/useTable\";\n\nexport interface TableProps<Data extends RowData = any> extends UseTableProps<Data> {\n className?: string;\n\n enableFooter?: boolean;\n\n pageSizes?: number[];\n}\n\nexport function Table<Data extends RowData = any>({ className, enableFooter, children, ...props }: PropsWithChildren<TableProps<Data>>) {\n const { tableInstance, i18n } = useTable(props);\n const CellHeader = getComponent<typeof DefaultCellHeader>(\"CellHeader\");\n const CellFooter = getComponent<typeof DefaultCellFooter>(\"CellFooter\");\n const Pagination = getComponent<typeof DefaultPagination>(\"Pagination\");\n\n const { pagination } = tableInstance.getState();\n\n return (\n <div className={cx(\"table-group table-responsive\", className)}>\n <table className='table table-striped table-hover'>\n <thead>\n {tableInstance.getHeaderGroups().map((headerGroup) => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map((header) => {\n const sort = header.column.getIsSorted();\n return (\n <th\n data-testid={`head-cell-${header.id}`}\n key={header.id}\n aria-sort={sort ? (sort === \"asc\" ? \"ascending\" : \"descending\") : \"none\"}\n >\n {header.isPlaceholder ? null : <CellHeader header={header} i18n={i18n} />}\n </th>\n );\n })}\n </tr>\n ))}\n </thead>\n <tbody>\n {tableInstance.getRowModel().rows.map((row) => {\n return (\n <tr key={row.id} data-testid={`body-row-${row.id}`}>\n {row\n .getVisibleCells()\n .filter((cell) => !cell.column.columnDef.meta?.hidden)\n .map((cell) => {\n return (\n <td {...cell.column.columnDef?.meta?.cellProps} key={cell.id} data-testid={`body-cell-${cell.id}`}>\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </td>\n );\n })}\n </tr>\n );\n })}\n </tbody>\n {enableFooter && (\n <tfoot>\n {tableInstance.getFooterGroups().map((footerGroup) => (\n <tr key={footerGroup.id}>\n {footerGroup.headers.map((header) => (\n <th key={header.id}>{header.isPlaceholder ? null : <CellFooter header={header} i18n={i18n} />}</th>\n ))}\n </tr>\n ))}\n </tfoot>\n )}\n </table>\n <div className={\"overflow-hidden flex flex-wrap\"}>\n {props.data.length && pagination && (\n <Pagination\n className={\"flex-1\"}\n canNextPage={tableInstance.getCanNextPage()}\n canPreviousPage={tableInstance.getCanPreviousPage()}\n pageIndex={pagination.pageIndex}\n pageSize={pagination.pageSize}\n pageSizes={props.pageSizes}\n i18n={i18n}\n pageCount={tableInstance.getPageCount()}\n rowCount={props.rowCount}\n onPageIndexChange={(page) => tableInstance.setPageIndex(page)}\n onClickPreviousPage={() => tableInstance.previousPage()}\n onClickNextPage={() => tableInstance.nextPage()}\n onPageSizeChange={(pageSize) => tableInstance.setPageSize(pageSize)}\n />\n )}\n <div>{children}</div>\n </div>\n </div>\n );\n}\n"],"names":["Table","className","enableFooter","children","props","tableInstance","i18n","useTable","CellHeader","getComponent","CellFooter","Pagination","pagination","cx","jsxs","jsx","headerGroup","header","sort","row","cell","_a","createElement","_b","flexRender","footerGroup","page","pageSize"],"mappings":"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"}
1
+ {"version":3,"file":"Table.js","sources":["../../../src/molecules/table/Table.tsx"],"sourcesContent":["import { flexRender } from \"@tanstack/react-table\";\nimport cx from \"classnames\";\nimport { PropsWithChildren } from \"react\";\n\nimport type { JSON } from \"../../interfaces/index.js\";\nimport { getComponent } from \"../../registries/components\";\nimport type { Pagination as DefaultPagination } from \"../pagination/Pagination\";\nimport type { DefaultCellFooter } from \"./components/DefaultCellFooter\";\nimport type { DefaultCellHeader } from \"./components/DefaultCellHeader\";\nimport { useTable, UseTableProps } from \"./hooks/useTable\";\n\nexport interface TableProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> extends UseTableProps<Data> {\n className?: string;\n\n enableFooter?: boolean;\n\n pageSizes?: number[];\n}\n\nexport function Table<Data extends { [key: string]: JSON } = { [key: string]: JSON }>({\n className,\n enableFooter,\n children,\n ...props\n}: PropsWithChildren<TableProps<Data>>) {\n const { tableInstance, i18n } = useTable<Data>(props);\n const CellHeader = getComponent<typeof DefaultCellHeader>(\"CellHeader\");\n const CellFooter = getComponent<typeof DefaultCellFooter>(\"CellFooter\");\n const Pagination = getComponent<typeof DefaultPagination>(\"Pagination\");\n\n const { pagination } = tableInstance.getState();\n\n return (\n <div className={cx(\"table-group table-responsive\", className)}>\n <table className='table table-striped table-hover'>\n <thead>\n {tableInstance.getHeaderGroups().map((headerGroup) => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map((header) => {\n const sort = header.column.getIsSorted();\n return (\n <th\n data-testid={`head-cell-${header.id}`}\n key={header.id}\n aria-sort={sort ? (sort === \"asc\" ? \"ascending\" : \"descending\") : \"none\"}\n >\n {header.isPlaceholder ? null : <CellHeader header={header} i18n={i18n} />}\n </th>\n );\n })}\n </tr>\n ))}\n </thead>\n <tbody>\n {tableInstance.getRowModel().rows.map((row) => {\n return (\n <tr key={row.id} data-testid={`body-row-${row.id}`}>\n {row\n .getVisibleCells()\n .filter((cell) => !cell.column.columnDef.meta?.hidden)\n .map((cell) => {\n return (\n <td {...cell.column.columnDef?.meta?.cellProps} key={cell.id} data-testid={`body-cell-${cell.id}`}>\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </td>\n );\n })}\n </tr>\n );\n })}\n </tbody>\n {enableFooter && (\n <tfoot>\n {tableInstance.getFooterGroups().map((footerGroup) => (\n <tr key={footerGroup.id}>\n {footerGroup.headers.map((header) => (\n <th key={header.id}>{header.isPlaceholder ? null : <CellFooter header={header} i18n={i18n} />}</th>\n ))}\n </tr>\n ))}\n </tfoot>\n )}\n </table>\n <div className={\"overflow-hidden flex flex-wrap\"}>\n {props.data.length && pagination ? (\n <Pagination\n className={\"flex-1\"}\n canNextPage={tableInstance.getCanNextPage()}\n canPreviousPage={tableInstance.getCanPreviousPage()}\n pageIndex={pagination.pageIndex}\n pageSize={pagination.pageSize}\n pageSizes={props.pageSizes}\n i18n={i18n}\n pageCount={tableInstance.getPageCount()}\n rowCount={props.rowCount}\n onPageIndexChange={(page) => tableInstance.setPageIndex(page)}\n onClickPreviousPage={() => tableInstance.previousPage()}\n onClickNextPage={() => tableInstance.nextPage()}\n onPageSizeChange={(pageSize) => tableInstance.setPageSize(pageSize)}\n />\n ) : null}\n <div>{children}</div>\n </div>\n </div>\n );\n}\n"],"names":["Table","className","enableFooter","children","props","tableInstance","i18n","useTable","CellHeader","getComponent","CellFooter","Pagination","pagination","cx","jsxs","jsx","headerGroup","header","sort","row","cell","_a","createElement","_b","flexRender","footerGroup","page","pageSize"],"mappings":";;;;;;AAmBO,SAASA,EAAsE;AAAA,EACpF,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GAAwC;AACtC,QAAM,EAAE,eAAAC,GAAe,MAAAC,MAASC,EAAeH,CAAK,GAC9CI,IAAaC,EAAuC,YAAY,GAChEC,IAAaD,EAAuC,YAAY,GAChEE,IAAaF,EAAuC,YAAY,GAEhE,EAAE,YAAAG,EAAA,IAAeP,EAAc,SAAS;AAE9C,2BACG,OAAI,EAAA,WAAWQ,EAAG,gCAAgCZ,CAAS,GAC1D,UAAA;AAAA,IAAC,gBAAAa,EAAA,SAAA,EAAM,WAAU,mCACf,UAAA;AAAA,MAAA,gBAAAC,EAAC,SACE,EAAA,UAAAV,EAAc,gBAAgB,EAAE,IAAI,CAACW,MACpC,gBAAAD,EAAC,MACE,EAAA,UAAAC,EAAY,QAAQ,IAAI,CAACC,MAAW;AAC7B,cAAAC,IAAOD,EAAO,OAAO,YAAY;AAErC,eAAA,gBAAAF;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAa,aAAaE,EAAO,EAAE;AAAA,YAEnC,aAAWC,IAAQA,MAAS,QAAQ,cAAc,eAAgB;AAAA,YAEjE,YAAO,gBAAgB,OAAQ,gBAAAH,EAAAP,GAAA,EAAW,QAAAS,GAAgB,MAAAX,EAAY,CAAA;AAAA,UAAA;AAAA,UAHlEW,EAAO;AAAA,QAId;AAAA,MAEH,CAAA,KAZMD,EAAY,EAarB,CACD,EACH,CAAA;AAAA,MACA,gBAAAD,EAAC,WACE,UAAcV,EAAA,YAAA,EAAc,KAAK,IAAI,CAACc,MAEnC,gBAAAJ,EAAC,QAAgB,eAAa,YAAYI,EAAI,EAAE,IAC7C,UACEA,EAAA,kBACA,OAAO,CAACC;;AAAS,kBAACC,IAAAD,EAAK,OAAO,UAAU,SAAtB,QAAAC,EAA4B;AAAA,OAAM,EACpD,IAAI,CAACD,MAAS;;AAEX,eAAA,gBAAAE,EAAC,MAAI,EAAA,IAAGC,KAAAF,IAAAD,EAAK,OAAO,cAAZ,gBAAAC,EAAuB,SAAvB,gBAAAE,EAA6B,WAAW,KAAKH,EAAK,IAAI,eAAa,aAAaA,EAAK,EAAE,GAC5F,GAAAI,EAAWJ,EAAK,OAAO,UAAU,MAAMA,EAAK,WAAY,CAAA,CAC3D;AAAA,MAAA,CAEH,EAVI,GAAAD,EAAI,EAWb,CAEH,GACH;AAAA,MACCjB,KACC,gBAAAa,EAAC,SACE,EAAA,UAAAV,EAAc,gBAAkB,EAAA,IAAI,CAACoB,MACnC,gBAAAV,EAAA,MAAA,EACE,UAAYU,EAAA,QAAQ,IAAI,CAACR,MACvB,gBAAAF,EAAA,MAAA,EAAoB,UAAOE,EAAA,gBAAgB,OAAO,gBAAAF,EAACL,KAAW,QAAAO,GAAgB,MAAAX,EAAA,CAAY,EAAlF,GAAAW,EAAO,EAA8E,CAC/F,EAAA,GAHMQ,EAAY,EAIrB,CACD,EACH,CAAA;AAAA,IAAA,GAEJ;AAAA,IACA,gBAAAX,EAAC,OAAI,EAAA,WAAW,kCACb,UAAA;AAAA,MAAMV,EAAA,KAAK,UAAUQ,IACpB,gBAAAG;AAAA,QAACJ;AAAA,QAAA;AAAA,UACC,WAAW;AAAA,UACX,aAAaN,EAAc,eAAe;AAAA,UAC1C,iBAAiBA,EAAc,mBAAmB;AAAA,UAClD,WAAWO,EAAW;AAAA,UACtB,UAAUA,EAAW;AAAA,UACrB,WAAWR,EAAM;AAAA,UACjB,MAAAE;AAAA,UACA,WAAWD,EAAc,aAAa;AAAA,UACtC,UAAUD,EAAM;AAAA,UAChB,mBAAmB,CAACsB,MAASrB,EAAc,aAAaqB,CAAI;AAAA,UAC5D,qBAAqB,MAAMrB,EAAc,aAAa;AAAA,UACtD,iBAAiB,MAAMA,EAAc,SAAS;AAAA,UAC9C,kBAAkB,CAACsB,MAAatB,EAAc,YAAYsB,CAAQ;AAAA,QAAA;AAAA,MAAA,IAElE;AAAA,MACJ,gBAAAZ,EAAC,SAAK,UAAAZ,EAAS,CAAA;AAAA,IAAA,EACjB,CAAA;AAAA,EAAA,GACF;AAEJ;"}
@@ -1,10 +1,18 @@
1
1
  import { CellContext } from '@tanstack/react-table';
2
- import { Operation } from '../../../interfaces';
3
- export interface DefaultCellOperationsProps<Data = any> {
2
+ import { CellMetadata, JSON, Operation } from '../../../interfaces';
3
+ export interface DefaultCellOperationsProps<Data extends {
4
+ [key: string]: JSON;
5
+ } = {
6
+ [key: string]: JSON;
7
+ }> {
4
8
  info: CellContext<Data, unknown>;
5
9
  operations: Operation<Data>[];
6
- metadata?: Record<string, unknown>;
10
+ metadata?: CellMetadata;
7
11
  i18n: (i18n: string) => string;
8
12
  onClick?: (data: any, operation: Operation<Data>) => void;
9
13
  }
10
- export declare function DefaultCellOperations({ info, metadata, operations, i18n, onClick }: DefaultCellOperationsProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function DefaultCellOperations<Data extends {
15
+ [key: string]: JSON;
16
+ } = {
17
+ [key: string]: JSON;
18
+ }>({ info, metadata, operations, i18n, onClick }: DefaultCellOperationsProps<Data>): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,14 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { registerComponent as p, getComponent as l } from "../../../registries/components.js";
3
- function m({ info: r, metadata: n, operations: a, i18n: i, onClick: e }) {
4
- const u = l("OperationButton");
5
- return /* @__PURE__ */ o("div", { className: "btn-group", children: a.filter(({ permissionsResolver: t }) => !t || t(r.row.original, n)).map((t) => /* @__PURE__ */ o(
2
+ import { registerComponent as l, getComponent as m } from "../../../registries/components.js";
3
+ function g({
4
+ info: r,
5
+ metadata: n,
6
+ operations: a,
7
+ i18n: i,
8
+ onClick: e
9
+ }) {
10
+ const u = m("OperationButton");
11
+ return /* @__PURE__ */ o("div", { className: "btn-group", children: a.filter(({ permissionsResolver: t, ...p }) => !t || t(r.row.original, n || {}, p)).map((t) => /* @__PURE__ */ o(
6
12
  u,
7
13
  {
8
14
  "data-testid": `operation-${r.row.id}-${t.action}`,
@@ -17,8 +23,8 @@ function m({ info: r, metadata: n, operations: a, i18n: i, onClick: e }) {
17
23
  t.action
18
24
  )) });
19
25
  }
20
- p("CellOperations", m);
26
+ l("CellOperations", g);
21
27
  export {
22
- m as DefaultCellOperations
28
+ g as DefaultCellOperations
23
29
  };
24
30
  //# sourceMappingURL=DefaultCellOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultCellOperations.js","sources":["../../../../src/molecules/table/components/DefaultCellOperations.tsx"],"sourcesContent":["import type { CellContext } from \"@tanstack/react-table\";\n\nimport type { Operation } from \"../../../interfaces\";\nimport { getComponent, registerComponent } from \"../../../registries/components\";\nimport type { DefaultOperationButton } from \"./DefaultOperationButton\";\n\nexport interface DefaultCellOperationsProps<Data = any> {\n info: CellContext<Data, unknown>;\n operations: Operation<Data>[];\n metadata?: Record<string, unknown>;\n i18n: (i18n: string) => string;\n onClick?: (data: any, operation: Operation<Data>) => void;\n}\n\nexport function DefaultCellOperations({ info, metadata, operations, i18n, onClick }: DefaultCellOperationsProps) {\n const Button = getComponent<typeof DefaultOperationButton>(\"OperationButton\");\n return (\n <div className='btn-group'>\n {operations\n .filter(({ permissionsResolver }) => {\n return !permissionsResolver || permissionsResolver(info.row.original, metadata);\n })\n .map((operation) => {\n return (\n <Button\n data-testid={`operation-${info.row.id}-${operation.action}`}\n key={operation.action}\n operation={operation}\n metadata={metadata}\n info={info}\n i18n={i18n}\n onClick={() => {\n onClick?.(info.row.original, operation);\n }}\n />\n );\n })}\n </div>\n );\n}\n\nregisterComponent(\"CellOperations\", DefaultCellOperations);\n"],"names":["DefaultCellOperations","info","metadata","operations","i18n","onClick","Button","getComponent","jsx","permissionsResolver","operation","registerComponent"],"mappings":";;AAcO,SAASA,EAAsB,EAAE,MAAAC,GAAM,UAAAC,GAAU,YAAAC,GAAY,MAAAC,GAAM,SAAAC,KAAuC;AACzG,QAAAC,IAASC,EAA4C,iBAAiB;AAE1E,SAAA,gBAAAC,EAAC,SAAI,WAAU,aACZ,YACE,OAAO,CAAC,EAAE,qBAAAC,QACF,CAACA,KAAuBA,EAAoBR,EAAK,IAAI,UAAUC,CAAQ,CAC/E,EACA,IAAI,CAACQ,MAEF,gBAAAF;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,eAAa,aAAaL,EAAK,IAAI,EAAE,IAAIS,EAAU,MAAM;AAAA,MAEzD,WAAAA;AAAA,MACA,UAAAR;AAAA,MACA,MAAAD;AAAA,MACA,MAAAG;AAAA,MACA,SAAS,MAAM;AACH,QAAAC,KAAA,QAAAA,EAAAJ,EAAK,IAAI,UAAUS;AAAA,MAAS;AAAA,IACxC;AAAA,IAPKA,EAAU;AAAA,EAQjB,CAEH,GACL;AAEJ;AAEAC,EAAkB,kBAAkBX,CAAqB;"}
1
+ {"version":3,"file":"DefaultCellOperations.js","sources":["../../../../src/molecules/table/components/DefaultCellOperations.tsx"],"sourcesContent":["import type { CellContext } from \"@tanstack/react-table\";\n\nimport type { CellMetadata, JSON, Operation } from \"../../../interfaces\";\nimport { getComponent, registerComponent } from \"../../../registries/components\";\nimport type { DefaultOperationButton } from \"./DefaultOperationButton\";\n\nexport interface DefaultCellOperationsProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> {\n info: CellContext<Data, unknown>;\n operations: Operation<Data>[];\n metadata?: CellMetadata;\n i18n: (i18n: string) => string;\n onClick?: (data: any, operation: Operation<Data>) => void;\n}\n\nexport function DefaultCellOperations<Data extends { [key: string]: JSON } = { [key: string]: JSON }>({\n info,\n metadata,\n operations,\n i18n,\n onClick\n}: DefaultCellOperationsProps<Data>) {\n const Button = getComponent<typeof DefaultOperationButton<Data>>(\"OperationButton\");\n return (\n <div className='btn-group'>\n {operations\n .filter(({ permissionsResolver, ...operation }) => {\n return !permissionsResolver || permissionsResolver(info.row.original, metadata || {}, operation);\n })\n .map((operation) => {\n return (\n <Button\n data-testid={`operation-${info.row.id}-${operation.action}`}\n key={operation.action}\n operation={operation}\n metadata={metadata}\n info={info}\n i18n={i18n}\n onClick={() => {\n onClick?.(info.row.original, operation);\n }}\n />\n );\n })}\n </div>\n );\n}\n\nregisterComponent(\"CellOperations\", DefaultCellOperations);\n"],"names":["DefaultCellOperations","info","metadata","operations","i18n","onClick","Button","getComponent","jsx","permissionsResolver","operation","registerComponent"],"mappings":";;AAcO,SAASA,EAAsF;AAAA,EACpG,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AACF,GAAqC;AAC7B,QAAAC,IAASC,EAAkD,iBAAiB;AAEhF,SAAA,gBAAAC,EAAC,OAAI,EAAA,WAAU,aACZ,UAAAL,EACE,OAAO,CAAC,EAAE,qBAAAM,GAAqB,GAAGC,EAAA,MAC1B,CAACD,KAAuBA,EAAoBR,EAAK,IAAI,UAAUC,KAAY,CAAC,GAAGQ,CAAS,CAChG,EACA,IAAI,CAACA,MAEF,gBAAAF;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,eAAa,aAAaL,EAAK,IAAI,EAAE,IAAIS,EAAU,MAAM;AAAA,MAEzD,WAAAA;AAAA,MACA,UAAAR;AAAA,MACA,MAAAD;AAAA,MACA,MAAAG;AAAA,MACA,SAAS,MAAM;AACH,QAAAC,KAAA,QAAAA,EAAAJ,EAAK,IAAI,UAAUS;AAAA,MAAS;AAAA,IACxC;AAAA,IAPKA,EAAU;AAAA,EAQjB,CAEH,GACL;AAEJ;AAEAC,EAAkB,kBAAkBX,CAAqB;"}
@@ -1,11 +1,19 @@
1
1
  import { CellContext } from '@tanstack/react-table';
2
2
  import { HTMLAttributes } from 'react';
3
- import { Operation } from '../../../interfaces';
4
- export interface OperationButtonProps<Data = any> extends Omit<HTMLAttributes<HTMLButtonElement>, "onClick"> {
3
+ import { CellMetadata, JSON, Operation } from '../../../interfaces';
4
+ export interface OperationButtonProps<Data extends {
5
+ [key: string]: JSON;
6
+ } = {
7
+ [key: string]: JSON;
8
+ }> extends Omit<HTMLAttributes<HTMLButtonElement>, "onClick"> {
5
9
  operation: Operation<Data>;
6
10
  info: CellContext<Data, unknown>;
7
- metadata?: Record<string, unknown>;
11
+ metadata?: CellMetadata;
8
12
  onClick: () => void;
9
13
  i18n?: (i18n: string) => string;
10
14
  }
11
- export declare function DefaultOperationButton(props: OperationButtonProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function DefaultOperationButton<Data extends {
16
+ [key: string]: JSON;
17
+ } = {
18
+ [key: string]: JSON;
19
+ }>(props: OperationButtonProps<Data>): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultOperationButton.js","sources":["../../../../src/molecules/table/components/DefaultOperationButton.tsx"],"sourcesContent":["import { CellContext } from \"@tanstack/react-table\";\nimport cx from \"classnames\";\nimport { HTMLAttributes } from \"react\";\n\nimport { Operation } from \"../../../interfaces\";\nimport { registerComponent } from \"../../../registries/components\";\nimport { iconClass } from \"../../../utils/iconClass\";\nimport { stopPropagationWrapper } from \"../../../utils/stopPropagationWrapper\";\n\nexport interface OperationButtonProps<Data = any> extends Omit<HTMLAttributes<HTMLButtonElement>, \"onClick\"> {\n operation: Operation<Data>;\n info: CellContext<Data, unknown>;\n metadata?: Record<string, unknown>;\n onClick: () => void;\n i18n?: (i18n: string) => string;\n}\n\nexport function DefaultOperationButton(props: OperationButtonProps) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { i18n = (f: string) => f, onClick, operation, info, ...extraProps } = props;\n const { className = \"btn\", buttonSize = \"xs\", buttonType = \"primary\", buttonOutline, action, title = \"\", icon = \"\" } = operation;\n\n return (\n <button\n {...extraProps}\n aria-label={\"Operation button: \" + (title || action)}\n className={cx(className, [\"btn\", buttonOutline && \"outline\", buttonType].filter(Boolean).join(\"-\"), `btn-${buttonSize}`)}\n onClick={stopPropagationWrapper(() => onClick())}\n >\n {icon ? (\n <>\n <i className={iconClass(undefined, icon)} /> {title && \" \"}\n </>\n ) : null}\n {title && <span className={icon && title ? \"ml-1\" : \"\"}>{i18n(title)}</span>}\n </button>\n );\n}\n\nregisterComponent(\"OperationButton\", DefaultOperationButton);\n"],"names":["DefaultOperationButton","props","i18n","onClick","operation","info","extraProps","className","buttonSize","buttonType","buttonOutline","action","title","icon","jsxs","cx","stopPropagationWrapper","Fragment","jsx","iconClass","registerComponent"],"mappings":";;;;;AAiBO,SAASA,EAAuBC,GAA6B;AAE5D,QAAA,EAAE,MAAAC,IAAO,CAAC,MAAc,GAAG,SAAAC,GAAS,WAAAC,GAAW,MAAAC,GAAM,GAAGC,EAAA,IAAeL,GACvE,EAAE,WAAAM,IAAY,OAAO,YAAAC,IAAa,MAAM,YAAAC,IAAa,WAAW,eAAAC,GAAe,QAAAC,GAAQ,OAAAC,IAAQ,IAAI,MAAAC,IAAO,GAAO,IAAAT;AAGrH,SAAA,gBAAAU;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGR;AAAA,MACJ,cAAY,wBAAwBM,KAASD;AAAA,MAC7C,WAAWI,EAAGR,GAAW,CAAC,OAAOG,KAAiB,WAAWD,CAAU,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAAG,OAAOD,CAAU,EAAE;AAAA,MACvH,SAASQ,EAAuB,MAAMb,GAAS;AAAA,MAE9C,UAAA;AAAA,QAAAU,IAEG,gBAAAC,EAAAG,GAAA,EAAA,UAAA;AAAA,UAAA,gBAAAC,EAAC,KAAE,EAAA,WAAWC,EAAU,QAAWN,CAAI,GAAG;AAAA,UAAE;AAAA,UAAED,KAAS;AAAA,QAAA,EAAA,CACzD,IACE;AAAA,QACHA,KAAU,gBAAAM,EAAA,QAAA,EAAK,WAAWL,KAAQD,IAAQ,SAAS,IAAK,UAAKV,EAAAU,CAAK,EAAE,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACvE;AAEJ;AAEAQ,EAAkB,mBAAmBpB,CAAsB;"}
1
+ {"version":3,"file":"DefaultOperationButton.js","sources":["../../../../src/molecules/table/components/DefaultOperationButton.tsx"],"sourcesContent":["import { CellContext } from \"@tanstack/react-table\";\nimport cx from \"classnames\";\nimport { HTMLAttributes } from \"react\";\n\nimport { type CellMetadata, type JSON, Operation } from \"../../../interfaces\";\nimport { registerComponent } from \"../../../registries/components\";\nimport { iconClass } from \"../../../utils/iconClass\";\nimport { stopPropagationWrapper } from \"../../../utils/stopPropagationWrapper\";\n\nexport interface OperationButtonProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }>\n extends Omit<HTMLAttributes<HTMLButtonElement>, \"onClick\"> {\n operation: Operation<Data>;\n info: CellContext<Data, unknown>;\n metadata?: CellMetadata;\n onClick: () => void;\n i18n?: (i18n: string) => string;\n}\n\nexport function DefaultOperationButton<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(props: OperationButtonProps<Data>) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { i18n = (f: string) => f, onClick, operation, info, ...extraProps } = props;\n const { className = \"btn\", buttonSize = \"xs\", buttonType = \"primary\", buttonOutline, action, title = \"\", icon = \"\" } = operation;\n\n return (\n <button\n {...extraProps}\n aria-label={\"Operation button: \" + (title || action)}\n className={cx(className, [\"btn\", buttonOutline && \"outline\", buttonType].filter(Boolean).join(\"-\"), `btn-${buttonSize}`)}\n onClick={stopPropagationWrapper(() => onClick())}\n >\n {icon ? (\n <>\n <i className={iconClass(undefined, icon)} /> {title && \" \"}\n </>\n ) : null}\n {title && <span className={icon && title ? \"ml-1\" : \"\"}>{i18n(title)}</span>}\n </button>\n );\n}\n\nregisterComponent(\"OperationButton\", DefaultOperationButton);\n"],"names":["DefaultOperationButton","props","i18n","onClick","operation","info","extraProps","className","buttonSize","buttonType","buttonOutline","action","title","icon","jsxs","cx","stopPropagationWrapper","Fragment","jsx","iconClass","registerComponent"],"mappings":";;;;;AAkBO,SAASA,EAAuFC,GAAmC;AAElI,QAAA,EAAE,MAAAC,IAAO,CAAC,MAAc,GAAG,SAAAC,GAAS,WAAAC,GAAW,MAAAC,GAAM,GAAGC,EAAA,IAAeL,GACvE,EAAE,WAAAM,IAAY,OAAO,YAAAC,IAAa,MAAM,YAAAC,IAAa,WAAW,eAAAC,GAAe,QAAAC,GAAQ,OAAAC,IAAQ,IAAI,MAAAC,IAAO,GAAO,IAAAT;AAGrH,SAAA,gBAAAU;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGR;AAAA,MACJ,cAAY,wBAAwBM,KAASD;AAAA,MAC7C,WAAWI,EAAGR,GAAW,CAAC,OAAOG,KAAiB,WAAWD,CAAU,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAAG,OAAOD,CAAU,EAAE;AAAA,MACvH,SAASQ,EAAuB,MAAMb,GAAS;AAAA,MAE9C,UAAA;AAAA,QAAAU,IAEG,gBAAAC,EAAAG,GAAA,EAAA,UAAA;AAAA,UAAA,gBAAAC,EAAC,KAAE,EAAA,WAAWC,EAAU,QAAWN,CAAI,GAAG;AAAA,UAAE;AAAA,UAAED,KAAS;AAAA,QAAA,EAAA,CACzD,IACE;AAAA,QACHA,KAAU,gBAAAM,EAAA,QAAA,EAAK,WAAWL,KAAQD,IAAQ,SAAS,IAAK,UAAKV,EAAAU,CAAK,EAAE,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACvE;AAEJ;AAEAQ,EAAkB,mBAAmBpB,CAAsB;"}
@@ -1,6 +1,10 @@
1
- import { RowData, TableOptions, TableState } from '@tanstack/react-table';
2
- import { Operation } from '../../../interfaces';
3
- export interface UseTableProps<Data extends RowData> extends TableOptions<Data> {
1
+ import { TableOptions, TableState } from '@tanstack/react-table';
2
+ import { JSON, Operation } from '../../../interfaces';
3
+ export interface UseTableProps<Data extends {
4
+ [key: string]: JSON;
5
+ } = {
6
+ [key: string]: JSON;
7
+ }> extends Omit<TableOptions<Data>, "getCoreRowModel" | "onClick"> {
4
8
  operations: Operation<Data>[];
5
9
  metadata?: Record<string, unknown>;
6
10
  i18n?: (i18n: string) => string;
@@ -9,7 +13,11 @@ export interface UseTableProps<Data extends RowData> extends TableOptions<Data>
9
13
  onChange?: (query: TableState) => void;
10
14
  pageSizes?: number[];
11
15
  }
12
- export declare function useTable<Data extends RowData>(props: UseTableProps<Data>): {
16
+ export declare function useTable<Data extends {
17
+ [key: string]: JSON;
18
+ } = {
19
+ [key: string]: JSON;
20
+ }>(props: UseTableProps<Data>): {
13
21
  i18n: (i18n: string) => string;
14
22
  tableInstance: import('@tanstack/table-core').Table<Data>;
15
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useTable.js","sources":["../../../../src/molecules/table/hooks/useTable.tsx"],"sourcesContent":["import {\n type ColumnDef,\n getCoreRowModel,\n getFacetedRowModel,\n getFacetedUniqueValues,\n getFilteredRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n type RowData,\n type TableOptions,\n type TableState,\n useReactTable\n} from \"@tanstack/react-table\";\nimport { useEffect } from \"react\";\n\nimport { Operation } from \"../../../interfaces\";\nimport { getComponent } from \"../../../registries/components\";\nimport type { DefaultCellOperations } from \"../components/DefaultCellOperations\";\n\nexport interface UseTableProps<Data extends RowData> extends TableOptions<Data> {\n operations: Operation<Data>[];\n metadata?: Record<string, unknown>;\n i18n?: (i18n: string) => string;\n onClick?: (data: any, operation: Operation<Data>) => void;\n manualFaceted?: boolean;\n onChange?: (query: TableState) => void;\n pageSizes?: number[];\n}\n\nexport function useTable<Data extends RowData>(props: UseTableProps<Data>) {\n const Operations = getComponent<typeof DefaultCellOperations>(\"CellOperations\");\n const i18n = props.i18n || ((f: string) => f);\n\n // const [pagination, setPagination] = useState({\n // pageIndex: 0, //initial page index\n // pageSize: 10 //default page size\n // });\n\n const operations = props.operations.length\n ? ([\n {\n id: \"operations\",\n header: i18n(\"Operations\"),\n cell: (info) => (\n <Operations info={info} operations={props.operations} metadata={props.metadata} onClick={props.onClick} i18n={i18n} />\n )\n }\n ] satisfies ColumnDef<Data>[])\n : [];\n\n const tableInstance = useReactTable({\n ...props,\n columns: [...props.columns, ...operations],\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n getFilteredRowModel: !props.manualFiltering ? getFilteredRowModel() : undefined,\n getSortedRowModel: !props.manualSorting ? getSortedRowModel() : undefined,\n getFacetedRowModel: !props.manualFaceted ? getFacetedRowModel() : undefined, // client-side faceting\n getFacetedUniqueValues: !props.manualFaceted ? getFacetedUniqueValues() : undefined // generate unique values for select filter/autocomplete\n });\n\n const { columnFilters, sorting, pagination, columnOrder, columnPinning, columnSizing, columnSizingInfo, columnVisibility, globalFilter } =\n tableInstance.getState();\n\n useEffect(() => {\n if (props.onChange) {\n props.onChange(tableInstance.getState());\n }\n }, [columnFilters, sorting, pagination, columnOrder, columnPinning, columnSizing, columnSizingInfo, columnVisibility, globalFilter]);\n\n return {\n i18n,\n tableInstance\n };\n}\n"],"names":["useTable","props","Operations","getComponent","i18n","f","operations","info","jsx","tableInstance","useReactTable","getCoreRowModel","getPaginationRowModel","getFilteredRowModel","getSortedRowModel","getFacetedRowModel","getFacetedUniqueValues","columnFilters","sorting","pagination","columnOrder","columnPinning","columnSizing","columnSizingInfo","columnVisibility","globalFilter","useEffect"],"mappings":";;;;AA6BO,SAASA,EAA+BC,GAA4B;AACnE,QAAAC,IAAaC,EAA2C,gBAAgB,GACxEC,IAAOH,EAAM,SAAS,CAACI,MAAcA,IAOrCC,IAAaL,EAAM,WAAW,SAC/B;AAAA,IACC;AAAA,MACE,IAAI;AAAA,MACJ,QAAQG,EAAK,YAAY;AAAA,MACzB,MAAM,CAACG,MACL,gBAAAC,EAACN,KAAW,MAAAK,GAAY,YAAYN,EAAM,YAAY,UAAUA,EAAM,UAAU,SAASA,EAAM,SAAS,MAAAG,EAAY,CAAA;AAAA,IAAA;AAAA,EAExH,IAEF,CAAC,GAECK,IAAgBC,EAAc;AAAA,IAClC,GAAGT;AAAA,IACH,SAAS,CAAC,GAAGA,EAAM,SAAS,GAAGK,CAAU;AAAA,IACzC,iBAAiBK,EAAgB;AAAA,IACjC,uBAAuBC,EAAsB;AAAA,IAC7C,qBAAsBX,EAAM,kBAA0C,SAAxBY;IAC9C,mBAAoBZ,EAAM,gBAAsC,SAAtBa;IAC1C,oBAAqBb,EAAM,gBAAuC,SAAvBc;;IAC3C,wBAAyBd,EAAM,gBAA2C,SAA3Be,EAA2B;AAAA;AAAA,EAAA,CAC3E,GAEK,EAAE,eAAAC,GAAe,SAAAC,GAAS,YAAAC,GAAY,aAAAC,GAAa,eAAAC,GAAe,cAAAC,GAAc,kBAAAC,GAAkB,kBAAAC,GAAkB,cAAAC,MACxHhB,EAAc,SAAS;AAEzB,SAAAiB,EAAU,MAAM;AACd,IAAIzB,EAAM,YACFA,EAAA,SAASQ,EAAc,UAAU;AAAA,EAE3C,GAAG,CAACQ,GAAeC,GAASC,GAAYC,GAAaC,GAAeC,GAAcC,GAAkBC,GAAkBC,CAAY,CAAC,GAE5H;AAAA,IACL,MAAArB;AAAA,IACA,eAAAK;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useTable.js","sources":["../../../../src/molecules/table/hooks/useTable.tsx"],"sourcesContent":["import {\n type ColumnDef,\n getCoreRowModel,\n getFacetedRowModel,\n getFacetedUniqueValues,\n getFilteredRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n type TableOptions,\n type TableState,\n useReactTable\n} from \"@tanstack/react-table\";\nimport { useEffect } from \"react\";\n\nimport { type JSON, Operation } from \"../../../interfaces\";\nimport { getComponent } from \"../../../registries/components\";\nimport type { DefaultCellOperations } from \"../components/DefaultCellOperations\";\n\nexport interface UseTableProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }>\n extends Omit<TableOptions<Data>, \"getCoreRowModel\" | \"onClick\"> {\n operations: Operation<Data>[];\n metadata?: Record<string, unknown>;\n i18n?: (i18n: string) => string;\n onClick?: (data: any, operation: Operation<Data>) => void;\n manualFaceted?: boolean;\n onChange?: (query: TableState) => void;\n pageSizes?: number[];\n}\n\nexport function useTable<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(props: UseTableProps<Data>) {\n const Operations = getComponent<typeof DefaultCellOperations<Data>>(\"CellOperations\");\n const i18n = props.i18n || ((f: string) => f);\n\n // const [pagination, setPagination] = useState({\n // pageIndex: 0, //initial page index\n // pageSize: 10 //default page size\n // });\n\n const operations = props.operations.length\n ? ([\n {\n id: \"operations\",\n header: i18n(\"Operations\"),\n cell: (info) => (\n <Operations info={info} operations={props.operations} metadata={props.metadata} onClick={props.onClick} i18n={i18n} />\n )\n }\n ] satisfies ColumnDef<Data>[])\n : [];\n\n const tableInstance = useReactTable({\n ...props,\n columns: [...props.columns, ...operations],\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n getFilteredRowModel: !props.manualFiltering ? getFilteredRowModel() : undefined,\n getSortedRowModel: !props.manualSorting ? getSortedRowModel() : undefined,\n getFacetedRowModel: !props.manualFaceted ? getFacetedRowModel() : undefined, // client-side faceting\n getFacetedUniqueValues: !props.manualFaceted ? getFacetedUniqueValues() : undefined // generate unique values for select filter/autocomplete\n });\n\n const { columnFilters, sorting, pagination, columnOrder, columnPinning, columnSizing, columnSizingInfo, columnVisibility, globalFilter } =\n tableInstance.getState();\n\n useEffect(() => {\n if (props.onChange) {\n props.onChange(tableInstance.getState());\n }\n }, [columnFilters, sorting, pagination, columnOrder, columnPinning, columnSizing, columnSizingInfo, columnVisibility, globalFilter]);\n\n return {\n i18n,\n tableInstance\n };\n}\n"],"names":["useTable","props","Operations","getComponent","i18n","f","operations","info","jsx","tableInstance","useReactTable","getCoreRowModel","getPaginationRowModel","getFilteredRowModel","getSortedRowModel","getFacetedRowModel","getFacetedUniqueValues","columnFilters","sorting","pagination","columnOrder","columnPinning","columnSizing","columnSizingInfo","columnVisibility","globalFilter","useEffect"],"mappings":";;;;AA6BO,SAASA,EAAyEC,GAA4B;AAC7G,QAAAC,IAAaC,EAAiD,gBAAgB,GAC9EC,IAAOH,EAAM,SAAS,CAACI,MAAcA,IAOrCC,IAAaL,EAAM,WAAW,SAC/B;AAAA,IACC;AAAA,MACE,IAAI;AAAA,MACJ,QAAQG,EAAK,YAAY;AAAA,MACzB,MAAM,CAACG,MACL,gBAAAC,EAACN,KAAW,MAAAK,GAAY,YAAYN,EAAM,YAAY,UAAUA,EAAM,UAAU,SAASA,EAAM,SAAS,MAAAG,EAAY,CAAA;AAAA,IAAA;AAAA,EAExH,IAEF,CAAC,GAECK,IAAgBC,EAAc;AAAA,IAClC,GAAGT;AAAA,IACH,SAAS,CAAC,GAAGA,EAAM,SAAS,GAAGK,CAAU;AAAA,IACzC,iBAAiBK,EAAgB;AAAA,IACjC,uBAAuBC,EAAsB;AAAA,IAC7C,qBAAsBX,EAAM,kBAA0C,SAAxBY;IAC9C,mBAAoBZ,EAAM,gBAAsC,SAAtBa;IAC1C,oBAAqBb,EAAM,gBAAuC,SAAvBc;;IAC3C,wBAAyBd,EAAM,gBAA2C,SAA3Be,EAA2B;AAAA;AAAA,EAAA,CAC3E,GAEK,EAAE,eAAAC,GAAe,SAAAC,GAAS,YAAAC,GAAY,aAAAC,GAAa,eAAAC,GAAe,cAAAC,GAAc,kBAAAC,GAAkB,kBAAAC,GAAkB,cAAAC,MACxHhB,EAAc,SAAS;AAEzB,SAAAiB,EAAU,MAAM;AACd,IAAIzB,EAAM,YACFA,EAAA,SAASQ,EAAc,UAAU;AAAA,EAE3C,GAAG,CAACQ,GAAeC,GAASC,GAAYC,GAAaC,GAAeC,GAAcC,GAAkBC,GAAkBC,CAAY,CAAC,GAE5H;AAAA,IACL,MAAArB;AAAA,IACA,eAAAK;AAAA,EACF;AACF;"}
@@ -0,0 +1,13 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export interface TabProps {
3
+ icon?: string;
4
+ isActive?: boolean;
5
+ className?: string;
6
+ after?: React.ReactNode;
7
+ value: number;
8
+ /**
9
+ * on tab select handler
10
+ */
11
+ onClick?: (value: number) => void;
12
+ }
13
+ export declare function Tab({ onClick, icon, value, children, className, after }: PropsWithChildren<TabProps>): import("react/jsx-runtime").JSX.Element;