@stack-spot/portal-components 2.17.0 → 2.19.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.
- package/CHANGELOG.md +14 -0
- package/dist/components/ContentValidateFilter.d.ts +6 -0
- package/dist/components/ContentValidateFilter.d.ts.map +1 -0
- package/dist/components/ContentValidateFilter.js +8 -0
- package/dist/components/ContentValidateFilter.js.map +1 -0
- package/dist/components/Placeholder.d.ts +1 -0
- package/dist/components/Placeholder.d.ts.map +1 -1
- package/dist/components/Placeholder.js +17 -2
- package/dist/components/Placeholder.js.map +1 -1
- package/dist/components/Select/SelectSearch.d.ts.map +1 -1
- package/dist/components/Select/SelectSearch.js +19 -0
- package/dist/components/Select/SelectSearch.js.map +1 -1
- package/dist/components/Table/HeaderItem.d.ts +18 -0
- package/dist/components/Table/HeaderItem.d.ts.map +1 -0
- package/dist/components/Table/HeaderItem.js +14 -0
- package/dist/components/Table/HeaderItem.js.map +1 -0
- package/dist/components/Table/SettingsVerticalMenu.d.ts +14 -0
- package/dist/components/Table/SettingsVerticalMenu.d.ts.map +1 -0
- package/dist/components/Table/SettingsVerticalMenu.js +14 -0
- package/dist/components/Table/SettingsVerticalMenu.js.map +1 -0
- package/dist/components/Table/StyledLinkTable.d.ts +5 -0
- package/dist/components/Table/StyledLinkTable.d.ts.map +1 -0
- package/dist/components/Table/StyledLinkTable.js +13 -0
- package/dist/components/Table/StyledLinkTable.js.map +1 -0
- package/dist/components/Table/TableData.d.ts +37 -0
- package/dist/components/Table/TableData.d.ts.map +1 -0
- package/dist/components/Table/TableData.js +84 -0
- package/dist/components/Table/TableData.js.map +1 -0
- package/dist/components/Table/index.d.ts +3 -0
- package/dist/components/Table/index.d.ts.map +1 -0
- package/dist/components/Table/index.js +3 -0
- package/dist/components/Table/index.js.map +1 -0
- package/package.json +4 -2
- package/src/components/ContentValidateFilter.tsx +15 -0
- package/src/components/Placeholder.tsx +44 -12
- package/src/components/Select/SelectSearch.tsx +19 -0
- package/src/components/Table/HeaderItem.tsx +52 -0
- package/src/components/Table/SettingsVerticalMenu.tsx +50 -0
- package/src/components/Table/StyledLinkTable.tsx +22 -0
- package/src/components/Table/TableData.tsx +251 -0
- package/src/components/Table/index.tsx +2 -0
- package/tsconfig.json +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.19.0](https://github.com/stack-spot/portal-commons/compare/portal-components@v2.18.0...portal-components@v2.19.0) (2025-04-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* 1448 multiselect ([#913](https://github.com/stack-spot/portal-commons/issues/913)) ([d07a884](https://github.com/stack-spot/portal-commons/commit/d07a8846a6c2b37fd6b58c6febc7fcb0bb682a67))
|
|
9
|
+
|
|
10
|
+
## [2.18.0](https://github.com/stack-spot/portal-commons/compare/portal-components@v2.17.0...portal-components@v2.18.0) (2025-04-07)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add table component and css adjustments in placeholder ([e4fdc1e](https://github.com/stack-spot/portal-commons/commit/e4fdc1efd10fdea20101f3da59610c89e14f0ca8))
|
|
16
|
+
|
|
3
17
|
## [2.17.0](https://github.com/stack-spot/portal-commons/compare/portal-components@v2.16.1...portal-components@v2.17.0) (2025-03-24)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentValidateFilter.d.ts","sourceRoot":"","sources":["../../src/components/ContentValidateFilter.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB,GAAI,uCAInC;IACD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,4CAGA,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { PlaceholderResourceEmptySearch } from './Placeholder.js';
|
|
3
|
+
export const ContentValidateFilter = ({ searchText, listLength, children, }) => {
|
|
4
|
+
if (!listLength && searchText)
|
|
5
|
+
return _jsx(PlaceholderResourceEmptySearch, {});
|
|
6
|
+
return _jsx(_Fragment, { children: children });
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=ContentValidateFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentValidateFilter.js","sourceRoot":"","sources":["../../src/components/ContentValidateFilter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAA;AAE9D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EACpC,UAAU,EACV,UAAU,EACV,QAAQ,GAKT,EAAE,EAAE;IACH,IAAI,CAAC,UAAU,IAAI,UAAU;QAAE,OAAO,KAAC,8BAA8B,KAAG,CAAA;IACxE,OAAO,4BAAG,QAAQ,GAAI,CAAA;AACxB,CAAC,CAAA"}
|
|
@@ -18,5 +18,6 @@ interface PropsCallToAction extends Props {
|
|
|
18
18
|
}
|
|
19
19
|
export declare const Placeholder: ({ title, description, button, img, fullWidth, show, sx, style, className }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
20
20
|
export declare const PlaceholderCallToAction: ({ title, description, subDescription, img, button, fullWidth, show, sx, sxCard, style, className, titleAs, }: PropsCallToAction) => import("react/jsx-runtime").JSX.Element | null;
|
|
21
|
+
export declare const PlaceholderResourceEmptySearch: ({ title, description }: Pick<Props, "title" | "description">) => import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
export {};
|
|
22
23
|
//# sourceMappingURL=Placeholder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Placeholder.d.ts","sourceRoot":"","sources":["../../src/components/Placeholder.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Placeholder.d.ts","sourceRoot":"","sources":["../../src/components/Placeholder.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAInD,UAAU,KAAK;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,iBAAkB,SAAQ,KAAK;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,WAAW,GAAI,4EAAmF,KAAK,mDA2BnH,CAAA;AAED,eAAO,MAAM,uBAAuB,GAAI,8GAarC,iBAAiB,mDAgCnB,CAAA;AAGD,eAAO,MAAM,8BAA8B,GAAI,wBAAwB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAAC,4CAQ1G,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslate } from '@stack-spot/portal-translate';
|
|
2
3
|
import { Box, Flex, Text } from '@citric/core';
|
|
3
4
|
import { Card, CardContent } from '@citric/ui';
|
|
4
5
|
import { GenericPlaceholder } from '../svg/index.js';
|
|
@@ -6,12 +7,26 @@ export const Placeholder = ({ title, description, button, img, fullWidth, show =
|
|
|
6
7
|
if (!show) {
|
|
7
8
|
return null;
|
|
8
9
|
}
|
|
9
|
-
return (_jsx(Card, { sx: { ...(fullWidth ? { w: '100%' } : {}) }, style: style, className: className, children: _jsxs(CardContent, { as: Flex, py:
|
|
10
|
+
return (_jsx(Card, { sx: { ...(fullWidth ? { w: '100%' } : {}) }, style: style, className: className, children: _jsxs(CardContent, { as: Flex, py: 15, sx: { display: 'grid', gridTemplateColumns: '0.6fr 1fr', alignItems: 'center', gap: '92px', ...sx }, children: [_jsx(Box, { sx: { justifySelf: 'end' }, children: img ?? _jsx(GenericPlaceholder, {}) }), _jsxs(Box, { children: [title && _jsx(Text, { as: "label", appearance: "h4", mb: "3", pt: 5, children: title }), _jsx(Text, { mb: "3", appearance: "body2", colorScheme: "light.700", children: description }), button] })] }) }));
|
|
10
11
|
};
|
|
11
12
|
export const PlaceholderCallToAction = ({ title, description, subDescription, img, button, fullWidth, show = true, sx, sxCard, style, className, titleAs, }) => {
|
|
12
13
|
if (!show) {
|
|
13
14
|
return null;
|
|
14
15
|
}
|
|
15
|
-
return (_jsx(Card, { sx: { w: fullWidth ? '100%' : 'auto', bg: 'transparent', ...sxCard }, style: style, className: className, children: _jsxs(CardContent, { as: Flex,
|
|
16
|
+
return (_jsx(Card, { sx: { w: fullWidth ? '100%' : 'auto', bg: 'transparent', ...sxCard }, style: style, className: className, children: _jsxs(CardContent, { as: Flex, py: 15, sx: { display: 'grid', gridTemplateColumns: '0.6fr 1fr', alignItems: 'center', gap: '92px', ...sx }, children: [_jsx(Box, { sx: { justifySelf: 'end' }, children: img ?? _jsx(GenericPlaceholder, {}) }), _jsxs(Box, { children: [title && _jsx(Text, { as: titleAs, appearance: "h4", mb: "3", "aria-live": "assertive", children: title }), _jsx(Text, { mb: "3", appearance: "body2", colorScheme: "light.700", children: description }), _jsx(Text, { mb: "3", appearance: "body2", colorScheme: "light.700", children: subDescription }), button] })] }) }));
|
|
17
|
+
};
|
|
18
|
+
export const PlaceholderResourceEmptySearch = ({ title, description }) => {
|
|
19
|
+
const t = useTranslate(dictionary);
|
|
20
|
+
return (_jsx(PlaceholderCallToAction, { fullWidth: true, title: title || t.title, description: description || t.description }));
|
|
21
|
+
};
|
|
22
|
+
const dictionary = {
|
|
23
|
+
en: {
|
|
24
|
+
title: 'Sorry, your search did not match any results.',
|
|
25
|
+
description: 'Please, refine your search and try again.',
|
|
26
|
+
},
|
|
27
|
+
pt: {
|
|
28
|
+
title: 'Desculpe, sua busca não encontrou nenhum resultado.',
|
|
29
|
+
description: 'Por favor, refine sua busca e tente novamente.',
|
|
30
|
+
},
|
|
16
31
|
};
|
|
17
32
|
//# sourceMappingURL=Placeholder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Placeholder.js","sourceRoot":"","sources":["../../src/components/Placeholder.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAG9C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAoB3C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAS,EAAE,EAAE;IACtH,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,KAAC,IAAI,IAAC,EAAE,EAAE,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,YACnF,MAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"Placeholder.js","s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,MAAM,YAAY,GAAI,oGAQ1B,iBAAiB,
|
|
1
|
+
{"version":3,"file":"SelectSearch.d.ts","sourceRoot":"","sources":["../../../src/components/Select/SelectSearch.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAiC,WAAW,EAAE,MAAM,OAAO,CAAA;AAClE,OAAe,EAAE,UAAU,EAAsB,KAAK,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AAM3F,MAAM,WAAW,iBAAkB,SAAQ,OAAO,CAAC,WAAW,CAAC;IAC7D,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC,OAAO,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACpC,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;CACxB;AAmBD,eAAO,MAAM,YAAY,GAAI,oGAQ1B,iBAAiB,4CAiInB,CAAA"}
|
|
@@ -106,6 +106,25 @@ export const SelectSearch = ({ options, components: customComponents = {}, onCha
|
|
|
106
106
|
},
|
|
107
107
|
...customStyles?.menuList?.(base, state),
|
|
108
108
|
}),
|
|
109
|
+
multiValue: (base, state) => ({
|
|
110
|
+
...base,
|
|
111
|
+
background: 'transparent',
|
|
112
|
+
alignItems: 'center',
|
|
113
|
+
...customStyles?.multiValue?.(base, state),
|
|
114
|
+
}),
|
|
115
|
+
multiValueRemove: (base, state) => ({
|
|
116
|
+
...base,
|
|
117
|
+
backgroundColor: 'transparent',
|
|
118
|
+
'&:hover': {
|
|
119
|
+
backgroundColor: 'transparent',
|
|
120
|
+
},
|
|
121
|
+
...customStyles?.multiValueRemove?.(base, state),
|
|
122
|
+
}),
|
|
123
|
+
noOptionsMessage: (base, state) => ({
|
|
124
|
+
...base,
|
|
125
|
+
backgroundColor: theme.color.light[300],
|
|
126
|
+
...customStyles?.noOptionsMessage?.(base, state),
|
|
127
|
+
}),
|
|
109
128
|
}, components: {
|
|
110
129
|
...components,
|
|
111
130
|
DropdownIndicator,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectSearch.js","sourceRoot":"","sources":["../../../src/components/Select/SelectSearch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEvE,OAAO,MAAM,EAAE,EAAE,UAAU,EAA4C,MAAM,cAAc,CAAA;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAUvC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,mBAAK,CAAA;AAElC,MAAM,iBAAiB,GAAuE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,OAAO,mBACnG,MAAM,EAClB,SAAS,EAAC,SAAS,EACnB,EAAE,EAAE;QACF,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,KAAK;QACb,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,wBAAwB;QACpC,SAAS,EAAE,UAAU,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM;KACtE,YAED,KAAC,WAAW,KAAG,GACP,CAAA;AAEV,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,OAAO,EACP,UAAU,EAAE,gBAAgB,GAAG,EAAE,EACjC,QAAQ,EACR,MAAM,EAAE,YAAY,GAAG,EA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eAAe,EAAE,aAAa;gBAC9B,SAAS,EAAE;oBACT,eAAe,EAAE,aAAa;iBAC/B;gBACD,GAAG,YAAY,EAAE,gBAAgB,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;aACjD,CAAC;YACF,gBAAgB,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;gBAClC,GAAG,IAAI;gBACP,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;gBACvC,GAAG,YAAY,EAAE,gBAAgB,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;aACjD,CAAC;SACH,EACD,UAAU,EAAE;YACV,GAAG,UAAU;YACb,iBAAiB;YACjB,kBAAkB,EAAE,cAAc;YAClC,mBAAmB,EAAE,SAAS;YAC9B,eAAe,EAAE,SAAS;YAC1B,gBAAgB,EAAE,SAAS;YAC3B,cAAc,EAAE,UAAU;YAC1B,GAAG,gBAAgB;SACpB,GACD,CACH,CAAA;AACH,CAAC,CAAA;AAKD,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,SAAS,EAAE,YAAY;KACxB;IACD,EAAE,EAAE;QACF,SAAS,EAAE,YAAY;KACxB;CACmB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Flex } from '@citric/core';
|
|
2
|
+
import { Props as FlexProps } from '@citric/core/dist/Flex.js';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
export type SortTypes = 'ASC' | 'DESC' | undefined;
|
|
5
|
+
interface HeaderSortProps extends FlexProps {
|
|
6
|
+
children: ReactNode | string;
|
|
7
|
+
sortType: SortTypes;
|
|
8
|
+
onSort: (sortType: SortTypes) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const parseParams: ({ key, sort }: {
|
|
11
|
+
key: string | undefined;
|
|
12
|
+
sort: "ASC" | "DESC" | undefined;
|
|
13
|
+
}) => string | undefined;
|
|
14
|
+
export declare const HeaderSort: React.FC<HeaderSortProps>;
|
|
15
|
+
type FullFlexProps = Parameters<typeof Flex>[0];
|
|
16
|
+
export declare const Header: React.FC<FullFlexProps>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=HeaderItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderItem.d.ts","sourceRoot":"","sources":["../../../src/components/Table/HeaderItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,IAAI,EAAyB,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAE3D,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAExC,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAA;AAElD,UAAU,eAAgB,SAAQ,SAAS;IACzC,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,IAAI,CAAC;CACvC;AAED,eAAO,MAAM,WAAW,GAAI,eAAe;IAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,uBAC9B,CAAA;AAU1E,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAiBhD,CAAA;AAED,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AAE/C,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAM1C,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Flex, IconBox, Text } from '@citric/core';
|
|
3
|
+
import { SortAscending, SortDescending } from '@citric/icons';
|
|
4
|
+
export const parseParams = ({ key, sort }) => key && sort ? `${key?.toUpperCase()}_${sort?.toUpperCase()}` : undefined;
|
|
5
|
+
function next(current) {
|
|
6
|
+
switch (current) {
|
|
7
|
+
case undefined: return 'ASC';
|
|
8
|
+
case 'ASC': return 'DESC';
|
|
9
|
+
case 'DESC': return undefined;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export const HeaderSort = ({ children, sortType, onSort, ...props }) => (_jsxs(Flex, { as: Button, appearance: "text", alignItems: "center", flexWrap: "nowrap", sx: { '&:hover, &:active, &:focus': { borderColor: 'transparent' }, padding: 0 }, onClick: () => onSort(next(sortType)), ...props, children: [_jsx(Text, { appearance: "microtext1", mr: "2", colorScheme: "light.700", children: children }), _jsxs(IconBox, { colorIcon: "inverse.500", size: "xs", children: [sortType === 'ASC' && _jsx(SortAscending, {}), sortType === 'DESC' && _jsx(SortDescending, {})] })] }));
|
|
13
|
+
export const Header = ({ children, ...props }) => (_jsx(Flex, { alignItems: "center", ...props, children: _jsx(Text, { appearance: "microtext1", mr: "2", colorScheme: "light.700", children: children }) }));
|
|
14
|
+
//# sourceMappingURL=HeaderItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderItem.js","sourceRoot":"","sources":["../../../src/components/Table/HeaderItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAU,IAAI,EAAE,MAAM,cAAc,CAAA;AAElE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAW7D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,EAAiE,EAAE,EAAE,CAC1G,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AAE1E,SAAS,IAAI,CAAC,OAAkB;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|
|
|
1
|
+
import { OneOfIconSizes } from '@citric/core';
|
|
2
|
+
import { SxProperties } from '@citric/core/dist/sx.js';
|
|
3
|
+
import { SelectionList } from '@stack-spot/portal-components/SelectionList';
|
|
4
|
+
interface SettingsVerticalMenuProps {
|
|
5
|
+
id: string;
|
|
6
|
+
buttonAriaLabel?: string;
|
|
7
|
+
size?: OneOfIconSizes;
|
|
8
|
+
sxIconButton?: SxProperties;
|
|
9
|
+
buttonDataTestHint?: string;
|
|
10
|
+
items: React.ComponentProps<typeof SelectionList>['items'];
|
|
11
|
+
}
|
|
12
|
+
export declare const SettingsVerticalMenu: ({ id, buttonAriaLabel, size, buttonDataTestHint, sxIconButton, items }: SettingsVerticalMenuProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=SettingsVerticalMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsVerticalMenu.d.ts","sourceRoot":"","sources":["../../../src/components/Table/SettingsVerticalMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGnD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAA;AAG3E,UAAU,yBAAyB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC;CAC5D;AAED,eAAO,MAAM,oBAAoB,GAAI,wEAMrB,yBAAyB,mDA2BxC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, IconBox } from '@citric/core';
|
|
3
|
+
import { EllipsisVertical } from '@citric/icons';
|
|
4
|
+
import { IconButton } from '@citric/ui';
|
|
5
|
+
import { SelectionList } from '@stack-spot/portal-components/SelectionList';
|
|
6
|
+
import { useState } from 'react';
|
|
7
|
+
export const SettingsVerticalMenu = ({ id, buttonAriaLabel, size, buttonDataTestHint, sxIconButton, items = [] }) => {
|
|
8
|
+
const [visibleMenu, setVisibleMenu] = useState(false);
|
|
9
|
+
if (items?.length === 0) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return (_jsxs(Box, { sx: { position: 'relative' }, children: [_jsx(IconButton, { role: "button", title: buttonAriaLabel, "data-test-hint": buttonDataTestHint, "aria-label": buttonAriaLabel, onClick: () => setVisibleMenu(state => !state), children: _jsx(IconBox, { size: size, sx: sxIconButton, children: _jsx(EllipsisVertical, {}) }) }), _jsx(SelectionList, { id: id, visible: visibleMenu, onHide: () => setVisibleMenu(false), style: { position: 'absolute', top: 40, right: 0, minWidth: '200px' }, items: items })] }));
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=SettingsVerticalMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsVerticalMenu.js","sourceRoot":"","sources":["../../../src/components/Table/SettingsVerticalMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAkB,MAAM,cAAc,CAAA;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAA;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAWhC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,EAAE,EACF,eAAe,EACf,IAAI,EACJ,kBAAkB,EA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@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { useAnchorTag } from '../../context/anchor.js';
|
|
4
|
+
const StyledLink = styled.a `
|
|
5
|
+
&:hover {
|
|
6
|
+
text-decoration: underline;
|
|
7
|
+
}
|
|
8
|
+
`;
|
|
9
|
+
export const StyledLinkTable = ({ children, ...props }) => {
|
|
10
|
+
const Link = useAnchorTag();
|
|
11
|
+
return (_jsx(StyledLink, { as: Link, ...props, children: children }));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=StyledLinkTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StyledLinkTable.js","sourceRoot":"","sources":["../../../src/components/Table/StyledLinkTable.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAA;;;;CAI1B,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,QAAQ,EACR,GAAG,KAAK,EACgE,EAAE,EAAE;IAC5E,MAAM,IAAI,GAAG,YAAY,EAAE,CAAA;IAE3B,OAAO,CACL,KAAC,UAAU,IAAC,EAAE,EAAE,IAAI,KAAM,KAAK,YAC5B,QAAQ,GACE,CACd,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SxProperties } from '@citric/core/dist/sx.js';
|
|
2
|
+
import { SelectionList } from '@stack-spot/portal-components/SelectionList';
|
|
3
|
+
import { SortTypes } from './HeaderItem.js';
|
|
4
|
+
export type TableColumnsDefault = 'name' | 'description';
|
|
5
|
+
export type ColumnDefinition<T, K extends keyof T> = {
|
|
6
|
+
key: K;
|
|
7
|
+
header: string;
|
|
8
|
+
sortable?: boolean;
|
|
9
|
+
customRender?: (data: T) => JSX.Element | string | null;
|
|
10
|
+
sx?: SxProperties;
|
|
11
|
+
width?: string;
|
|
12
|
+
};
|
|
13
|
+
type SortDetailsType<T, K extends keyof T> = {
|
|
14
|
+
sort: K;
|
|
15
|
+
direction: SortTypes;
|
|
16
|
+
index?: number;
|
|
17
|
+
};
|
|
18
|
+
type TableProps<T, K extends keyof T> = {
|
|
19
|
+
data: T[];
|
|
20
|
+
columns: ColumnDefinition<T, K>[];
|
|
21
|
+
onSort?: ({ sort, direction, index }: SortDetailsType<T, K>) => void;
|
|
22
|
+
onRemove?: (data: T) => void;
|
|
23
|
+
canRemove?: (row: T) => boolean;
|
|
24
|
+
tableAppearance?: 'striped' | 'filled';
|
|
25
|
+
options?: React.ComponentProps<typeof SelectionList>['items'];
|
|
26
|
+
sxHeader?: SxProperties;
|
|
27
|
+
hasHeaderBorder?: boolean;
|
|
28
|
+
searchParamName?: string;
|
|
29
|
+
initialSortDetails?: Omit<SortDetailsType<T, K>, 'sort'>;
|
|
30
|
+
/**
|
|
31
|
+
* Accepts a react element that is rendered below the table, used mostly for pagination.
|
|
32
|
+
*/
|
|
33
|
+
afterContent?: React.ReactElement;
|
|
34
|
+
};
|
|
35
|
+
export declare const TableData: <T, K extends keyof T>({ data, columns, onSort, onRemove, canRemove, tableAppearance, options, sxHeader, hasHeaderBorder, searchParamName, initialSortDetails, afterContent, }: TableProps<T, K>) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=TableData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableData.d.ts","sourceRoot":"","sources":["../../../src/components/Table/TableData.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGnD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAA;AAM3E,OAAO,EAAc,SAAS,EAAE,MAAM,cAAc,CAAA;AAGpD,MAAM,MAAM,mBAAmB,GAAG,MAAM,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AAC;IACzB,kBAAkB,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACzD;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;CACnC,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,yJAa7C,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,4CAmClB,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button, IconBox, Text } from '@citric/core';
|
|
3
|
+
import { Trash } from '@citric/icons';
|
|
4
|
+
import { LoadingCircular, Table, Tbody, Td, Th, Thead, Tr } from '@citric/ui';
|
|
5
|
+
import { theme } from '@stack-spot/portal-theme';
|
|
6
|
+
import { useTranslate } from '@stack-spot/portal-translate';
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { ContentValidateFilter } from '../ContentValidateFilter.js';
|
|
10
|
+
import { HeaderSort } from './HeaderItem.js';
|
|
11
|
+
import { SettingsVerticalMenu } from './SettingsVerticalMenu.js';
|
|
12
|
+
const StyledTh = styled(Th) `
|
|
13
|
+
border-top: ${({ $hasBorder }) => ($hasBorder ? `1px solid ${theme.color.light[400]}` : '')};
|
|
14
|
+
border-bottom: ${({ $hasBorder }) => ($hasBorder ? `1px solid ${theme.color.light[400]}` : '')};
|
|
15
|
+
&:first-child {
|
|
16
|
+
border-left: ${({ $hasBorder }) => ($hasBorder ? `1px solid ${theme.color.light[400]}` : '')};
|
|
17
|
+
border-top-left-radius: 4px;
|
|
18
|
+
border-bottom-left-radius: 4px;
|
|
19
|
+
}
|
|
20
|
+
&:last-child {
|
|
21
|
+
border-right: ${({ $hasBorder }) => ($hasBorder ? `1px solid ${theme.color.light[400]}` : '')};
|
|
22
|
+
border-top-right-radius: 4px;
|
|
23
|
+
border-bottom-right-radius: 4px;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const StyledTd = styled(Td) `
|
|
27
|
+
border-radius: 0px !important;
|
|
28
|
+
|
|
29
|
+
&:first-child {
|
|
30
|
+
border-top-left-radius: 4px !important;
|
|
31
|
+
border-bottom-left-radius: 4px !important;
|
|
32
|
+
}
|
|
33
|
+
&:last-child {
|
|
34
|
+
border-top-right-radius: 4px !important;
|
|
35
|
+
border-bottom-right-radius: 4px !important;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
const TableHeader = ({ columns, onSort, onRemove, sxTh, hasBorder, initialSortDetails }) => {
|
|
39
|
+
const [sort, setSort] = useState(initialSortDetails?.direction);
|
|
40
|
+
const [activeSort, setActiveSort] = useState(initialSortDetails?.index);
|
|
41
|
+
const Sortable = ({ sort, direction, index }) => {
|
|
42
|
+
onSort?.({ sort, direction, index });
|
|
43
|
+
setSort(direction);
|
|
44
|
+
setActiveSort(index);
|
|
45
|
+
};
|
|
46
|
+
return (_jsx(Thead, { children: _jsxs(Tr, { children: [columns.map((column, index) => column?.sortable && onSort ? (_jsx(StyledTh, { sx: sxTh, "$hasBorder": hasBorder, children: _jsx(HeaderSort, { sortType: activeSort !== index ? undefined : sort, onSort: (sortType) => Sortable?.({ sort: column.key, direction: sortType, index }), children: column.header }) }, column.key.toString())) : (_jsx(StyledTh, { sx: sxTh, "$hasBorder": hasBorder, children: _jsx(Text, { appearance: "microtext1", mr: "2", children: column.header }) }, column.key.toString()))), onRemove && _jsx(Th, {})] }) }));
|
|
47
|
+
};
|
|
48
|
+
function RemoveButton({ row, onRemove, canRemove }) {
|
|
49
|
+
const t = useTranslate(dictionary);
|
|
50
|
+
const [isLoading, setLoading] = useState(false);
|
|
51
|
+
if (!onRemove || (canRemove && !canRemove(row))) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const handleRemove = async () => {
|
|
55
|
+
if (isLoading)
|
|
56
|
+
return;
|
|
57
|
+
setLoading(true);
|
|
58
|
+
try {
|
|
59
|
+
await onRemove(row);
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
setLoading(false);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
return (_jsx(Button, { colorScheme: "danger", onClick: handleRemove, size: "sm", children: isLoading ? _jsx(LoadingCircular, {}) : _jsxs(_Fragment, { children: [_jsx(IconBox, { size: "xs", mr: 2, colorIcon: "danger", children: _jsx(Trash, {}) }), _jsx(Text, { appearance: "microtext1", mr: "2", children: t.remove })] }) }));
|
|
66
|
+
}
|
|
67
|
+
const TableRows = ({ data, columns, options, onRemove, canRemove }) => {
|
|
68
|
+
const rows = data.map((row, index) => (_jsxs(Tr, { children: [columns.map((column, columnIndex) => (_jsx(StyledTd, { sx: { ...column.sx }, children: _jsxs(_Fragment, { children: [" ", column?.customRender ? column.customRender(row) : row[column.key]] }) }, columnIndex))), canRemove && _jsx(StyledTd, { children: _jsx(RemoveButton, { row: row, onRemove: onRemove, canRemove: canRemove }) }), options && _jsx(StyledTd, { children: _jsx(SettingsVerticalMenu, { id: "workflow-studio-menu", items: options, size: "xs" }) })] }, `row-${index}`)));
|
|
69
|
+
return _jsx(Tbody, { sx: { borderSpacing: '0 8px' }, children: rows });
|
|
70
|
+
};
|
|
71
|
+
export const TableData = ({ data, columns, onSort, onRemove, canRemove, tableAppearance = 'striped', options, sxHeader, hasHeaderBorder, searchParamName = 'search', initialSortDetails, afterContent, }) => {
|
|
72
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
73
|
+
const search = searchParams.get(searchParamName) ?? '';
|
|
74
|
+
return (_jsx(ContentValidateFilter, { listLength: data.length, searchText: search, children: !!data.length && (_jsxs(_Fragment, { children: [_jsxs(Table, { appearance: tableAppearance, sx: { mb: 5 }, children: [_jsx("colgroup", { children: columns.map((column, index) => (_jsx("col", { style: { width: column.width || 'auto' } }, index))) }), _jsx(TableHeader, { sxTh: sxHeader, columns: columns, onSort: onSort, onRemove: onRemove, hasBorder: tableAppearance === 'striped' ? false : hasHeaderBorder, initialSortDetails: initialSortDetails }), _jsx(TableRows, { data: data, columns: columns, onRemove: onRemove, canRemove: canRemove, options: options })] }), !!afterContent && afterContent] })) }));
|
|
75
|
+
};
|
|
76
|
+
const dictionary = {
|
|
77
|
+
en: {
|
|
78
|
+
remove: 'Remove',
|
|
79
|
+
},
|
|
80
|
+
pt: {
|
|
81
|
+
remove: 'Remover',
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=TableData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableData.js","sourceRoot":"","sources":["../../../src/components/Table/TableData.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAE7E,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,EAAE,UAAU,EAAa,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AA4B7D,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,CAA0B;gBACrC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,KAAK,CAAC,KAAK,CAAC,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AAC,GACO,EACX,KAAC,WAAW,IACV,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,EAClE,kBAAkB,EAAE,kBAAkB,GACtC,EACF,KAAC,SAAS,IACR,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,GAChB,IACI,EACP,CAAC,CAAC,YAAY,IAAI,YAAY,IAC9B,CACJ,GACqB,CACzB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,MAAM,EAAE,QAAQ;KACjB;IACD,EAAE,EAAE;QACF,MAAM,EAAE,SAAS;KAClB;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Table/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Table/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAoB,MAAM,oBAAoB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/portal-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
"./Select": "./dist/components/form/Select/index.js",
|
|
25
25
|
"./Stepper": "./dist/components/Stepper/index.js",
|
|
26
26
|
"./FileTreeView": "./dist/components/FileTreeView/index.js",
|
|
27
|
-
"./FadingOverflow": "./dist/components/FadingOverflow.js"
|
|
27
|
+
"./FadingOverflow": "./dist/components/FadingOverflow.js",
|
|
28
|
+
"./Table": "./dist/components/Table/index.js",
|
|
29
|
+
"./ContentValidateFilter": "./dist/components/ContentValidateFilter.js"
|
|
28
30
|
},
|
|
29
31
|
"scripts": {
|
|
30
32
|
"build": "rimraf dist && tsc && tsc-esm-fix --target='dist'",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PlaceholderResourceEmptySearch } from './Placeholder'
|
|
2
|
+
|
|
3
|
+
export const ContentValidateFilter = ({
|
|
4
|
+
searchText,
|
|
5
|
+
listLength,
|
|
6
|
+
children,
|
|
7
|
+
}: {
|
|
8
|
+
searchText?: string,
|
|
9
|
+
listLength: number,
|
|
10
|
+
children: React.ReactNode,
|
|
11
|
+
}) => {
|
|
12
|
+
if (!listLength && searchText) return <PlaceholderResourceEmptySearch />
|
|
13
|
+
return <>{children}</>
|
|
14
|
+
}
|
|
15
|
+
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
1
2
|
import { Box, Flex, Text } from '@citric/core'
|
|
2
3
|
import { AsProp } from '@citric/core/dist/forward-ref-as'
|
|
3
4
|
import { SxProperties } from '@citric/core/dist/sx'
|
|
@@ -29,18 +30,23 @@ export const Placeholder = ({ title, description, button, img, fullWidth, show =
|
|
|
29
30
|
|
|
30
31
|
return (
|
|
31
32
|
<Card sx={{ ...(fullWidth ? { w: '100%' } : {}) }} style={style} className={className}>
|
|
32
|
-
<CardContent
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
</
|
|
33
|
+
<CardContent
|
|
34
|
+
as={Flex}
|
|
35
|
+
py={15}
|
|
36
|
+
sx={{ display: 'grid', gridTemplateColumns: '0.6fr 1fr', alignItems: 'center', gap: '92px', ...sx }}
|
|
37
|
+
>
|
|
38
|
+
<Box sx={{ justifySelf: 'end' }}>{img ?? <GenericPlaceholder />}</Box>
|
|
39
|
+
<Box>
|
|
40
|
+
{title && <Text as="label" appearance="h4" mb="3" pt={5}>
|
|
41
|
+
{title}
|
|
42
|
+
</Text>}
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
<Text mb="3" appearance="body2" colorScheme="light.700">
|
|
45
|
+
{description}
|
|
46
|
+
</Text>
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
{button}
|
|
49
|
+
</Box>
|
|
44
50
|
</CardContent>
|
|
45
51
|
</Card>
|
|
46
52
|
)
|
|
@@ -66,8 +72,12 @@ export const PlaceholderCallToAction = ({
|
|
|
66
72
|
|
|
67
73
|
return (
|
|
68
74
|
<Card sx={{ w: fullWidth ? '100%' : 'auto', bg: 'transparent', ...sxCard }} style={style} className={className}>
|
|
69
|
-
<CardContent
|
|
70
|
-
{
|
|
75
|
+
<CardContent
|
|
76
|
+
as={Flex}
|
|
77
|
+
py={15}
|
|
78
|
+
sx={{ display: 'grid', gridTemplateColumns: '0.6fr 1fr', alignItems: 'center', gap: '92px', ...sx }}
|
|
79
|
+
>
|
|
80
|
+
<Box sx={{ justifySelf: 'end' }}>{img ?? <GenericPlaceholder />}</Box>
|
|
71
81
|
|
|
72
82
|
<Box>
|
|
73
83
|
{title && <Text as={titleAs} appearance="h4" mb="3" aria-live="assertive">
|
|
@@ -88,3 +98,25 @@ export const PlaceholderCallToAction = ({
|
|
|
88
98
|
</Card>
|
|
89
99
|
)
|
|
90
100
|
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
export const PlaceholderResourceEmptySearch = ({ title, description }: Pick<Props, 'title' | 'description'>) => {
|
|
104
|
+
const t = useTranslate(dictionary)
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<PlaceholderCallToAction fullWidth={true}
|
|
108
|
+
title={title || t.title} description={description || t.description}
|
|
109
|
+
/>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const dictionary = {
|
|
114
|
+
en: {
|
|
115
|
+
title: 'Sorry, your search did not match any results.',
|
|
116
|
+
description: 'Please, refine your search and try again.',
|
|
117
|
+
},
|
|
118
|
+
pt: {
|
|
119
|
+
title: 'Desculpe, sua busca não encontrou nenhum resultado.',
|
|
120
|
+
description: 'Por favor, refine sua busca e tente novamente.',
|
|
121
|
+
},
|
|
122
|
+
} satisfies Dictionary
|
|
@@ -139,6 +139,25 @@ export const SelectSearch = ({
|
|
|
139
139
|
},
|
|
140
140
|
...customStyles?.menuList?.(base, state),
|
|
141
141
|
}),
|
|
142
|
+
multiValue: (base, state) => ({
|
|
143
|
+
...base,
|
|
144
|
+
background: 'transparent',
|
|
145
|
+
alignItems: 'center',
|
|
146
|
+
...customStyles?.multiValue?.(base, state),
|
|
147
|
+
}),
|
|
148
|
+
multiValueRemove: (base, state) => ({
|
|
149
|
+
...base,
|
|
150
|
+
backgroundColor: 'transparent',
|
|
151
|
+
'&:hover': {
|
|
152
|
+
backgroundColor: 'transparent',
|
|
153
|
+
},
|
|
154
|
+
...customStyles?.multiValueRemove?.(base, state),
|
|
155
|
+
}),
|
|
156
|
+
noOptionsMessage: (base, state) => ({
|
|
157
|
+
...base,
|
|
158
|
+
backgroundColor: theme.color.light[300],
|
|
159
|
+
...customStyles?.noOptionsMessage?.(base, state),
|
|
160
|
+
}),
|
|
142
161
|
}}
|
|
143
162
|
components={{
|
|
144
163
|
...components,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Button, Flex, IconBox, Styles, Text } from '@citric/core'
|
|
2
|
+
import { Props as FlexProps } from '@citric/core/dist/Flex'
|
|
3
|
+
import { SortAscending, SortDescending } from '@citric/icons'
|
|
4
|
+
import React, { ReactNode } from 'react'
|
|
5
|
+
|
|
6
|
+
export type SortTypes = 'ASC' | 'DESC' | undefined
|
|
7
|
+
|
|
8
|
+
interface HeaderSortProps extends FlexProps {
|
|
9
|
+
children: ReactNode | string,
|
|
10
|
+
sortType: SortTypes,
|
|
11
|
+
onSort: (sortType: SortTypes) => void,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const parseParams = ({ key, sort }: { key: string | undefined, sort: 'ASC' | 'DESC' | undefined }) =>
|
|
15
|
+
key && sort ? `${key?.toUpperCase()}_${sort?.toUpperCase()}` : undefined
|
|
16
|
+
|
|
17
|
+
function next(current: SortTypes) {
|
|
18
|
+
switch (current) {
|
|
19
|
+
case undefined: return 'ASC'
|
|
20
|
+
case 'ASC': return 'DESC'
|
|
21
|
+
case 'DESC': return undefined
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const HeaderSort: React.FC<HeaderSortProps> = ({ children, sortType, onSort, ...props }) => (
|
|
26
|
+
<Flex
|
|
27
|
+
as={Button}
|
|
28
|
+
appearance="text"
|
|
29
|
+
alignItems="center"
|
|
30
|
+
flexWrap="nowrap"
|
|
31
|
+
sx={{ '&:hover, &:active, &:focus': { borderColor: 'transparent' }, padding: 0 } as Styles}
|
|
32
|
+
onClick={() => onSort(next(sortType))} {...props}>
|
|
33
|
+
<Text appearance="microtext1" mr="2" colorScheme="light.700">
|
|
34
|
+
{children}
|
|
35
|
+
</Text>
|
|
36
|
+
|
|
37
|
+
<IconBox colorIcon="inverse.500" size="xs">
|
|
38
|
+
{sortType === 'ASC' && <SortAscending />}
|
|
39
|
+
{sortType === 'DESC' && <SortDescending />}
|
|
40
|
+
</IconBox>
|
|
41
|
+
</Flex>
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
type FullFlexProps = Parameters<typeof Flex>[0]
|
|
45
|
+
|
|
46
|
+
export const Header: React.FC<FullFlexProps> = ({ children, ...props }) => (
|
|
47
|
+
<Flex alignItems="center" {...props}>
|
|
48
|
+
<Text appearance="microtext1" mr="2" colorScheme="light.700">
|
|
49
|
+
{children}
|
|
50
|
+
</Text>
|
|
51
|
+
</Flex>
|
|
52
|
+
)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Box, IconBox, OneOfIconSizes } from '@citric/core'
|
|
2
|
+
import { SxProperties } from '@citric/core/dist/sx'
|
|
3
|
+
import { EllipsisVertical } from '@citric/icons'
|
|
4
|
+
import { IconButton } from '@citric/ui'
|
|
5
|
+
import { SelectionList } from '@stack-spot/portal-components/SelectionList'
|
|
6
|
+
import { useState } from 'react'
|
|
7
|
+
|
|
8
|
+
interface SettingsVerticalMenuProps {
|
|
9
|
+
id: string,
|
|
10
|
+
buttonAriaLabel?: string,
|
|
11
|
+
size?: OneOfIconSizes,
|
|
12
|
+
sxIconButton?: SxProperties,
|
|
13
|
+
buttonDataTestHint?: string,
|
|
14
|
+
items: React.ComponentProps<typeof SelectionList>['items'],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const SettingsVerticalMenu = ({
|
|
18
|
+
id,
|
|
19
|
+
buttonAriaLabel,
|
|
20
|
+
size,
|
|
21
|
+
buttonDataTestHint,
|
|
22
|
+
sxIconButton,
|
|
23
|
+
items = [] }: SettingsVerticalMenuProps) => {
|
|
24
|
+
const [visibleMenu, setVisibleMenu] = useState(false)
|
|
25
|
+
if (items?.length === 0) {
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Box sx={{ position: 'relative' }}>
|
|
31
|
+
<IconButton
|
|
32
|
+
role="button"
|
|
33
|
+
title={buttonAriaLabel}
|
|
34
|
+
data-test-hint={buttonDataTestHint}
|
|
35
|
+
aria-label={buttonAriaLabel}
|
|
36
|
+
onClick={() => setVisibleMenu(state => !state)} >
|
|
37
|
+
<IconBox size={size} sx={sxIconButton}>
|
|
38
|
+
<EllipsisVertical />
|
|
39
|
+
</IconBox>
|
|
40
|
+
</IconButton>
|
|
41
|
+
<SelectionList
|
|
42
|
+
id={id}
|
|
43
|
+
visible={visibleMenu}
|
|
44
|
+
onHide={() => setVisibleMenu(false)}
|
|
45
|
+
style={{ position: 'absolute', top: 40, right: 0, minWidth: '200px' }}
|
|
46
|
+
items={items}
|
|
47
|
+
/>
|
|
48
|
+
</Box>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
import { ReactNode } from 'react'
|
|
3
|
+
import { useAnchorTag } from '../../context/anchor'
|
|
4
|
+
|
|
5
|
+
const StyledLink = styled.a`
|
|
6
|
+
&:hover {
|
|
7
|
+
text-decoration: underline;
|
|
8
|
+
}
|
|
9
|
+
`
|
|
10
|
+
|
|
11
|
+
export const StyledLinkTable = ({
|
|
12
|
+
children,
|
|
13
|
+
...props
|
|
14
|
+
}: { children: ReactNode } & React.AnchorHTMLAttributes<HTMLAnchorElement>) => {
|
|
15
|
+
const Link = useAnchorTag()
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<StyledLink as={Link} {...props}>
|
|
19
|
+
{children}
|
|
20
|
+
</StyledLink>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { Button, IconBox, Text } from '@citric/core'
|
|
2
|
+
import { SxProperties } from '@citric/core/dist/sx'
|
|
3
|
+
import { Trash } from '@citric/icons'
|
|
4
|
+
import { LoadingCircular, Table, Tbody, Td, Th, Thead, Tr } from '@citric/ui'
|
|
5
|
+
import { SelectionList } from '@stack-spot/portal-components/SelectionList'
|
|
6
|
+
import { theme } from '@stack-spot/portal-theme'
|
|
7
|
+
import { useTranslate } from '@stack-spot/portal-translate'
|
|
8
|
+
import { useState } from 'react'
|
|
9
|
+
import styled from 'styled-components'
|
|
10
|
+
import { ContentValidateFilter } from '../ContentValidateFilter'
|
|
11
|
+
import { HeaderSort, SortTypes } from './HeaderItem'
|
|
12
|
+
import { SettingsVerticalMenu } from './SettingsVerticalMenu'
|
|
13
|
+
|
|
14
|
+
export type TableColumnsDefault = 'name' | 'description'
|
|
15
|
+
|
|
16
|
+
export type ColumnDefinition<T, K extends keyof T> = {
|
|
17
|
+
key: K,
|
|
18
|
+
header: string,
|
|
19
|
+
sortable?: boolean,
|
|
20
|
+
customRender?: (data: T) => JSX.Element | string | null,
|
|
21
|
+
sx?: SxProperties,
|
|
22
|
+
width?: string,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type SortDetailsType<T, K extends keyof T> = {
|
|
26
|
+
sort: K,
|
|
27
|
+
direction: SortTypes,
|
|
28
|
+
index?: number,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type TableHeaderProps<T, K extends keyof T> = {
|
|
32
|
+
columns: ColumnDefinition<T, K>[],
|
|
33
|
+
onSort?: ({ sort, direction, index }: SortDetailsType<T, K>) => void,
|
|
34
|
+
onRemove?: (row: T) => void,
|
|
35
|
+
sxTh?: SxProperties,
|
|
36
|
+
hasBorder?: boolean,
|
|
37
|
+
initialSortDetails?: Omit<SortDetailsType<T, K>, 'sort'>,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const StyledTh = styled(Th)<{ $hasBorder?: boolean }>`
|
|
41
|
+
border-top: ${({ $hasBorder }) => ($hasBorder ? `1px solid ${theme.color.light[400]}` : '')};
|
|
42
|
+
border-bottom: ${({ $hasBorder }) => ($hasBorder ? `1px solid ${theme.color.light[400]}` : '')};
|
|
43
|
+
&:first-child {
|
|
44
|
+
border-left: ${({ $hasBorder }) => ($hasBorder ? `1px solid ${theme.color.light[400]}` : '')};
|
|
45
|
+
border-top-left-radius: 4px;
|
|
46
|
+
border-bottom-left-radius: 4px;
|
|
47
|
+
}
|
|
48
|
+
&:last-child {
|
|
49
|
+
border-right: ${({ $hasBorder }) => ($hasBorder ? `1px solid ${theme.color.light[400]}` : '')};
|
|
50
|
+
border-top-right-radius: 4px;
|
|
51
|
+
border-bottom-right-radius: 4px;
|
|
52
|
+
}
|
|
53
|
+
`
|
|
54
|
+
|
|
55
|
+
const StyledTd = styled(Td)<{ $hasBorder?: boolean }>`
|
|
56
|
+
border-radius: 0px !important;
|
|
57
|
+
|
|
58
|
+
&:first-child {
|
|
59
|
+
border-top-left-radius: 4px !important;
|
|
60
|
+
border-bottom-left-radius: 4px !important;
|
|
61
|
+
}
|
|
62
|
+
&:last-child {
|
|
63
|
+
border-top-right-radius: 4px !important;
|
|
64
|
+
border-bottom-right-radius: 4px !important;
|
|
65
|
+
}
|
|
66
|
+
`
|
|
67
|
+
|
|
68
|
+
const TableHeader = <T, K extends keyof T>({ columns, onSort, onRemove, sxTh, hasBorder, initialSortDetails }: TableHeaderProps<T, K>) => {
|
|
69
|
+
const [sort, setSort] = useState<SortTypes>(initialSortDetails?.direction)
|
|
70
|
+
const [activeSort, setActiveSort] = useState<number | undefined>(initialSortDetails?.index)
|
|
71
|
+
|
|
72
|
+
const Sortable = ({ sort, direction, index }: { sort: K, direction: SortTypes, index: number }) => {
|
|
73
|
+
onSort?.({ sort, direction, index })
|
|
74
|
+
setSort(direction)
|
|
75
|
+
setActiveSort(index)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Thead>
|
|
80
|
+
<Tr>
|
|
81
|
+
{columns.map((column, index) => column?.sortable && onSort ? (
|
|
82
|
+
<StyledTh key={column.key.toString()} sx={sxTh} $hasBorder={hasBorder}>
|
|
83
|
+
<HeaderSort
|
|
84
|
+
sortType={activeSort !== index ? undefined : sort}
|
|
85
|
+
onSort={(sortType) => Sortable?.({ sort: column.key, direction: sortType, index })}
|
|
86
|
+
>
|
|
87
|
+
{column.header}
|
|
88
|
+
</HeaderSort>
|
|
89
|
+
</StyledTh>
|
|
90
|
+
) : (
|
|
91
|
+
<StyledTh key={column.key.toString()} sx={sxTh} $hasBorder={hasBorder}>
|
|
92
|
+
<Text appearance="microtext1" mr="2">
|
|
93
|
+
{column.header}
|
|
94
|
+
</Text>
|
|
95
|
+
</StyledTh>
|
|
96
|
+
))}
|
|
97
|
+
{onRemove && <Th />}
|
|
98
|
+
</Tr>
|
|
99
|
+
</Thead>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type TableRowsProps<T, K extends keyof T> = {
|
|
104
|
+
data: T[],
|
|
105
|
+
columns: ColumnDefinition<T, K>[],
|
|
106
|
+
onRemove?: (row: T) => void,
|
|
107
|
+
canRemove?: (row: T) => boolean,
|
|
108
|
+
options?: React.ComponentProps<typeof SelectionList>['items'],
|
|
109
|
+
onClickRow?: (data: T) => void,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface RemoveButtonProps<T> {
|
|
113
|
+
row: T,
|
|
114
|
+
onRemove?: (row: T) => void,
|
|
115
|
+
canRemove?: (row: T) => boolean,
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function RemoveButton<T>({ row, onRemove, canRemove }: RemoveButtonProps<T>) {
|
|
119
|
+
const t = useTranslate(dictionary)
|
|
120
|
+
const [isLoading, setLoading] = useState(false)
|
|
121
|
+
|
|
122
|
+
if (!onRemove || (canRemove && !canRemove(row))) {
|
|
123
|
+
return null
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const handleRemove = async () => {
|
|
127
|
+
if (isLoading) return
|
|
128
|
+
setLoading(true)
|
|
129
|
+
try {
|
|
130
|
+
await onRemove(row)
|
|
131
|
+
} finally {
|
|
132
|
+
setLoading(false)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<Button colorScheme="danger" onClick={handleRemove} size="sm">
|
|
138
|
+
{isLoading ? <LoadingCircular/> : <>
|
|
139
|
+
<IconBox size="xs" mr={2} colorIcon="danger">
|
|
140
|
+
<Trash />
|
|
141
|
+
</IconBox><Text appearance="microtext1" mr="2">
|
|
142
|
+
{t.remove}
|
|
143
|
+
</Text>
|
|
144
|
+
</>}
|
|
145
|
+
</Button>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const TableRows = <T, K extends keyof T>({ data, columns, options, onRemove, canRemove }: TableRowsProps<T, K>) => {
|
|
150
|
+
const rows = data.map((row, index) => (
|
|
151
|
+
<Tr key={`row-${index}`}>
|
|
152
|
+
{columns.map((column, columnIndex) => (
|
|
153
|
+
<StyledTd
|
|
154
|
+
key={columnIndex}
|
|
155
|
+
sx={{ ...column.sx }}>
|
|
156
|
+
<> {column?.customRender ? column.customRender(row) : row[column.key]}</>
|
|
157
|
+
</StyledTd>
|
|
158
|
+
))}
|
|
159
|
+
|
|
160
|
+
{canRemove && <StyledTd>
|
|
161
|
+
<RemoveButton row={row} onRemove={onRemove} canRemove={canRemove} />
|
|
162
|
+
</StyledTd>}
|
|
163
|
+
{options && <StyledTd>
|
|
164
|
+
<SettingsVerticalMenu
|
|
165
|
+
id="workflow-studio-menu"
|
|
166
|
+
items={options}
|
|
167
|
+
size="xs"
|
|
168
|
+
/>
|
|
169
|
+
</StyledTd>}
|
|
170
|
+
</Tr>
|
|
171
|
+
))
|
|
172
|
+
|
|
173
|
+
return <Tbody sx={{ borderSpacing: '0 8px' }}>{rows}</Tbody>
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
type TableProps<T, K extends keyof T> = {
|
|
177
|
+
data: T[],
|
|
178
|
+
columns: ColumnDefinition<T, K>[],
|
|
179
|
+
onSort?: ({ sort, direction, index }: SortDetailsType<T, K>) => void,
|
|
180
|
+
onRemove?: (data: T) => void,
|
|
181
|
+
canRemove?: (row: T) => boolean,
|
|
182
|
+
tableAppearance?: 'striped' | 'filled',
|
|
183
|
+
options?: React.ComponentProps<typeof SelectionList>['items'],
|
|
184
|
+
sxHeader?: SxProperties,
|
|
185
|
+
hasHeaderBorder?: boolean,
|
|
186
|
+
searchParamName?: string,
|
|
187
|
+
initialSortDetails?: Omit<SortDetailsType<T, K>, 'sort'>,
|
|
188
|
+
/**
|
|
189
|
+
* Accepts a react element that is rendered below the table, used mostly for pagination.
|
|
190
|
+
*/
|
|
191
|
+
afterContent?: React.ReactElement,
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export const TableData = <T, K extends keyof T>({
|
|
195
|
+
data,
|
|
196
|
+
columns,
|
|
197
|
+
onSort,
|
|
198
|
+
onRemove,
|
|
199
|
+
canRemove,
|
|
200
|
+
tableAppearance = 'striped',
|
|
201
|
+
options,
|
|
202
|
+
sxHeader,
|
|
203
|
+
hasHeaderBorder,
|
|
204
|
+
searchParamName = 'search',
|
|
205
|
+
initialSortDetails,
|
|
206
|
+
afterContent,
|
|
207
|
+
}: TableProps<T, K>) => {
|
|
208
|
+
const searchParams = new URLSearchParams(window.location.search)
|
|
209
|
+
const search = searchParams.get(searchParamName) ?? ''
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<ContentValidateFilter listLength={data.length} searchText={search}>
|
|
213
|
+
{!!data.length && (
|
|
214
|
+
<>
|
|
215
|
+
<Table appearance={tableAppearance} sx={{ mb: 5 }}>
|
|
216
|
+
<colgroup>
|
|
217
|
+
{columns.map((column, index) => (
|
|
218
|
+
<col key={index} style={{ width: column.width || 'auto' }} />
|
|
219
|
+
))}
|
|
220
|
+
</colgroup>
|
|
221
|
+
<TableHeader
|
|
222
|
+
sxTh={sxHeader}
|
|
223
|
+
columns={columns}
|
|
224
|
+
onSort={onSort}
|
|
225
|
+
onRemove={onRemove}
|
|
226
|
+
hasBorder={tableAppearance === 'striped' ? false : hasHeaderBorder}
|
|
227
|
+
initialSortDetails={initialSortDetails}
|
|
228
|
+
/>
|
|
229
|
+
<TableRows
|
|
230
|
+
data={data}
|
|
231
|
+
columns={columns}
|
|
232
|
+
onRemove={onRemove}
|
|
233
|
+
canRemove={canRemove}
|
|
234
|
+
options={options}
|
|
235
|
+
/>
|
|
236
|
+
</Table>
|
|
237
|
+
{!!afterContent && afterContent}
|
|
238
|
+
</>
|
|
239
|
+
)}
|
|
240
|
+
</ContentValidateFilter>
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const dictionary = {
|
|
245
|
+
en: {
|
|
246
|
+
remove: 'Remove',
|
|
247
|
+
},
|
|
248
|
+
pt: {
|
|
249
|
+
remove: 'Remover',
|
|
250
|
+
},
|
|
251
|
+
}
|