@papillonbits/components 1.13.0 → 1.14.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 (80) hide show
  1. package/build/index.js +1 -12
  2. package/build/primer/Alert/Alert.js +82 -94
  3. package/build/primer/Alert/Alert.prop.js +19 -25
  4. package/build/primer/Alert/index.js +2 -19
  5. package/build/primer/Blankslate/Blankslate.js +22 -26
  6. package/build/primer/Blankslate/Blankslate.prop.js +11 -17
  7. package/build/primer/Blankslate/index.js +2 -19
  8. package/build/primer/Breadcrumb/Breadcrumb.js +59 -61
  9. package/build/primer/Breadcrumb/Breadcrumb.prop.js +14 -20
  10. package/build/primer/Breadcrumb/index.js +2 -19
  11. package/build/primer/Button/Button.js +63 -72
  12. package/build/primer/Button/Button.prop.js +27 -33
  13. package/build/primer/Button/index.js +2 -49
  14. package/build/primer/Dropdown/Dropdown.js +79 -85
  15. package/build/primer/Dropdown/Dropdown.prop.js +15 -21
  16. package/build/primer/Dropdown/index.js +2 -19
  17. package/build/primer/ErrorBoundary/ErrorBoundary.js +35 -55
  18. package/build/primer/ErrorBoundary/ErrorBoundary.prop.js +4 -10
  19. package/build/primer/ErrorBoundary/index.js +1 -12
  20. package/build/primer/Form/Checkbox/Checkbox.js +29 -39
  21. package/build/primer/Form/Checkbox/Checkbox.prop.js +15 -21
  22. package/build/primer/Form/Checkbox/index.js +2 -19
  23. package/build/primer/Form/Input/Input.js +29 -43
  24. package/build/primer/Form/Input/Input.prop.js +19 -25
  25. package/build/primer/Form/Input/index.js +2 -25
  26. package/build/primer/Form/Radio/Radio.js +26 -38
  27. package/build/primer/Form/Radio/Radio.prop.js +14 -20
  28. package/build/primer/Form/Radio/index.js +2 -19
  29. package/build/primer/Form/index.js +11 -17
  30. package/build/primer/Grid/DisplayTable/DisplayTable.js +44 -54
  31. package/build/primer/Grid/DisplayTable/DisplayTable.prop.js +7 -13
  32. package/build/primer/Grid/DisplayTable/index.js +1 -12
  33. package/build/primer/Grid/FlexGrid/FlexGrid.js +186 -207
  34. package/build/primer/Grid/FlexGrid/FlexGrid.prop.js +24 -30
  35. package/build/primer/Grid/FlexGrid/index.js +2 -25
  36. package/build/primer/Grid/index.js +7 -13
  37. package/build/primer/Icon/Icon.js +35 -52
  38. package/build/primer/Icon/Icon.part.js +1287 -1294
  39. package/build/primer/Icon/Icon.prop.js +20 -26
  40. package/build/primer/Icon/index.js +2 -25
  41. package/build/primer/Label/Label.js +22 -28
  42. package/build/primer/Label/Label.prop.js +11 -17
  43. package/build/primer/Label/index.js +1 -12
  44. package/build/primer/Loader/Loader.js +38 -45
  45. package/build/primer/Loader/Loader.prop.js +7 -13
  46. package/build/primer/Loader/index.js +2 -19
  47. package/build/primer/Navigation/Menu/Menu.js +52 -59
  48. package/build/primer/Navigation/Menu/Menu.prop.js +16 -22
  49. package/build/primer/Navigation/Menu/index.js +1 -12
  50. package/build/primer/Navigation/TabNav/TabNav.js +89 -94
  51. package/build/primer/Navigation/TabNav/TabNav.prop.js +19 -25
  52. package/build/primer/Navigation/TabNav/index.js +2 -19
  53. package/build/primer/Navigation/UnderlineNav/UnderlineNav.js +82 -86
  54. package/build/primer/Navigation/UnderlineNav/UnderlineNav.prop.js +21 -27
  55. package/build/primer/Navigation/UnderlineNav/index.js +2 -25
  56. package/build/primer/Navigation/index.js +10 -16
  57. package/build/primer/Pagination/PreviousNext/PreviousNext.js +53 -54
  58. package/build/primer/Pagination/PreviousNext/PreviousNext.prop.js +22 -28
  59. package/build/primer/Pagination/PreviousNext/index.js +2 -19
  60. package/build/primer/Pagination/index.js +4 -10
  61. package/build/primer/Popover/Popover.js +59 -50
  62. package/build/primer/Popover/Popover.prop.js +16 -22
  63. package/build/primer/Popover/index.js +2 -25
  64. package/build/primer/Progress/Progress.js +20 -26
  65. package/build/primer/Progress/Progress.prop.js +7 -13
  66. package/build/primer/Progress/index.js +2 -19
  67. package/build/primer/Select/Select.js +43 -51
  68. package/build/primer/Select/Select.prop.js +12 -18
  69. package/build/primer/Select/index.js +2 -19
  70. package/build/primer/SelectMenu/SelectMenu.js +65 -74
  71. package/build/primer/SelectMenu/SelectMenu.prop.js +14 -20
  72. package/build/primer/SelectMenu/index.js +1 -12
  73. package/build/primer/Subhead/Subhead.js +16 -23
  74. package/build/primer/Subhead/Subhead.prop.js +6 -12
  75. package/build/primer/Subhead/index.js +1 -12
  76. package/build/primer/Toast/Toast.js +39 -46
  77. package/build/primer/Toast/Toast.prop.js +10 -16
  78. package/build/primer/Toast/index.js +2 -19
  79. package/build/primer/index.js +58 -64
  80. package/package.json +4 -4
