@akinon/akitable 0.0.5 → 0.1.0

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 (76) hide show
  1. package/dist/cjs/components/AntdTable/index.d.ts.map +1 -0
  2. package/dist/cjs/components/AntdTable/index.js +33 -0
  3. package/dist/cjs/components/Footer/index.css +6 -0
  4. package/dist/{components → cjs/components}/Footer/index.d.ts +1 -0
  5. package/dist/cjs/components/Footer/index.d.ts.map +1 -0
  6. package/dist/cjs/components/Footer/index.js +16 -0
  7. package/dist/cjs/components/Header/index.css +84 -0
  8. package/dist/{components → cjs/components}/Header/index.d.ts +1 -0
  9. package/dist/cjs/components/Header/index.d.ts.map +1 -0
  10. package/dist/cjs/components/Header/index.js +25 -0
  11. package/dist/cjs/components/HeaderActions/index.css +30 -0
  12. package/dist/{components → cjs/components}/HeaderActions/index.d.ts +1 -0
  13. package/dist/cjs/components/HeaderActions/index.d.ts.map +1 -0
  14. package/dist/cjs/components/HeaderActions/index.js +39 -0
  15. package/dist/cjs/components/Pagination/index.css +96 -0
  16. package/dist/{components → cjs/components}/Pagination/index.d.ts +1 -0
  17. package/dist/cjs/components/Pagination/index.d.ts.map +1 -0
  18. package/dist/cjs/components/Pagination/index.js +20 -0
  19. package/dist/cjs/components/index.d.ts.map +1 -0
  20. package/dist/cjs/components/index.js +13 -0
  21. package/dist/cjs/context/index.d.ts.map +1 -0
  22. package/dist/cjs/context/index.js +35 -0
  23. package/dist/cjs/index.css +28 -0
  24. package/dist/{index.d.ts → cjs/index.d.ts} +1 -0
  25. package/dist/cjs/index.d.ts.map +1 -0
  26. package/dist/cjs/index.js +96 -0
  27. package/dist/{types.d.ts → cjs/types.d.ts} +1 -0
  28. package/dist/cjs/types.d.ts.map +1 -0
  29. package/dist/cjs/types.js +2 -0
  30. package/dist/esm/components/AntdTable/index.d.ts +6 -0
  31. package/dist/esm/components/AntdTable/index.d.ts.map +1 -0
  32. package/dist/esm/components/AntdTable/index.js +29 -0
  33. package/dist/esm/components/Footer/index.css +6 -0
  34. package/dist/esm/components/Footer/index.d.ts +4 -0
  35. package/dist/esm/components/Footer/index.d.ts.map +1 -0
  36. package/dist/esm/components/Footer/index.js +12 -0
  37. package/dist/esm/components/Header/index.css +84 -0
  38. package/dist/esm/components/Header/index.d.ts +10 -0
  39. package/dist/esm/components/Header/index.d.ts.map +1 -0
  40. package/dist/esm/components/Header/index.js +21 -0
  41. package/dist/esm/components/HeaderActions/index.css +30 -0
  42. package/dist/esm/components/HeaderActions/index.d.ts +9 -0
  43. package/dist/esm/components/HeaderActions/index.d.ts.map +1 -0
  44. package/dist/esm/components/HeaderActions/index.js +35 -0
  45. package/dist/esm/components/Pagination/index.css +96 -0
  46. package/dist/esm/components/Pagination/index.d.ts +4 -0
  47. package/dist/esm/components/Pagination/index.d.ts.map +1 -0
  48. package/dist/esm/components/Pagination/index.js +16 -0
  49. package/dist/esm/components/index.d.ts +6 -0
  50. package/dist/esm/components/index.d.ts.map +1 -0
  51. package/dist/esm/components/index.js +5 -0
  52. package/dist/esm/context/index.d.ts +25 -0
  53. package/dist/esm/context/index.d.ts.map +1 -0
  54. package/dist/esm/context/index.js +30 -0
  55. package/dist/esm/index.css +28 -0
  56. package/dist/esm/index.d.ts +19 -0
  57. package/dist/esm/index.d.ts.map +1 -0
  58. package/dist/esm/index.js +92 -0
  59. package/dist/esm/types.d.ts +18 -0
  60. package/dist/esm/types.d.ts.map +1 -0
  61. package/dist/esm/types.js +1 -0
  62. package/package.json +24 -17
  63. package/dist/components/AntdTable/index.d.ts.map +0 -1
  64. package/dist/components/Footer/index.d.ts.map +0 -1
  65. package/dist/components/Header/index.d.ts.map +0 -1
  66. package/dist/components/HeaderActions/index.d.ts.map +0 -1
  67. package/dist/components/Pagination/index.d.ts.map +0 -1
  68. package/dist/components/index.d.ts.map +0 -1
  69. package/dist/context/index.d.ts.map +0 -1
  70. package/dist/index.cjs +0 -353
  71. package/dist/index.d.ts.map +0 -1
  72. package/dist/index.js +0 -33690
  73. package/dist/types.d.ts.map +0 -1
  74. /package/dist/{components → cjs/components}/AntdTable/index.d.ts +0 -0
  75. /package/dist/{components → cjs/components}/index.d.ts +0 -0
  76. /package/dist/{context → cjs/context}/index.d.ts +0 -0
