@papillonbits/components 1.13.1 → 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +1 -12
- package/build/primer/Alert/Alert.js +82 -94
- package/build/primer/Alert/Alert.prop.js +19 -25
- package/build/primer/Alert/index.js +2 -19
- package/build/primer/Blankslate/Blankslate.js +22 -26
- package/build/primer/Blankslate/Blankslate.prop.js +11 -17
- package/build/primer/Blankslate/index.js +2 -19
- package/build/primer/Breadcrumb/Breadcrumb.js +59 -61
- package/build/primer/Breadcrumb/Breadcrumb.prop.js +14 -20
- package/build/primer/Breadcrumb/index.js +2 -19
- package/build/primer/Button/Button.js +63 -72
- package/build/primer/Button/Button.prop.js +27 -33
- package/build/primer/Button/index.js +2 -49
- package/build/primer/Dropdown/Dropdown.js +79 -85
- package/build/primer/Dropdown/Dropdown.prop.js +15 -21
- package/build/primer/Dropdown/index.js +2 -19
- package/build/primer/ErrorBoundary/ErrorBoundary.js +35 -55
- package/build/primer/ErrorBoundary/ErrorBoundary.prop.js +4 -10
- package/build/primer/ErrorBoundary/index.js +1 -12
- package/build/primer/Form/Checkbox/Checkbox.js +29 -39
- package/build/primer/Form/Checkbox/Checkbox.prop.js +15 -21
- package/build/primer/Form/Checkbox/index.js +2 -19
- package/build/primer/Form/Input/Input.js +29 -43
- package/build/primer/Form/Input/Input.prop.js +19 -25
- package/build/primer/Form/Input/index.js +2 -25
- package/build/primer/Form/Radio/Radio.js +26 -38
- package/build/primer/Form/Radio/Radio.prop.js +14 -20
- package/build/primer/Form/Radio/index.js +2 -19
- package/build/primer/Form/index.js +11 -17
- package/build/primer/Grid/DisplayTable/DisplayTable.js +44 -54
- package/build/primer/Grid/DisplayTable/DisplayTable.prop.js +7 -13
- package/build/primer/Grid/DisplayTable/index.js +1 -12
- package/build/primer/Grid/FlexGrid/FlexGrid.js +186 -207
- package/build/primer/Grid/FlexGrid/FlexGrid.prop.js +24 -30
- package/build/primer/Grid/FlexGrid/index.js +2 -25
- package/build/primer/Grid/index.js +7 -13
- package/build/primer/Icon/Icon.js +35 -52
- package/build/primer/Icon/Icon.part.js +1287 -1294
- package/build/primer/Icon/Icon.prop.js +20 -26
- package/build/primer/Icon/index.js +2 -25
- package/build/primer/Label/Label.js +22 -28
- package/build/primer/Label/Label.prop.js +11 -17
- package/build/primer/Label/index.js +1 -12
- package/build/primer/Loader/Loader.js +38 -45
- package/build/primer/Loader/Loader.prop.js +7 -13
- package/build/primer/Loader/index.js +2 -19
- package/build/primer/Navigation/Menu/Menu.js +52 -59
- package/build/primer/Navigation/Menu/Menu.prop.js +16 -22
- package/build/primer/Navigation/Menu/index.js +1 -12
- package/build/primer/Navigation/TabNav/TabNav.js +89 -94
- package/build/primer/Navigation/TabNav/TabNav.prop.js +19 -25
- package/build/primer/Navigation/TabNav/index.js +2 -19
- package/build/primer/Navigation/UnderlineNav/UnderlineNav.js +82 -86
- package/build/primer/Navigation/UnderlineNav/UnderlineNav.prop.js +21 -27
- package/build/primer/Navigation/UnderlineNav/index.js +2 -25
- package/build/primer/Navigation/index.js +10 -16
- package/build/primer/Pagination/PreviousNext/PreviousNext.js +53 -54
- package/build/primer/Pagination/PreviousNext/PreviousNext.prop.js +22 -28
- package/build/primer/Pagination/PreviousNext/index.js +2 -19
- package/build/primer/Pagination/index.js +4 -10
- package/build/primer/Popover/Popover.js +59 -50
- package/build/primer/Popover/Popover.prop.js +16 -22
- package/build/primer/Popover/index.js +2 -25
- package/build/primer/Progress/Progress.js +20 -26
- package/build/primer/Progress/Progress.prop.js +7 -13
- package/build/primer/Progress/index.js +2 -19
- package/build/primer/Select/Select.js +43 -51
- package/build/primer/Select/Select.prop.js +12 -18
- package/build/primer/Select/index.js +2 -19
- package/build/primer/SelectMenu/SelectMenu.js +65 -74
- package/build/primer/SelectMenu/SelectMenu.prop.js +14 -20
- package/build/primer/SelectMenu/index.js +1 -12
- package/build/primer/Subhead/Subhead.js +16 -23
- package/build/primer/Subhead/Subhead.prop.js +6 -12
- package/build/primer/Subhead/index.js +1 -12
- package/build/primer/Toast/Toast.js +39 -46
- package/build/primer/Toast/Toast.prop.js +10 -16
- package/build/primer/Toast/index.js +2 -19
- package/build/primer/index.js +58 -64
- package/package.json +4 -4
|
@@ -1,58 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
className: (0, _classnames["default"])(className, _visibilityDisplay["default"]['d-table'], _grid["default"]['col-12'], _colors["default"]['bg-blue-light']),
|
|
30
|
-
children: items[0].names.map(function (name, index) {
|
|
31
|
-
var isIdColumn = index === idIndex;
|
|
32
|
-
var isSelectedColumn = index === isSelectedIndex;
|
|
33
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {
|
|
34
|
-
children: !isIdColumn && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
35
|
-
className: (0, _classnames["default"])(_grid["default"]['col-2'], _visibilityDisplay["default"]['d-table-cell'], _borders["default"].border, _padding["default"]['p-2'], _typography["default"].h6),
|
|
1
|
+
import "core-js/modules/es.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/es.iterator.map.js";
|
|
3
|
+
import { Fragment } from 'react';
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
6
|
+
import displayStyles from '@papillonbits/css/build/primer/utilities/visibility-display.scss';
|
|
7
|
+
import borderStyles from '@papillonbits/css/build/primer/utilities/borders.scss';
|
|
8
|
+
import paddingStyles from '@papillonbits/css/build/primer/utilities/padding.scss';
|
|
9
|
+
import typographyStyles from '@papillonbits/css/build/primer/utilities/typography.scss';
|
|
10
|
+
import colorStyles from '@papillonbits/css/build/primer/utilities/colors.scss';
|
|
11
|
+
import gridStyles from '../../Layout/grid.scss';
|
|
12
|
+
import { propTypes, defaultProps } from './DisplayTable.prop';
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
export function DisplayTable({
|
|
15
|
+
className = defaultProps.className,
|
|
16
|
+
items,
|
|
17
|
+
idIndex = defaultProps.idIndex,
|
|
18
|
+
isSelectedIndex = defaultProps.isSelectedIndex
|
|
19
|
+
}) {
|
|
20
|
+
return /*#__PURE__*/_jsxs(Fragment, {
|
|
21
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
22
|
+
className: cx(className, displayStyles['d-table'], gridStyles['col-12'], colorStyles['bg-blue-light']),
|
|
23
|
+
children: items[0].names.map((name, index) => {
|
|
24
|
+
const isIdColumn = index === idIndex;
|
|
25
|
+
const isSelectedColumn = index === isSelectedIndex;
|
|
26
|
+
return /*#__PURE__*/_jsx(Fragment, {
|
|
27
|
+
children: !isIdColumn && /*#__PURE__*/_jsx("div", {
|
|
28
|
+
className: cx(gridStyles['col-2'], displayStyles['d-table-cell'], borderStyles.border, paddingStyles['p-2'], typographyStyles.h6),
|
|
36
29
|
children: isSelectedColumn ? '' : name
|
|
37
|
-
}, (
|
|
38
|
-
}, (
|
|
30
|
+
}, uuidv1())
|
|
31
|
+
}, uuidv1());
|
|
39
32
|
})
|
|
40
|
-
}), items.map(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
children:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
54
|
-
}, (0, _uuid.v1)());
|
|
55
|
-
})]
|
|
33
|
+
}), items.map(item => /*#__PURE__*/_jsx("div", {
|
|
34
|
+
className: cx(className, displayStyles['d-table'], gridStyles['col-12']),
|
|
35
|
+
children: item.values.map((value, valueIndex) => {
|
|
36
|
+
const isIdColumn = valueIndex === idIndex;
|
|
37
|
+
const isSelectedColumn = valueIndex === isSelectedIndex;
|
|
38
|
+
return /*#__PURE__*/_jsx(Fragment, {
|
|
39
|
+
children: !isIdColumn && /*#__PURE__*/_jsx("div", {
|
|
40
|
+
className: cx(gridStyles['col-2'], displayStyles['d-table-cell'], borderStyles.border, paddingStyles['p-2']),
|
|
41
|
+
children: isSelectedColumn ? '' : value?.value ?? value
|
|
42
|
+
}, uuidv1())
|
|
43
|
+
}, uuidv1());
|
|
44
|
+
})
|
|
45
|
+
}, uuidv1()))]
|
|
56
46
|
});
|
|
57
47
|
}
|
|
58
|
-
DisplayTable.propTypes =
|
|
48
|
+
DisplayTable.propTypes = propTypes;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _propTypes = require("prop-types");
|
|
8
|
-
var propTypes = exports.propTypes = {
|
|
9
|
-
className: _propTypes.string,
|
|
10
|
-
items: _propTypes.array.isRequired,
|
|
11
|
-
idIndex: _propTypes.number,
|
|
12
|
-
isSelectedIndex: _propTypes.number
|
|
1
|
+
import { string, array, number } from 'prop-types';
|
|
2
|
+
export const propTypes = {
|
|
3
|
+
className: string,
|
|
4
|
+
items: array.isRequired,
|
|
5
|
+
idIndex: number,
|
|
6
|
+
isSelectedIndex: number
|
|
13
7
|
};
|
|
14
|
-
|
|
8
|
+
export const defaultProps = {
|
|
15
9
|
className: null,
|
|
16
10
|
idIndex: -1,
|
|
17
11
|
isSelectedIndex: -1
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "DisplayTable", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _DisplayTable.DisplayTable;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _DisplayTable = require("./DisplayTable");
|
|
1
|
+
export { DisplayTable } from './DisplayTable';
|
|
@@ -1,244 +1,223 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
state = _ref$state === void 0 ? _FlexGrid.defaultProps.state : _ref$state;
|
|
53
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
54
|
-
className: (0, _classnames["default"])(className, (0, _defineProperty2["default"])({}, _FlexGrid2["default"]['flexGrid-inactive'], state === _FlexGrid.flexGridState.inactive)),
|
|
55
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
56
|
-
className: (0, _classnames["default"])(_visibilityDisplay["default"]['d-flex'], _flexbox["default"]['flex-row'], _flexbox["default"]['flex-items-start'], _colors["default"]['bg-blue-light'], (0, _defineProperty2["default"])({}, _borders["default"].border, items === null || items === void 0 ? void 0 : items[0])),
|
|
57
|
-
children: items === null || items === void 0 || (_items$ = items[0]) === null || _items$ === void 0 || (_items$ = _items$.names) === null || _items$ === void 0 ? void 0 : _items$.map(function (name, nameIndex) {
|
|
58
|
-
var _items$2;
|
|
59
|
-
var isIdColumn = nameIndex === idIndex;
|
|
60
|
-
var isSelectedColumn = nameIndex === isSelectedIndex;
|
|
61
|
-
var isSelectedComponent = selection === _FlexGrid.flexGridSelection.radio ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, {
|
|
1
|
+
import "core-js/modules/es.array.includes.js";
|
|
2
|
+
import "core-js/modules/es.iterator.constructor.js";
|
|
3
|
+
import "core-js/modules/es.iterator.every.js";
|
|
4
|
+
import "core-js/modules/es.iterator.find.js";
|
|
5
|
+
import "core-js/modules/es.iterator.map.js";
|
|
6
|
+
import { Fragment } from 'react';
|
|
7
|
+
import cx from 'classnames';
|
|
8
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
9
|
+
import { getCapizalizedString } from '@papillonbits/library/string';
|
|
10
|
+
import { sortOrder } from '@papillonbits/library/sort';
|
|
11
|
+
import displayStyles from '@papillonbits/css/build/primer/utilities/visibility-display.scss';
|
|
12
|
+
import flexboxStyles from '@papillonbits/css/build/primer/utilities/flexbox.scss';
|
|
13
|
+
import borderStyles from '@papillonbits/css/build/primer/utilities/borders.scss';
|
|
14
|
+
import paddingStyles from '@papillonbits/css/build/primer/utilities/padding.scss';
|
|
15
|
+
import marginStyles from '@papillonbits/css/build/primer/utilities/margin.scss';
|
|
16
|
+
import typographyStyles from '@papillonbits/css/build/primer/utilities/typography.scss';
|
|
17
|
+
import layoutStyles from '@papillonbits/css/build/primer/utilities/layout.scss';
|
|
18
|
+
import colorStyles from '@papillonbits/css/build/primer/utilities/colors.scss';
|
|
19
|
+
import truncateStyles from '@papillonbits/css/build/primer/truncate/index.scss';
|
|
20
|
+
import gridStyles from '../../Layout/grid.scss';
|
|
21
|
+
import { propTypes, defaultProps, flexGridSelection, flexGridState } from './FlexGrid.prop';
|
|
22
|
+
import styles from './FlexGrid.scss';
|
|
23
|
+
import { Radio } from '../../Form/Radio';
|
|
24
|
+
import { Checkbox } from '../../Form/Checkbox';
|
|
25
|
+
import { Icon, iconName, iconSize } from '../../Icon';
|
|
26
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
+
export function FlexGrid({
|
|
28
|
+
className = defaultProps.className,
|
|
29
|
+
items,
|
|
30
|
+
idIndex = defaultProps.idIndex,
|
|
31
|
+
isSelectedIndex = defaultProps.isSelectedIndex,
|
|
32
|
+
selection = defaultProps.selection,
|
|
33
|
+
sort,
|
|
34
|
+
onChange = defaultProps.onChange,
|
|
35
|
+
onClick = defaultProps.onClick,
|
|
36
|
+
onDoubleClick = defaultProps.onDoubleClick,
|
|
37
|
+
iconColor = defaultProps.iconColor,
|
|
38
|
+
state = defaultProps.state
|
|
39
|
+
}) {
|
|
40
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
41
|
+
className: cx(className, {
|
|
42
|
+
[styles['flexGrid-inactive']]: state === flexGridState.inactive
|
|
43
|
+
}),
|
|
44
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
45
|
+
className: cx(displayStyles['d-flex'], flexboxStyles['flex-row'], flexboxStyles['flex-items-start'], colorStyles['bg-blue-light'], {
|
|
46
|
+
[borderStyles.border]: items?.[0]
|
|
47
|
+
}),
|
|
48
|
+
children: items?.[0]?.names?.map((name, nameIndex) => {
|
|
49
|
+
const isIdColumn = nameIndex === idIndex;
|
|
50
|
+
const isSelectedColumn = nameIndex === isSelectedIndex;
|
|
51
|
+
const isSelectedComponent = selection === flexGridSelection.radio ? null : /*#__PURE__*/_jsx(Checkbox, {
|
|
62
52
|
ariaAttr: {
|
|
63
53
|
describedBy: name
|
|
64
54
|
},
|
|
65
|
-
isChecked: items.map(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return valueIndex === isSelectedIndex ? event.target.checked : value;
|
|
75
|
-
});
|
|
76
|
-
}).map(function (newItem) {
|
|
77
|
-
return {
|
|
78
|
-
id: newItem[idIndex],
|
|
79
|
-
isSelected: newItem[isSelectedIndex]
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
_onChange(newItems);
|
|
55
|
+
isChecked: items.map(item => item.values[1]).every(isSelected => isSelected === true),
|
|
56
|
+
onChange: event => {
|
|
57
|
+
const newItems = items?.map(({
|
|
58
|
+
values
|
|
59
|
+
}) => values?.map((value, valueIndex) => valueIndex === isSelectedIndex ? event.target.checked : value)).map(newItem => ({
|
|
60
|
+
id: newItem[idIndex],
|
|
61
|
+
isSelected: newItem[isSelectedIndex]
|
|
62
|
+
}));
|
|
63
|
+
onChange(newItems);
|
|
83
64
|
}
|
|
84
65
|
});
|
|
85
|
-
|
|
66
|
+
let sortComponent;
|
|
86
67
|
if (sort.index === nameIndex && sort.value === name) {
|
|
87
|
-
if (sort.order ===
|
|
88
|
-
sortComponent = /*#__PURE__*/(
|
|
89
|
-
icon:
|
|
90
|
-
size:
|
|
68
|
+
if (sort.order === sortOrder.ascending) {
|
|
69
|
+
sortComponent = /*#__PURE__*/_jsx(Icon, {
|
|
70
|
+
icon: iconName.TriangleUp16,
|
|
71
|
+
size: iconSize.small,
|
|
91
72
|
fill: iconColor.sort
|
|
92
73
|
});
|
|
93
74
|
} else {
|
|
94
|
-
sortComponent = /*#__PURE__*/(
|
|
95
|
-
icon:
|
|
96
|
-
size:
|
|
75
|
+
sortComponent = /*#__PURE__*/_jsx(Icon, {
|
|
76
|
+
icon: iconName.TriangleDown16,
|
|
77
|
+
size: iconSize.small,
|
|
97
78
|
fill: iconColor.sort
|
|
98
79
|
});
|
|
99
80
|
}
|
|
100
81
|
}
|
|
101
|
-
return /*#__PURE__*/(
|
|
102
|
-
children: !isIdColumn && /*#__PURE__*/(
|
|
103
|
-
className: (
|
|
104
|
-
|
|
82
|
+
return /*#__PURE__*/_jsx(Fragment, {
|
|
83
|
+
children: !isIdColumn && /*#__PURE__*/_jsx("div", {
|
|
84
|
+
className: cx(typographyStyles.h6, displayStyles['d-flex'], flexboxStyles['flex-row'], paddingStyles['p-2'], truncateStyles['css-truncate'], truncateStyles['css-truncate-overflow'], styles.item, {
|
|
85
|
+
[gridStyles['col-2']]: isSelectedColumn,
|
|
86
|
+
[gridStyles['col-12']]: !isSelectedColumn,
|
|
87
|
+
[flexboxStyles['flex-justify-center']]: isSelectedColumn,
|
|
88
|
+
[flexboxStyles['flex-justify-between']]: !isSelectedColumn
|
|
89
|
+
}),
|
|
90
|
+
onClick: () => {
|
|
105
91
|
if (!isSelectedColumn) {
|
|
106
|
-
|
|
92
|
+
onClick({
|
|
107
93
|
index: nameIndex,
|
|
108
94
|
value: name,
|
|
109
95
|
order: sort.order
|
|
110
96
|
});
|
|
111
97
|
}
|
|
112
98
|
},
|
|
113
|
-
onKeyPress:
|
|
99
|
+
onKeyPress: () => {},
|
|
114
100
|
role: "button",
|
|
115
101
|
tabIndex: 0,
|
|
116
|
-
children: isSelectedColumn ? isSelectedComponent : /*#__PURE__*/(
|
|
117
|
-
className: (
|
|
118
|
-
children: [/*#__PURE__*/(
|
|
119
|
-
className: (
|
|
120
|
-
children:
|
|
102
|
+
children: isSelectedColumn ? isSelectedComponent : /*#__PURE__*/_jsxs("div", {
|
|
103
|
+
className: cx(displayStyles['d-flex'], flexboxStyles['flex-justify-between'], layoutStyles['width-full']),
|
|
104
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
105
|
+
className: cx(truncateStyles['css-truncate'], truncateStyles['css-truncate-overflow']),
|
|
106
|
+
children: getCapizalizedString({
|
|
121
107
|
string: name
|
|
122
108
|
})
|
|
123
|
-
}), /*#__PURE__*/(
|
|
124
|
-
className: (
|
|
125
|
-
children: [sortComponent, nameIndex <
|
|
109
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
110
|
+
className: cx(displayStyles['d-flex'], flexboxStyles['flex-items-start'], marginStyles['ml-1']),
|
|
111
|
+
children: [sortComponent, nameIndex < items?.[0]?.names.length - 1 ?
|
|
126
112
|
/*#__PURE__*/
|
|
127
113
|
// eslint-disable-line no-unsafe-optional-chaining
|
|
128
|
-
(
|
|
129
|
-
className: (
|
|
114
|
+
_jsx("span", {
|
|
115
|
+
className: cx(marginStyles['ml-1'], colorStyles['text-gray-light']),
|
|
130
116
|
children: " |"
|
|
131
117
|
}) : null]
|
|
132
118
|
})]
|
|
133
119
|
})
|
|
134
120
|
})
|
|
135
|
-
}, (
|
|
121
|
+
}, uuidv1());
|
|
136
122
|
})
|
|
137
|
-
}), items
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
123
|
+
}), items?.map((item, itemIndex) => /*#__PURE__*/_jsx("div", {
|
|
124
|
+
className: cx(displayStyles['d-flex'], flexboxStyles['flex-row'], flexboxStyles['flex-items-start'], borderStyles.border, styles.item, styles.row),
|
|
125
|
+
onClick: () => {
|
|
126
|
+
let bubleUpNewItems = true;
|
|
127
|
+
const newItems = items?.map(({
|
|
128
|
+
values
|
|
129
|
+
}, newItemIndex) => values?.map((newValue, newValueIndex) => {
|
|
130
|
+
if (typeof newValue === 'object' && ['FileDirectory16', 'File16'].includes(newValue?.icon)) {
|
|
131
|
+
bubleUpNewItems = false;
|
|
132
|
+
}
|
|
133
|
+
return newItemIndex === itemIndex && newValueIndex === isSelectedIndex ? !newValue : newValue;
|
|
134
|
+
})).map(newItem => ({
|
|
135
|
+
id: newItem[idIndex],
|
|
136
|
+
isSelected: newItem[isSelectedIndex]
|
|
137
|
+
}));
|
|
138
|
+
if (bubleUpNewItems) {
|
|
139
|
+
onChange(newItems);
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
onKeyPress: () => {},
|
|
143
|
+
role: "button",
|
|
144
|
+
tabIndex: 0,
|
|
145
|
+
onDoubleClick: () => {
|
|
146
|
+
onDoubleClick(itemIndex);
|
|
147
|
+
},
|
|
148
|
+
children: item.values.map((value, valueIndex) => {
|
|
149
|
+
const isIdColumn = valueIndex === idIndex;
|
|
150
|
+
const isSelectedColumn = valueIndex === isSelectedIndex;
|
|
151
|
+
const isSelectedComponent = selection === flexGridSelection.radio ? /*#__PURE__*/_jsx(Radio, {
|
|
152
|
+
name: "isSelected",
|
|
153
|
+
isChecked: item.values[isSelectedIndex] === true,
|
|
154
|
+
onChange: event => {
|
|
155
|
+
const newItems = items?.map(({
|
|
156
|
+
names,
|
|
157
|
+
values
|
|
158
|
+
}, newItemIndex) => ({
|
|
159
|
+
names,
|
|
160
|
+
values: values.map((newValue, newValueIndex) => {
|
|
161
|
+
if (newItemIndex === itemIndex && newValueIndex === isSelectedIndex) {
|
|
162
|
+
return event.target.checked;
|
|
163
|
+
}
|
|
164
|
+
if (newItemIndex === itemIndex && newValueIndex !== isSelectedIndex) {
|
|
165
|
+
return newValue;
|
|
166
|
+
}
|
|
167
|
+
if (newItemIndex !== itemIndex && newValueIndex === isSelectedIndex) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
if (newItemIndex !== itemIndex && newValueIndex !== isSelectedIndex) {
|
|
171
|
+
return newValue;
|
|
172
|
+
}
|
|
173
|
+
return newValue;
|
|
174
|
+
})
|
|
175
|
+
}));
|
|
176
|
+
onChange(newItems);
|
|
177
|
+
}
|
|
178
|
+
}) : /*#__PURE__*/_jsx(Checkbox, {
|
|
179
|
+
ariaAttr: {
|
|
180
|
+
describedBy: 'isSelected'
|
|
181
|
+
},
|
|
182
|
+
isChecked: item.values[isSelectedIndex] === true,
|
|
183
|
+
onChange: event => {
|
|
184
|
+
const newItems = items?.map(({
|
|
185
|
+
values
|
|
186
|
+
}, newItemIndex) => values?.map((newValue, newValueIndex) => newItemIndex === itemIndex && newValueIndex === isSelectedIndex ? event.target.checked : newValue)).map(newItem => ({
|
|
152
187
|
id: newItem[idIndex],
|
|
153
188
|
isSelected: newItem[isSelectedIndex]
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
if (bubleUpNewItems) {
|
|
157
|
-
_onChange(newItems);
|
|
189
|
+
}));
|
|
190
|
+
onChange(newItems);
|
|
158
191
|
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (newItemIndex !== itemIndex && newValueIndex !== isSelectedIndex) {
|
|
189
|
-
return newValue;
|
|
190
|
-
}
|
|
191
|
-
return newValue;
|
|
192
|
-
})
|
|
193
|
-
};
|
|
194
|
-
});
|
|
195
|
-
_onChange(newItems);
|
|
196
|
-
}
|
|
197
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, {
|
|
198
|
-
ariaAttr: {
|
|
199
|
-
describedBy: 'isSelected'
|
|
200
|
-
},
|
|
201
|
-
isChecked: item.values[isSelectedIndex] === true,
|
|
202
|
-
onChange: function onChange(event) {
|
|
203
|
-
var newItems = items === null || items === void 0 ? void 0 : items.map(function (_ref5, newItemIndex) {
|
|
204
|
-
var values = _ref5.values;
|
|
205
|
-
return values === null || values === void 0 ? void 0 : values.map(function (newValue, newValueIndex) {
|
|
206
|
-
return newItemIndex === itemIndex && newValueIndex === isSelectedIndex ? event.target.checked : newValue;
|
|
207
|
-
});
|
|
208
|
-
}).map(function (newItem) {
|
|
209
|
-
return {
|
|
210
|
-
id: newItem[idIndex],
|
|
211
|
-
isSelected: newItem[isSelectedIndex]
|
|
212
|
-
};
|
|
213
|
-
});
|
|
214
|
-
_onChange(newItems);
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
var iconComponent = value !== null && value !== void 0 && value.icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
|
|
218
|
-
icon: _Icon.iconName[value.icon],
|
|
219
|
-
size: _Icon.iconSize.small,
|
|
220
|
-
fill: iconColor.object
|
|
221
|
-
}) : null;
|
|
222
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {
|
|
223
|
-
children: !isIdColumn && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
224
|
-
className: (0, _classnames["default"])(_visibilityDisplay["default"]['d-flex'], _flexbox["default"]['flex-row'], _padding["default"]['p-2'], _index["default"]['css-truncate'], _index["default"]['css-truncate-overflow'], _typography["default"]['no-wrap'], (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _grid["default"]['col-2'], isSelectedColumn), _grid["default"]['col-12'], !isSelectedColumn), _flexbox["default"]['flex-justify-center'], isSelectedColumn), _flexbox["default"]['flex-justify-start'], !isSelectedColumn)),
|
|
225
|
-
children: isSelectedColumn ? isSelectedComponent : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
226
|
-
className: (0, _classnames["default"])(_index["default"]['css-truncate'], _index["default"]['css-truncate-overflow']),
|
|
227
|
-
children: [(value === null || value === void 0 ? void 0 : value.icon) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
228
|
-
children: [iconComponent, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
229
|
-
className: _margin["default"]['ml-2'],
|
|
230
|
-
children: value.value
|
|
231
|
-
})]
|
|
232
|
-
}), value instanceof Date && "".concat(value.toLocaleDateString(), " ").concat(value.toLocaleTimeString()), Array.isArray(value) && value.find(function (_ref6) {
|
|
233
|
-
var isSelected = _ref6.isSelected;
|
|
234
|
-
return isSelected === true;
|
|
235
|
-
}).text, !(value !== null && value !== void 0 && value.icon) && !(value instanceof Date) && !Array.isArray(value) && (value === null || value === void 0 ? void 0 : value.toString())]
|
|
236
|
-
})
|
|
237
|
-
}, (0, _uuid.v1)())
|
|
238
|
-
}, (0, _uuid.v1)());
|
|
239
|
-
})
|
|
240
|
-
}, (0, _uuid.v1)());
|
|
241
|
-
})]
|
|
192
|
+
});
|
|
193
|
+
const iconComponent = value?.icon ? /*#__PURE__*/_jsx(Icon, {
|
|
194
|
+
icon: iconName[value.icon],
|
|
195
|
+
size: iconSize.small,
|
|
196
|
+
fill: iconColor.object
|
|
197
|
+
}) : null;
|
|
198
|
+
return /*#__PURE__*/_jsx(Fragment, {
|
|
199
|
+
children: !isIdColumn && /*#__PURE__*/_jsx("div", {
|
|
200
|
+
className: cx(displayStyles['d-flex'], flexboxStyles['flex-row'], paddingStyles['p-2'], truncateStyles['css-truncate'], truncateStyles['css-truncate-overflow'], typographyStyles['no-wrap'], {
|
|
201
|
+
[gridStyles['col-2']]: isSelectedColumn,
|
|
202
|
+
[gridStyles['col-12']]: !isSelectedColumn,
|
|
203
|
+
[flexboxStyles['flex-justify-center']]: isSelectedColumn,
|
|
204
|
+
[flexboxStyles['flex-justify-start']]: !isSelectedColumn
|
|
205
|
+
}),
|
|
206
|
+
children: isSelectedColumn ? isSelectedComponent : /*#__PURE__*/_jsxs("div", {
|
|
207
|
+
className: cx(truncateStyles['css-truncate'], truncateStyles['css-truncate-overflow']),
|
|
208
|
+
children: [value?.icon && /*#__PURE__*/_jsxs(Fragment, {
|
|
209
|
+
children: [iconComponent, /*#__PURE__*/_jsx("span", {
|
|
210
|
+
className: marginStyles['ml-2'],
|
|
211
|
+
children: value.value
|
|
212
|
+
})]
|
|
213
|
+
}), value instanceof Date && `${value.toLocaleDateString()} ${value.toLocaleTimeString()}`, Array.isArray(value) && value.find(({
|
|
214
|
+
isSelected
|
|
215
|
+
}) => isSelected === true).text, !value?.icon && !(value instanceof Date) && !Array.isArray(value) && value?.toString()]
|
|
216
|
+
})
|
|
217
|
+
}, uuidv1())
|
|
218
|
+
}, uuidv1());
|
|
219
|
+
})
|
|
220
|
+
}, uuidv1()))]
|
|
242
221
|
});
|
|
243
222
|
}
|
|
244
|
-
FlexGrid.propTypes =
|
|
223
|
+
FlexGrid.propTypes = propTypes;
|