@@ -1,58 +1,48 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.DisplayTable = DisplayTable;
8
- var _react = require("react");
9
- var _classnames = _interopRequireDefault(require("classnames"));
10
- var _uuid = require("uuid");
11
- var _visibilityDisplay = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/visibility-display.scss"));
12
- var _borders = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/borders.scss"));
13
- var _padding = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/padding.scss"));
14
- var _typography = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/typography.scss"));
15
- var _colors = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/colors.scss"));
16
- var _grid = _interopRequireDefault(require("../../Layout/grid.scss"));
17
- var _DisplayTable = require("./DisplayTable.prop");
18
- var _jsxRuntime = require("react/jsx-runtime");
19
- function DisplayTable(_ref) {
20
- var _ref$className = _ref.className,
21
- className = _ref$className === void 0 ? _DisplayTable.defaultProps.className : _ref$className,
22
- items = _ref.items,
23
- _ref$idIndex = _ref.idIndex,
24
- idIndex = _ref$idIndex === void 0 ? _DisplayTable.defaultProps.idIndex : _ref$idIndex,
25
- _ref$isSelectedIndex = _ref.isSelectedIndex,
26
- isSelectedIndex = _ref$isSelectedIndex === void 0 ? _DisplayTable.defaultProps.isSelectedIndex : _ref$isSelectedIndex;
27
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
28
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
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
- }, (0, _uuid.v1)())
38
- }, (0, _uuid.v1)());
30
+ }, uuidv1())
31
+ }, uuidv1());
39
32
  })