@@ -0,0 +1,6 @@
1
+ .akitable-footer {
2
+ padding: 20px;
3
+ display: flex;
4
+ justify-content: flex-end;
5
+ align-items: center;
6
+ }
@@ -0,0 +1,4 @@
1
+ import './index.css';
2
+ import React from 'react';
3
+ export declare const AkitableFooter: () => React.JSX.Element;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Footer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,cAAc,yBAa1B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import './index.css';
2
+ import { Card } from '@akinon/ui-card';
3
+ import React from 'react';
4
+ import { AkitablePagination } from '../index';
5
+ export const AkitableFooter = () => {
6
+ return (React.createElement(Card, { style: {
7
+ borderTopLeftRadius: 0,
8
+ borderTopRightRadius: 0
9
+ } },
10
+ React.createElement("div", { className: "akitable-footer" },
11
+ React.createElement(AkitablePagination, null))));
12
+ };
@@ -0,0 +1,84 @@
1
+ .akitable-header {
2
+ padding: 20px 32px 16px;
3
+ display: flex;
4
+ justify-content: space-between;
5
+ gap: 16px;
6
+
7
+ /* Push pagination to the right
8
+ even if table actions are hidden. */
9
+ & .akinon-pagination {
10
+ margin-left: auto;
11
+ }
12
+
13
+ &__left-block {
14
+ flex: 1;
15
+ }
16
+
17
+ &__middle-block {
18
+ color: black;
19
+ }
20
+
21
+ &__right-block {
22
+ display: flex;
23
+ justify-content: flex-end;
24
+ align-items: flex-end;
25
+ flex-direction: column;
26
+ gap: 20px;
27
+ }
28
+
29
+ &__export-options {
30
+ display: flex;
31
+ align-items: center;
32
+ gap: 12px;
33
+ }
34
+
35
+ &__export-option {
36
+ cursor: pointer;
37
+ display: flex;
38
+ flex-direction: column;
39
+ justify-content: center;
40
+ align-items: center;
41
+ background-color: #4482ff;
42
+ color: white;
43
+ width: 36px;
44
+ height: 36px;
45
+ border-radius: 5px;
46
+ }
47
+
48
+ &__export-option-icon {
49
+ height: 16px;
50
+ & > i {
51
+ color: white;
52
+ margin: 0;
53
+ font-size: 10px;
54
+ font-weight: bold;
55
+
56
+ &::before {
57
+ color: white;
58
+ }
59
+ }
60
+ }
61
+
62
+ &__export-option-label {
63
+ font-weight: bold;
64
+ font-size: 11px;
65
+ user-select: none;
66
+ cursor: pointer;
67
+ }
68
+
69
+ &__info {
70
+ margin-bottom: 0.5rem;
71
+ }
72
+
73
+ &__title.akinon-typography {
74
+ font-size: 20px;
75
+ margin: 0.5rem 0 0.1rem;
76
+ font-weight: 700;
77
+ }
78
+
79
+ &__description.akinon-typography {
80
+ font-size: 13px;
81
+ color: #797979;
82
+ font-weight: 400;
83
+ }
84
+ }
@@ -0,0 +1,10 @@
1
+ import './index.css';
2
+ import React from 'react';
3
+ interface AkitableHeaderProps {
4
+ title: string;
5
+ description: string;
6
+ headerMiddleBlock?: React.ReactNode;
7
+ }
8
+ export declare const AkitableHeader: ({ title, description, headerMiddleBlock }: AkitableHeaderProps) => React.JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Header/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACrC;AAED,eAAO,MAAM,cAAc,8CAIxB,mBAAmB,sBA+BrB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import './index.css';
2
+ import { Card } from '@akinon/ui-card';
3
+ import * as Typography from '@akinon/ui-typography';
4
+ import React from 'react';
5
+ import { AkitablePagination, HeaderActions } from '../index';
6
+ const { Title, Text } = Typography;
7
+ export const AkitableHeader = ({ title, description, headerMiddleBlock }) => {
8
+ return (React.createElement(Card, { style: {
9
+ borderBottomLeftRadius: 0,
10
+ borderBottomRightRadius: 0
11
+ } },
12
+ React.createElement("div", { className: "akitable-header" },
13
+ React.createElement("div", { className: "akitable-header__left-block" },
14
+ React.createElement("div", { className: "akitable-header__info" },
15
+ React.createElement(Title, { className: "akitable-header__title", level: 5 }, title),
16
+ React.createElement(Text, { className: "akitable-header__description" }, description)),
17
+ React.createElement(HeaderActions, { placeholder: 'Please select an action', applyButtonLabel: 'Apply' })),
18
+ React.createElement("div", { className: "akitable-header__middle-block" }, headerMiddleBlock),
19
+ React.createElement("div", { className: "akitable-header__right-block" },
20
+ React.createElement(AkitablePagination, null)))));
21
+ };
@@ -0,0 +1,30 @@
1
+ .header-actions {
2
+ &__apply-button.akinon-btn {
3
+ font-weight: 600;
4
+ height: 40px;
5
+ }
6
+
7
+ .akinon-select-single:not(.akinon-select-customize-input)
8
+ .akinon-select-selector {
9
+ box-sizing: border-box;
10
+ height: 40px;
11
+ align-items: center;
12
+ border-radius: 5px;
13
+ border: solid 1px #c8daec;
14
+ width: 150px;
15
+ }
16
+
17
+ .akinon-select-focused:not(.akinon-select-disabled).akinon-select:not(
18
+ .akinon-select-customize-input
19
+ )
20
+ .akinon-select-selector {
21
+ border-right-width: 0 !important;
22
+ }
23
+
24
+ .akinon-select-arrow {
25
+ top: 70%;
26
+ }
27
+ .akinon-select-selector {
28
+ min-width: 220px;
29
+ }
30
+ }
@@ -0,0 +1,9 @@
1
+ import './index.css';
2
+ import React from 'react';
3
+ interface HeaderActionsProps {
4
+ placeholder: string;
5
+ applyButtonLabel: string;
6
+ }
7
+ export declare const HeaderActions: ({ placeholder, applyButtonLabel }: HeaderActionsProps) => React.JSX.Element | undefined;
8
+ export {};
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/HeaderActions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAMrB,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,UAAU,kBAAkB;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,aAAa,sCAGvB,kBAAkB,kCAwDpB,CAAC"}
@@ -0,0 +1,35 @@
1
+ import './index.css';
2
+ import { Button } from '@akinon/ui-button';
3
+ import { Select } from '@akinon/ui-select';
4
+ import { Space } from '@akinon/ui-space';
5
+ import React, { useState } from 'react';
6
+ import { useAkitableContext } from '../../context';
7
+ export const HeaderActions = ({ placeholder, applyButtonLabel }) => {
8
+ const [selectedActionIndex, setSelectedActionIndex] = useState(undefined);
9
+ const { state: { selectedRows }, headerActions } = useAkitableContext();
10
+ if (!headerActions)
11
+ return;
12
+ const actionOptions = headerActions.map((action, i) => {
13
+ return {
14
+ label: action.label,
15
+ value: i,
16
+ // do not check isSingleRequired in here but in action handler, since user can select multiple rows after selecting the action which will lead errors.
17
+ disabled: action.disabled
18
+ };
19
+ });
20
+ const handleActionApply = () => {
21
+ if (selectedActionIndex === undefined || selectedActionIndex === null)
22
+ return;
23
+ if ((selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length) === 0)
24
+ return;
25
+ const selectedAction = headerActions[selectedActionIndex];
26
+ selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.handler(selectedRows);
27
+ };
28
+ const handleActionSelectChange = (value) => {
29
+ setSelectedActionIndex(value);
30
+ };
31
+ const isApplyButtonDisabled = selectedActionIndex === undefined || (selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length) === 0;
32
+ return (React.createElement(Space, { align: "baseline", className: "header-actions" },
33
+ React.createElement(Select, { value: selectedActionIndex, onChange: handleActionSelectChange, options: actionOptions, placeholder: placeholder, className: "header-actions__select" }),
34
+ React.createElement(Button, { disabled: isApplyButtonDisabled, className: "header-actions__apply-button", onClick: handleActionApply }, applyButtonLabel)));
35
+ };
@@ -0,0 +1,96 @@
1
+ .akitable-pagination-container {
2
+ display: flex;
3
+
4
+ .akinon-select-single:not(.akinon-select-customize-input)
5
+ .akinon-select-selector {
6
+ box-sizing: border-box;
7
+ height: 40px;
8
+ align-items: center;
9
+ border-radius: 5px;
10
+ border: solid 1px #c8daec;
11
+ }
12
+
13
+ &__pagination.akinon-pagination {
14
+ display: flex;
15
+ align-items: center;
16
+ border-radius: 5px;
17
+
18
+ li {
19
+ margin: 0;
20
+ }
21
+
22
+ .akinon-pagination-prev,
23
+ .akinon-pagination-next {
24
+ width: 36px;
25
+ border-radius: 5px;
26
+
27
+ & > button {
28
+ color: #788195;
29
+
30
+ &:hover,
31
+ &:focus {
32
+ color: #788195;
33
+ }
34
+ }
35
+ }
36
+
37
+ .akinon-pagination-simple-pager {
38
+ color: #9b9b9b;
39
+ height: 40px;
40
+ border: 1px solid #c8daec;
41
+ margin-inline-end: unset !important;
42
+ padding-inline-end: 8px !important;
43
+
44
+ & > input {
45
+ color: #062a4a;
46
+ font-weight: 600;
47
+ border: 1px solid #c8daec;
48
+ border-radius: 0;
49
+ box-shadow: inset 0 0 2px 2px #eef0f2;
50
+ background-color: #fbfcfd;
51
+
52
+ &:hover {
53
+ border: 1px solid #c8daec;
54
+ }
55
+ }
56
+ }
57
+ }
58
+
59
+ .akinon-select-selector {
60
+ color: #9b9b9b !important;
61
+ }
62
+
63
+ /* override antd style
64
+ apply every direct */
65
+ .akinon-pagination-prev {
66
+ height: 40px !important;
67
+ border: 1px solid #c8daec !important;
68
+ border-right: none !important;
69
+ border-top-right-radius: 0% !important;
70
+ border-bottom-right-radius: 0% !important;
71
+ > * {
72
+ height: inherit !important;
73
+ }
74
+ }
75
+
76
+ .akinon-pagination-next {
77
+ height: 40px !important;
78
+ border: 1px solid #c8daec !important;
79
+ border-left: none !important;
80
+ border-top-left-radius: 0% !important;
81
+ border-bottom-left-radius: 0% !important;
82
+ > * {
83
+ height: inherit !important;
84
+ }
85
+ }
86
+ .akinon-pagination-slash {
87
+ margin-inline-end: 0px;
88
+ margin-inline-start: 12px;
89
+ }
90
+
91
+ .akinon-pagination-options {
92
+ height: 40px !important;
93
+ order: -1 !important; /* Places it at the beginning */
94
+ margin-right: 20px !important;
95
+ }
96
+ }
@@ -0,0 +1,4 @@
1
+ import './index.css';
2
+ import React from 'react';
3
+ export declare const AkitablePagination: () => React.JSX.Element;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Pagination/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,kBAAkB,yBA2B9B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import './index.css';
2
+ import { Pagination } from '@akinon/ui-pagination';
3
+ import React from 'react';
4
+ import { useAkitableContext } from '../../context';
5
+ export const AkitablePagination = () => {
6
+ const { useAkitablePagination } = useAkitableContext();
7
+ const [pagination, setPagination] = useAkitablePagination;
8
+ const handlePaginationChange = (currentPage, pageSize) => {
9
+ setPagination(Object.assign(Object.assign({}, pagination), { currentPage,
10
+ pageSize }));
11
+ };
12
+ return (React.createElement("div", { className: "akitable-pagination-container" },
13
+ React.createElement(Pagination, { className: "akitable-pagination-container__pagination", current: pagination.currentPage, total: pagination.totalDataLength, pageSize: pagination.pageSize, onChange: handlePaginationChange, simple: true, locale: {
14
+ items_per_page: pagination.paginationLabel || 'per page'
15
+ } })));
16
+ };
@@ -0,0 +1,6 @@
1
+ export { AntdTable } from './AntdTable';
2
+ export { AkitableFooter } from './Footer';
3
+ export { AkitableHeader } from './Header';
4
+ export { HeaderActions } from './HeaderActions';
5
+ export { AkitablePagination } from './Pagination';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { AntdTable } from './AntdTable';
2
+ export { AkitableFooter } from './Footer';
3
+ export { AkitableHeader } from './Header';
4
+ export { HeaderActions } from './HeaderActions';
5
+ export { AkitablePagination } from './Pagination';
@@ -0,0 +1,25 @@
1
+ import React, { Dispatch } from 'react';
2
+ import type { AnyObject, HeaderAction, UseAkitablePagination } from '../types';
3
+ type IData = AnyObject;
4
+ export type AkitableContextProviderProps = {
5
+ useAkitablePagination: UseAkitablePagination;
6
+ headerActions?: HeaderAction<IData>[];
7
+ children: React.ReactNode;
8
+ };
9
+ export type AkitableState = {
10
+ selectedRows: IData[];
11
+ };
12
+ export type AkitableAction = {
13
+ type: 'RESET';
14
+ } | {
15
+ type: 'SET_SELECTED_ROWS';
16
+ payload: AkitableState['selectedRows'];
17
+ };
18
+ export type AkitableContext = Omit<AkitableContextProviderProps, 'children'> & {
19
+ state: AkitableState;
20
+ dispatch: Dispatch<AkitableAction>;
21
+ };
22
+ export declare const AkitableContextProvider: ({ useAkitablePagination, headerActions, children }: AkitableContextProviderProps) => React.JSX.Element;
23
+ export declare const useAkitableContext: () => AkitableContext;
24
+ export {};
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,QAAQ,EAAc,MAAM,OAAO,CAAC;AAGnE,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAE/E,KAAK,KAAK,GAAG,SAAS,CAAC;AAMvB,MAAM,MAAM,4BAA4B,GAAG;IACzC,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,aAAa,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,YAAY,EAAE,KAAK,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IACE,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CACxC,CAAC;AAEN,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,4BAA4B,EAAE,UAAU,CAAC,GAAG;IAC7E,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;CACpC,CAAC;AAIF,eAAO,MAAM,uBAAuB,uDAIjC,4BAA4B,sBA8B9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,uBAU9B,CAAC"}
@@ -0,0 +1,30 @@
1
+ import React, { createContext, useContext } from 'react';
2
+ import { useImmerReducer } from 'use-immer';
3
+ const AkitableContext = createContext(undefined);
4
+ export const AkitableContextProvider = ({ useAkitablePagination, headerActions, children }) => {
5
+ const initialState = {
6
+ selectedRows: []
7
+ };
8
+ const [state, dispatch] = useImmerReducer((draft, action) => {
9
+ switch (action.type) {
10
+ case 'RESET':
11
+ return initialState;
12
+ case 'SET_SELECTED_ROWS':
13
+ draft.selectedRows = action.payload;
14
+ return;
15
+ }
16
+ }, initialState);
17
+ return (React.createElement(AkitableContext.Provider, { value: {
18
+ state,
19
+ dispatch,
20
+ useAkitablePagination,
21
+ headerActions
22
+ } }, children));
23
+ };
24
+ export const useAkitableContext = () => {
25
+ const context = useContext(AkitableContext);
26
+ if (context === undefined) {
27
+ throw new Error('useAkitableContext must be used within a AkitableContextProvider');
28
+ }
29
+ return context;
30
+ };
@@ -0,0 +1,28 @@
1
+ .akitable-container {
2
+ border-radius: 10px;
3
+ width: 100%;
4
+
5
+ .row-action {
6
+ width: 40px;
7
+ height: 40px;
8
+ display: flex;
9
+ border: 1px solid rgba(0, 47, 255, 0.273);
10
+ border-radius: 7px;
11
+ align-items: center;
12
+ justify-content: center;
13
+ margin-right: 5px;
14
+
15
+ i:before {
16
+ color: rgba(34, 34, 34, 0.713);
17
+ }
18
+ }
19
+
20
+ .akinon-table-wrapper {
21
+ .akinon-table-thead > tr > th {
22
+ color: var(--color-ebonyClay-375);
23
+ font-size: 0.75rem;
24
+ font-weight: 500;
25
+ padding: 6px 28px;
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,19 @@
1
+ import './index.css';
2
+ import * as React from 'react';
3
+ import type { AntdTableProps } from './components/AntdTable';
4
+ import type { AnyObject, HeaderAction, UseAkitablePagination } from './types';
5
+ export type { AkitablePagination, HeaderAction, UseAkitablePagination } from './types';
6
+ export type AkitableProps<IData> = AntdTableProps<IData> & {
7
+ title: string;
8
+ description: string;
9
+ useAkitablePagination: UseAkitablePagination;
10
+ headerActions?: HeaderAction<IData>[];
11
+ headerMiddleBlock?: React.ReactNode;
12
+ };
13
+ /**
14
+ * Akitable component
15
+ * @param {AkitableProps} props
16
+ * @returns {React.ReactElement}
17
+ */
18
+ export declare const Akitable: <IData extends AnyObject>({ useAkitablePagination, title, description, headerActions, headerMiddleBlock, ...restProps }: AkitableProps<IData>) => React.JSX.Element;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAK7D,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE9E,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,aAAa,CAAC,KAAK,IAAI,cAAc,CAAC,KAAK,CAAC,GAAG;IAEzD,KAAK,EAAE,MAAM,CAAC;IAEd,WAAW,EAAE,MAAM,CAAC;IAEpB,qBAAqB,EAAE,qBAAqB,CAAC;IAE7C,aAAa,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;IAEtC,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACrC,CAAC;AACF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,qKA4FpB,CAAC"}
@@ -0,0 +1,92 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import './index.css';
13
+ import { fontSize, theme } from '@akinon/ui-theme';
14
+ import { ConfigProvider, theme as antdTheme } from 'antd';
15
+ import * as React from 'react';
16
+ import { AkitableFooter, AkitableHeader, AntdTable } from './components';
17
+ import { AkitableContextProvider } from './context';
18
+ /**
19
+ * Akitable component
20
+ * @param {AkitableProps} props
21
+ * @returns {React.ReactElement}
22
+ */
23
+ export const Akitable = (_a) => {
24
+ var { useAkitablePagination, title, description, headerActions, headerMiddleBlock } = _a, restProps = __rest(_a, ["useAkitablePagination", "title", "description", "headerActions", "headerMiddleBlock"]);
25
+ return (React.createElement("div", { className: "akitable-container" },
26
+ React.createElement(ConfigProvider, { prefixCls: "akinon", theme: {
27
+ components: {
28
+ Checkbox: {
29
+ colorBgBase: theme.colors.neutral['50'],
30
+ algorithm: antdTheme.defaultAlgorithm
31
+ },
32
+ Card: {
33
+ paddingLG: 0,
34
+ colorBgContainer: theme.colors.neutral['50'],
35
+ colorBgBase: theme.colors.neutral['50'],
36
+ colorTextBase: theme.colors.neutral['950'],
37
+ algorithm: antdTheme.defaultAlgorithm
38
+ },
39
+ Typography: {
40
+ colorTextHeading: theme.colors.neutral['950'],
41
+ colorText: theme.colors.neutral['500'],
42
+ titleMarginBottom: 0,
43
+ fontWeightStrong: 500
44
+ },
45
+ Select: {
46
+ colorText: theme.colors.neutral['950'],
47
+ selectorBg: theme.colors.neutral['50'],
48
+ colorBgElevated: theme.colors.neutral['100'],
49
+ colorBorder: theme.colors.neutral['350'],
50
+ colorTextQuaternary: theme.colors.neutral['500'],
51
+ optionSelectedBg: theme.colors.azure['100'],
52
+ algorithm: antdTheme.defaultAlgorithm
53
+ },
54
+ Pagination: {
55
+ colorText: theme.colors.neutral['950'],
56
+ itemInputBg: theme.colors.neutral['75'],
57
+ colorBorder: theme.colors.neutral['350'],
58
+ borderRadius: 0,
59
+ itemActiveBg: theme.colors.neutral['500'],
60
+ colorTextDisabled: theme.colors.neutral['375'],
61
+ marginXS: 0,
62
+ itemSizeSM: 38
63
+ },
64
+ Spin: {
65
+ colorBgContainer: theme.colors.neutral['50']
66
+ },
67
+ Table: {
68
+ headerBorderRadius: 0,
69
+ headerBg: theme.colors.neutral['150'],
70
+ headerColor: theme.colors.neutral['500'],
71
+ borderColor: theme.colors.neutral['350'],
72
+ fontSize: fontSize * 0.875,
73
+ colorBgContainer: theme.colors.neutral['50'],
74
+ colorText: theme.colors.neutral['500'],
75
+ cellPaddingInline: 28,
76
+ colorBgBase: theme.colors.neutral['50'],
77
+ algorithm: antdTheme.defaultAlgorithm
78
+ },
79
+ Button: {
80
+ colorBgBase: theme.colors.neutral['50'],
81
+ colorTextBase: theme.colors.azure['500'],
82
+ colorBorder: theme.colors.azure['500'],
83
+ borderColorDisabled: theme.colors.neutral['350'],
84
+ algorithm: antdTheme.defaultAlgorithm
85
+ }
86
+ }
87
+ } },
88
+ React.createElement(AkitableContextProvider, { useAkitablePagination: useAkitablePagination, headerActions: headerActions },
89
+ React.createElement(AkitableHeader, { title: title, description: description, headerMiddleBlock: headerMiddleBlock }),
90
+ React.createElement(AntdTable, Object.assign({}, restProps)),
91
+ React.createElement(AkitableFooter, null)))));
92
+ };
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ export type AkitablePagination = {
3
+ currentPage: number;
4
+ pageSize: number;
5
+ totalDataLength: number;
6
+ paginationLabel?: string;
7
+ };
8
+ export type UseAkitablePagination = [
9
+ AkitablePagination,
10
+ React.Dispatch<React.SetStateAction<AkitablePagination>>
11
+ ];
12
+ export type HeaderAction<IData> = {
13
+ label: string;
14
+ handler: (selectedRows: IData[]) => void;
15
+ disabled?: boolean;
16
+ };
17
+ export type AnyObject = Record<string, any>;
18
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.tsx"],"names":[],"mappings":";AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,kBAAkB;IAClB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;CACzD,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,KAAK,IAAI;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};