armtek-uikit-react 1.0.56 → 1.0.57
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/assets/ListItem.scss +10 -3
- package/assets/Table.scss +29 -0
- package/package.json +1 -1
- package/ui/List/ListItem.js +11 -4
- package/ui/Table/Table.d.ts +22 -0
- package/ui/Table/Table.js +43 -0
- package/ui/Table/Table.module.scss +1 -0
- package/ui/Table/TableCell.d.ts +6 -0
- package/ui/Table/TableCell.js +24 -0
- package/ui/Table/TableRow.d.ts +4 -0
- package/ui/Table/TableRow.js +18 -0
- package/ui/Table/index.d.ts +3 -0
- package/ui/Table/index.js +3 -0
package/assets/ListItem.scss
CHANGED
|
@@ -27,8 +27,11 @@
|
|
|
27
27
|
user-select: none;
|
|
28
28
|
cursor: default;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
.listitem__Content{
|
|
31
|
+
display: block;
|
|
32
|
+
margin-right: calc($size-step * 2);
|
|
33
|
+
}
|
|
34
|
+
.listitem__Content_adornment_left{
|
|
32
35
|
margin-left: calc($size-step * 2);
|
|
33
36
|
}
|
|
34
37
|
.listitem_endAdornment{
|
|
@@ -39,5 +42,9 @@
|
|
|
39
42
|
}
|
|
40
43
|
.listitemText{
|
|
41
44
|
display: block;
|
|
42
|
-
|
|
45
|
+
}
|
|
46
|
+
.listitem__helper{
|
|
47
|
+
margin-top: calc($size-step / 2);
|
|
48
|
+
display: block;
|
|
49
|
+
color: $color-neutral-light;
|
|
43
50
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@import "variables";
|
|
2
|
+
|
|
3
|
+
.table{
|
|
4
|
+
width: 100%;
|
|
5
|
+
margin:0;
|
|
6
|
+
padding:0;
|
|
7
|
+
background:none;
|
|
8
|
+
border:none;
|
|
9
|
+
border-collapse:collapse;
|
|
10
|
+
border-spacing:0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.tableCell{
|
|
14
|
+
color: $color-gray-800;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
}
|
|
17
|
+
.tableCellInner{
|
|
18
|
+
padding: calc($size-step * 2 ) $size-step;
|
|
19
|
+
}
|
|
20
|
+
.tableCell_head{
|
|
21
|
+
color: $color-gray-500
|
|
22
|
+
}
|
|
23
|
+
.tableRow td{
|
|
24
|
+
border-bottom: 1px solid $color-gray-300;
|
|
25
|
+
background: #fff;
|
|
26
|
+
}
|
|
27
|
+
.tableRow:hover td{
|
|
28
|
+
background: #F8F9FA;
|
|
29
|
+
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"armtek-uikit-react","version":"1.0.
|
|
1
|
+
{"name":"armtek-uikit-react","version":"1.0.57","description":"Armtek UIKit for React","repository":{"type":"git","url":"ssh://git@gl.corp:10022/int/uikit/uikit_react.git"},"author":"","license":"ISC","dependencies":{"build":"^0.1.4","clsx":"^2.0.0","rc-slider":"^10.2.1","react":"*","react-datepicker":"^4.16.0","react-dom":"*"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
|
package/ui/List/ListItem.js
CHANGED
|
@@ -13,6 +13,7 @@ const ListItem = props => {
|
|
|
13
13
|
let {
|
|
14
14
|
children,
|
|
15
15
|
className,
|
|
16
|
+
title,
|
|
16
17
|
active,
|
|
17
18
|
divider,
|
|
18
19
|
checked,
|
|
@@ -44,11 +45,17 @@ const ListItem = props => {
|
|
|
44
45
|
position: 'start',
|
|
45
46
|
children: startAdornment
|
|
46
47
|
})]
|
|
47
|
-
}), /*#__PURE__*/
|
|
48
|
-
className: clsx(css.
|
|
49
|
-
[css.
|
|
48
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
49
|
+
className: clsx(css.listitem__Content, {
|
|
50
|
+
[css.listitem__content_adornment_left]: withStartAdornment
|
|
50
51
|
}),
|
|
51
|
-
children:
|
|
52
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
53
|
+
className: clsx(css.listitemText),
|
|
54
|
+
children: children
|
|
55
|
+
}), title && /*#__PURE__*/_jsx("span", {
|
|
56
|
+
className: css.listitem__helper,
|
|
57
|
+
children: title
|
|
58
|
+
})]
|
|
52
59
|
}), !!endAdornment && /*#__PURE__*/_jsx(AdornmentContainer, {
|
|
53
60
|
position: 'end',
|
|
54
61
|
children: /*#__PURE__*/_jsx(Adornment, {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode, MouseEvent } from 'react';
|
|
2
|
+
type ItemType = Record<string, any>;
|
|
3
|
+
type ClassesType<T extends ItemType> = {
|
|
4
|
+
tableRowHead?: string;
|
|
5
|
+
tableRow?: string | ((item: T) => string);
|
|
6
|
+
tableCellHead?: string;
|
|
7
|
+
tableCell?: string;
|
|
8
|
+
};
|
|
9
|
+
export type TableColType<T extends ItemType> = {
|
|
10
|
+
text: string;
|
|
11
|
+
getValue?: (item: T) => string | ReactNode | number;
|
|
12
|
+
getTitle?: () => string | ReactNode | number;
|
|
13
|
+
code: keyof T;
|
|
14
|
+
};
|
|
15
|
+
type TableProps<T extends ItemType> = Omit<ComponentPropsWithoutRef<'table'>, 'onClick'> & {
|
|
16
|
+
classes?: ClassesType<T>;
|
|
17
|
+
structure: TableColType<T>[];
|
|
18
|
+
items: T[];
|
|
19
|
+
onClick: (item: T, e: MouseEvent<HTMLTableRowElement>) => void;
|
|
20
|
+
};
|
|
21
|
+
export declare function Table<T extends ItemType>(props: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { TableRow } from "./TableRow";
|
|
3
|
+
import { TableCell } from "./TableCell";
|
|
4
|
+
import css from "./Table.module.scss";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
|
+
// TODO TESTS
|
|
9
|
+
export function Table(props) {
|
|
10
|
+
const {
|
|
11
|
+
className,
|
|
12
|
+
structure,
|
|
13
|
+
items,
|
|
14
|
+
onClick,
|
|
15
|
+
classes,
|
|
16
|
+
...tableProps
|
|
17
|
+
} = props;
|
|
18
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
19
|
+
children: /*#__PURE__*/_jsxs("table", {
|
|
20
|
+
...tableProps,
|
|
21
|
+
className: clsx(className, css.table),
|
|
22
|
+
children: [/*#__PURE__*/_jsx(TableRow, {
|
|
23
|
+
className: classes == null ? void 0 : classes.tableRowHead,
|
|
24
|
+
children: structure.map(item => /*#__PURE__*/_jsx(TableCell, {
|
|
25
|
+
head: true,
|
|
26
|
+
className: classes == null ? void 0 : classes.tableCellHead,
|
|
27
|
+
children: item.getTitle ? item.getTitle() : item.text
|
|
28
|
+
}))
|
|
29
|
+
}), items.map(row => {
|
|
30
|
+
let rowClass = !!(classes != null && classes.tableRow) ? typeof classes.tableRow === 'string' ? classes.tableRow : classes.tableRow(row) : '';
|
|
31
|
+
return /*#__PURE__*/_jsx(TableRow, {
|
|
32
|
+
className: rowClass,
|
|
33
|
+
onClick: e => onClick(row, e),
|
|
34
|
+
children: structure.map(item => {
|
|
35
|
+
return /*#__PURE__*/_jsx(TableCell, {
|
|
36
|
+
children: item.getValue ? item.getValue(row) : row[item.code]
|
|
37
|
+
});
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
})]
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "../../assets/Table";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import css from "./Table.module.scss";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
export const TableCell = props => {
|
|
6
|
+
const {
|
|
7
|
+
className,
|
|
8
|
+
children,
|
|
9
|
+
head,
|
|
10
|
+
...cellProps
|
|
11
|
+
} = props;
|
|
12
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
13
|
+
children: /*#__PURE__*/_jsx("td", {
|
|
14
|
+
...cellProps,
|
|
15
|
+
className: clsx(className, css.tableCell, {
|
|
16
|
+
[css.tableCell_head]: !!head
|
|
17
|
+
}),
|
|
18
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
19
|
+
className: css.tableCellInner,
|
|
20
|
+
children: children
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import css from "./Table.module.scss";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
export const TableRow = props => {
|
|
6
|
+
const {
|
|
7
|
+
className,
|
|
8
|
+
children,
|
|
9
|
+
...rowProps
|
|
10
|
+
} = props;
|
|
11
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
12
|
+
children: /*#__PURE__*/_jsx("tr", {
|
|
13
|
+
...rowProps,
|
|
14
|
+
className: clsx(className, css.tableRow),
|
|
15
|
+
children: children
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
};
|