40
- }), items.map(function (item) {
41
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
42
- className: (0, _classnames["default"])(className, _visibilityDisplay["default"]['d-table'], _grid["default"]['col-12']),
43
- children: item.values.map(function (value, valueIndex) {
44
- var _value$value;
45
- var isIdColumn = valueIndex === idIndex;
46
- var isSelectedColumn = valueIndex === isSelectedIndex;
47
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {
48
- children: !isIdColumn && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
49
- className: (0, _classnames["default"])(_grid["default"]['col-2'], _visibilityDisplay["default"]['d-table-cell'], _borders["default"].border, _padding["default"]['p-2']),
50
- children: isSelectedColumn ? '' : (_value$value = value === null || value === void 0 ? void 0 : value.value) !== null && _value$value !== void 0 ? _value$value : value
51
- }, (0, _uuid.v1)())
52
- }, (0, _uuid.v1)());
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 = _DisplayTable.propTypes;
48
+ DisplayTable.propTypes = propTypes;
@@ -1,17 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.propTypes = exports.defaultProps = void 0;
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
- var defaultProps = exports.defaultProps = {
8
+ export const defaultProps = {
15
9
  className: null,
16
10
  idIndex: -1,
17
11
  isSelectedIndex: -1
@@ -1,12 +1 @@
1
- "use strict";
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
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.FlexGrid = FlexGrid;
8
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
- var _react = require("react");
11
- var _classnames = _interopRequireDefault(require("classnames"));
12
- var _uuid = require("uuid");
13
- var _string = require("@papillonbits/library/string");
14
- var _sort = require("@papillonbits/library/sort");
15
- var _visibilityDisplay = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/visibility-display.scss"));
16
- var _flexbox = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/flexbox.scss"));
17
- var _borders = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/borders.scss"));
18
- var _padding = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/padding.scss"));
19
- var _margin = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/margin.scss"));
20
- var _typography = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/typography.scss"));
21
- var _layout = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/layout.scss"));
22
- var _colors = _interopRequireDefault(require("@papillonbits/css/build/primer/utilities/colors.scss"));
23
- var _index = _interopRequireDefault(require("@papillonbits/css/build/primer/truncate/index.scss"));
24
- var _grid = _interopRequireDefault(require("../../Layout/grid.scss"));
25
- var _FlexGrid = require("./FlexGrid.prop");
26
- var _FlexGrid2 = _interopRequireDefault(require("./FlexGrid.scss"));
27
- var _Radio = require("../../Form/Radio");
28
- var _Checkbox = require("../../Form/Checkbox");
29
- var _Icon = require("../../Icon");
30
- var _jsxRuntime = require("react/jsx-runtime");
31
- function FlexGrid(_ref) {
32
- var _items$;
33
- var _ref$className = _ref.className,
34
- className = _ref$className === void 0 ? _FlexGrid.defaultProps.className : _ref$className,
35
- items = _ref.items,
36
- _ref$idIndex = _ref.idIndex,
37
- idIndex = _ref$idIndex === void 0 ? _FlexGrid.defaultProps.idIndex : _ref$idIndex,
38
- _ref$isSelectedIndex = _ref.isSelectedIndex,
39
- isSelectedIndex = _ref$isSelectedIndex === void 0 ? _FlexGrid.defaultProps.isSelectedIndex : _ref$isSelectedIndex,
40
- _ref$selection = _ref.selection,
41
- selection = _ref$selection === void 0 ? _FlexGrid.defaultProps.selection : _ref$selection,
42
- sort = _ref.sort,
43
- _ref$onChange = _ref.onChange,
44
- _onChange = _ref$onChange === void 0 ? _FlexGrid.defaultProps.onChange : _ref$onChange,
45
- _ref$onClick = _ref.onClick,
46
- _onClick = _ref$onClick === void 0 ? _FlexGrid.defaultProps.onClick : _ref$onClick,
47
- _ref$onDoubleClick = _ref.onDoubleClick,
48
- _onDoubleClick = _ref$onDoubleClick === void 0 ? _FlexGrid.defaultProps.onDoubleClick : _ref$onDoubleClick,
49
- _ref$iconColor = _ref.iconColor,
50
- iconColor = _ref$iconColor === void 0 ? _FlexGrid.defaultProps.iconColor : _ref$iconColor,
51
- _ref$state = _ref.state,
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(function (item) {
66
- return item.values[1];
67
- }).every(function (isSelected) {
68
- return isSelected === true;
69
- }),
70
- onChange: function onChange(event) {
71
- var newItems = items === null || items === void 0 ? void 0 : items.map(function (_ref2) {
72
- var values = _ref2.values;
73
- return values === null || values === void 0 ? void 0 : values.map(function (value, valueIndex) {
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
- var sortComponent;
66
+ let sortComponent;
86
67
  if (sort.index === nameIndex && sort.value === name) {
87
- if (sort.order === _sort.sortOrder.ascending) {
88
- sortComponent = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
89
- icon: _Icon.iconName.TriangleUp16,
90
- size: _Icon.iconSize.small,
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__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
95
- icon: _Icon.iconName.TriangleDown16,
96
- size: _Icon.iconSize.small,
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__*/(0, _jsxRuntime.jsx)(_react.Fragment, {
102
- children: !isIdColumn && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
103
- className: (0, _classnames["default"])(_typography["default"].h6, _visibilityDisplay["default"]['d-flex'], _flexbox["default"]['flex-row'], _padding["default"]['p-2'], _index["default"]['css-truncate'], _index["default"]['css-truncate-overflow'], _FlexGrid2["default"].item, (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-between'], !isSelectedColumn)),
104
- onClick: function onClick() {
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
- _onClick({
92
+ onClick({
107
93
  index: nameIndex,
108
94
  value: name,
109
95
  order: sort.order
110
96
  });
111
97
  }
112
98
  },
113
- onKeyPress: function onKeyPress() {},
99
+ onKeyPress: () => {},
114
100
  role: "button",
115
101
  tabIndex: 0,
116
- children: isSelectedColumn ? isSelectedComponent : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
117
- className: (0, _classnames["default"])(_visibilityDisplay["default"]['d-flex'], _flexbox["default"]['flex-justify-between'], _layout["default"]['width-full']),
118
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
119
- className: (0, _classnames["default"])(_index["default"]['css-truncate'], _index["default"]['css-truncate-overflow']),
120
- children: (0, _string.getCapizalizedString)({
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__*/(0, _jsxRuntime.jsxs)("div", {
124
- className: (0, _classnames["default"])(_visibilityDisplay["default"]['d-flex'], _flexbox["default"]['flex-items-start'], _margin["default"]['ml-1']),
125
- children: [sortComponent, nameIndex < (items === null || items === void 0 || (_items$2 = items[0]) === null || _items$2 === void 0 ? void 0 : _items$2.names.length) - 1 ?
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
- (0, _jsxRuntime.jsx)("span", {
129
- className: (0, _classnames["default"])(_margin["default"]['ml-1'], _colors["default"]['text-gray-light']),
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
- }, (0, _uuid.v1)());
121
+ }, uuidv1());
136
122
  })
137
- }), items === null || items === void 0 ? void 0 : items.map(function (item, itemIndex) {
138
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
139
- className: (0, _classnames["default"])(_visibilityDisplay["default"]['d-flex'], _flexbox["default"]['flex-row'], _flexbox["default"]['flex-items-start'], _borders["default"].border, _FlexGrid2["default"].item, _FlexGrid2["default"].row),
140
- onClick: function onClick() {
141
- var bubleUpNewItems = true;
142
- var newItems = items === null || items === void 0 ? void 0 : items.map(function (_ref3, newItemIndex) {
143
- var values = _ref3.values;
144
- return values === null || values === void 0 ? void 0 : values.map(function (newValue, newValueIndex) {
145
- if ((0, _typeof2["default"])(newValue) === 'object' && ['FileDirectory16', 'File16'].includes(newValue === null || newValue === void 0 ? void 0 : newValue.icon)) {
146
- bubleUpNewItems = false;
147
- }
148
- return newItemIndex === itemIndex && newValueIndex === isSelectedIndex ? !newValue : newValue;
149
- });
150
- }).map(function (newItem) {
151
- return {
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
- onKeyPress: function onKeyPress() {},
161
- role: "button",
162
- tabIndex: 0,
163
- onDoubleClick: function onDoubleClick() {
164
- _onDoubleClick(itemIndex);
165
- },
166
- children: item.values.map(function (value, valueIndex) {
167
- var isIdColumn = valueIndex === idIndex;
168
- var isSelectedColumn = valueIndex === isSelectedIndex;
169
- var isSelectedComponent = selection === _FlexGrid.flexGridSelection.radio ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Radio.Radio, {
170
- name: "isSelected",
171
- isChecked: item.values[isSelectedIndex] === true,
172
- onChange: function onChange(event) {
173
- var newItems = items === null || items === void 0 ? void 0 : items.map(function (_ref4, newItemIndex) {
174
- var names = _ref4.names,
175
- values = _ref4.values;
176
- return {
177
- names: names,
178
- values: values.map(function (newValue, newValueIndex) {
179
- if (newItemIndex === itemIndex && newValueIndex === isSelectedIndex) {
180
- return event.target.checked;
181
- }
182
- if (newItemIndex === itemIndex && newValueIndex !== isSelectedIndex) {
183
- return newValue;
184
- }
185
- if (newItemIndex !== itemIndex && newValueIndex === isSelectedIndex) {
186
- return false;
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 = _FlexGrid.propTypes;
223
+ FlexGrid.propTypes = propTypes;