@carbon/ibm-products 1.11.2 → 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 (238) hide show
  1. package/README.md +0 -3
  2. package/css/components/Datagrid/styles/addons/CustomizeColumnsModal.css +47 -0
  3. package/css/components/Datagrid/styles/addons/CustomizeColumnsModal.css.map +1 -0
  4. package/css/components/Datagrid/styles/addons/RowSizeDropdown.css +20 -0
  5. package/css/components/Datagrid/styles/addons/RowSizeDropdown.css.map +1 -0
  6. package/css/components/Datagrid/styles/datagrid.css +264 -0
  7. package/css/components/Datagrid/styles/datagrid.css.map +1 -0
  8. package/css/components/Datagrid/styles/index.css +509 -0
  9. package/css/components/Datagrid/styles/index.css.map +1 -0
  10. package/css/components/Datagrid/styles/useActionsColumn.css +23 -0
  11. package/css/components/Datagrid/styles/useActionsColumn.css.map +1 -0
  12. package/css/components/Datagrid/styles/useColumnRightAlign.css +28 -0
  13. package/css/components/Datagrid/styles/useColumnRightAlign.css.map +1 -0
  14. package/css/components/Datagrid/styles/useNestedRows.css +15 -0
  15. package/css/components/Datagrid/styles/useNestedRows.css.map +1 -0
  16. package/css/components/Datagrid/styles/useNestedTable.css +25 -0
  17. package/css/components/Datagrid/styles/useNestedTable.css.map +1 -0
  18. package/css/components/Datagrid/styles/useSelectAllToggle.css +28 -0
  19. package/css/components/Datagrid/styles/useSelectAllToggle.css.map +1 -0
  20. package/css/components/Datagrid/styles/useSortableColumns.css +50 -0
  21. package/css/components/Datagrid/styles/useSortableColumns.css.map +1 -0
  22. package/css/components/Datagrid/styles/useStickyColumn.css +35 -0
  23. package/css/components/Datagrid/styles/useStickyColumn.css.map +1 -0
  24. package/css/index-full-carbon.css +2019 -376
  25. package/css/index-full-carbon.css.map +1 -1
  26. package/css/index-full-carbon.min.css +6 -6
  27. package/css/index-full-carbon.min.css.map +1 -1
  28. package/css/index-without-carbon-released-only.css +18 -6
  29. package/css/index-without-carbon-released-only.css.map +1 -1
  30. package/css/index-without-carbon-released-only.min.css +2 -2
  31. package/css/index-without-carbon-released-only.min.css.map +1 -1
  32. package/css/index-without-carbon.css +679 -19
  33. package/css/index-without-carbon.css.map +1 -1
  34. package/css/index-without-carbon.min.css +5 -5
  35. package/css/index-without-carbon.min.css.map +1 -1
  36. package/css/index.css +679 -19
  37. package/css/index.css.map +1 -1
  38. package/css/index.min.css +6 -6
  39. package/css/index.min.css.map +1 -1
  40. package/es/components/ActionBar/ActionBar.js +3 -1
  41. package/es/components/ActionBar/ActionBarOverflowItems.js +5 -3
  42. package/es/components/AddSelect/AddSelect.js +133 -30
  43. package/es/components/AddSelect/AddSelectColumn.js +0 -1
  44. package/es/components/AddSelect/AddSelectFilter.js +129 -0
  45. package/es/components/AddSelect/AddSelectList.js +59 -13
  46. package/es/components/AddSelect/AddSelectSidebar.js +15 -5
  47. package/es/components/AddSelect/add-select-utils.js +30 -0
  48. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -0
  49. package/es/components/DataSpreadsheet/DataSpreadsheet.js +262 -164
  50. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +191 -51
  51. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +65 -13
  52. package/es/components/DataSpreadsheet/hooks/index.js +10 -0
  53. package/es/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +111 -0
  54. package/es/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +2 -4
  55. package/es/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +6 -6
  56. package/es/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +3 -1
  57. package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +80 -6
  58. package/es/components/Datagrid/Datagrid/Datagrid.js +70 -0
  59. package/es/components/Datagrid/Datagrid/DatagridBody.js +36 -0
  60. package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +19 -0
  61. package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +26 -0
  62. package/es/components/Datagrid/Datagrid/DatagridHead.js +31 -0
  63. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +57 -0
  64. package/es/components/Datagrid/Datagrid/DatagridRefBody.js +37 -0
  65. package/es/components/Datagrid/Datagrid/DatagridRow.js +50 -0
  66. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +50 -0
  67. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +122 -0
  68. package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +36 -0
  69. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +22 -0
  70. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +87 -0
  71. package/es/components/Datagrid/Datagrid/DraggableElement.js +188 -0
  72. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +78 -0
  73. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +51 -0
  74. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +140 -0
  75. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +157 -0
  76. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +62 -0
  77. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +13 -0
  78. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +9 -0
  79. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +62 -0
  80. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +139 -0
  81. package/es/components/Datagrid/Datagrid/addons/RowSize/index.js +8 -0
  82. package/es/components/Datagrid/Datagrid/index.js +8 -0
  83. package/es/components/Datagrid/Datagrid.stories/CustomizeColumnStory.js +6 -0
  84. package/es/components/Datagrid/Datagrid.stories/LeftPanelStory.js +6 -0
  85. package/es/components/Datagrid/Datagrid.stories/RowSizeDropdownStory.js +6 -0
  86. package/es/components/Datagrid/Datagrid.stories/SelectAllWithToggleStory.js +6 -0
  87. package/es/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +92 -0
  88. package/es/components/Datagrid/Datagrid.stories/common.js +199 -0
  89. package/es/components/Datagrid/Datagrid.stories/index.js +5 -0
  90. package/es/components/Datagrid/common-column-ids.js +8 -0
  91. package/es/components/Datagrid/index.js +22 -0
  92. package/es/components/Datagrid/useActionsColumn.js +86 -0
  93. package/es/components/Datagrid/useColumnRightAlign.js +52 -0
  94. package/es/components/Datagrid/useCustomizeColumns.js +45 -0
  95. package/es/components/Datagrid/useDatagrid.js +44 -0
  96. package/es/components/Datagrid/useDefaultStringRenderer.js +48 -0
  97. package/es/components/Datagrid/useDisableSelectRows.js +84 -0
  98. package/es/components/Datagrid/useExpandedRow.js +52 -0
  99. package/es/components/Datagrid/useFlexResize.js +51 -0
  100. package/es/components/Datagrid/useFloatingScroll.js +88 -0
  101. package/es/components/Datagrid/useInfiniteScroll.js +54 -0
  102. package/es/components/Datagrid/useNestedRows.js +53 -0
  103. package/es/components/Datagrid/useOnRowClick.js +37 -0
  104. package/es/components/Datagrid/useParentDimensions.js +65 -0
  105. package/es/components/Datagrid/useResizeTable.js +40 -0
  106. package/es/components/Datagrid/useRowExpander.js +34 -0
  107. package/es/components/Datagrid/useRowIsMouseOver.js +61 -0
  108. package/es/components/Datagrid/useRowRenderer.js +30 -0
  109. package/es/components/Datagrid/useRowSize.js +56 -0
  110. package/es/components/Datagrid/useSelectAllToggle.js +74 -0
  111. package/es/components/Datagrid/useSelectRows.js +107 -0
  112. package/es/components/Datagrid/useSkeletonRows.js +32 -0
  113. package/es/components/Datagrid/useSortableColumns.js +110 -0
  114. package/es/components/Datagrid/useStickyColumn.js +183 -0
  115. package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +2 -3
  116. package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +2 -3
  117. package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +2 -3
  118. package/es/components/ImportModal/ImportModal.js +2 -2
  119. package/es/components/TagSet/TagSet.js +12 -3
  120. package/es/components/UserProfileImage/UserProfileImage.js +38 -10
  121. package/es/components/index.js +2 -1
  122. package/es/global/js/package-settings.js +2 -1
  123. package/lib/components/ActionBar/ActionBar.js +3 -1
  124. package/lib/components/ActionBar/ActionBarOverflowItems.js +5 -3
  125. package/lib/components/AddSelect/AddSelect.js +132 -28
  126. package/lib/components/AddSelect/AddSelectColumn.js +0 -1
  127. package/lib/components/AddSelect/AddSelectFilter.js +147 -0
  128. package/lib/components/AddSelect/AddSelectList.js +61 -12
  129. package/lib/components/AddSelect/AddSelectSidebar.js +15 -11
  130. package/lib/components/AddSelect/add-select-utils.js +35 -2
  131. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -0
  132. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +267 -168
  133. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +191 -57
  134. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +67 -18
  135. package/lib/components/DataSpreadsheet/hooks/index.js +37 -0
  136. package/lib/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +123 -0
  137. package/lib/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +2 -4
  138. package/lib/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +6 -5
  139. package/lib/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +3 -1
  140. package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +83 -7
  141. package/lib/components/Datagrid/Datagrid/Datagrid.js +86 -0
  142. package/lib/components/Datagrid/Datagrid/DatagridBody.js +50 -0
  143. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +31 -0
  144. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +38 -0
  145. package/lib/components/Datagrid/Datagrid/DatagridHead.js +43 -0
  146. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +73 -0
  147. package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +44 -0
  148. package/lib/components/Datagrid/Datagrid/DatagridRow.js +56 -0
  149. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +55 -0
  150. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +139 -0
  151. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +44 -0
  152. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +35 -0
  153. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +101 -0
  154. package/lib/components/Datagrid/Datagrid/DraggableElement.js +210 -0
  155. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +92 -0
  156. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +65 -0
  157. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +166 -0
  158. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +173 -0
  159. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +73 -0
  160. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +25 -0
  161. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +23 -0
  162. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +80 -0
  163. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +160 -0
  164. package/lib/components/Datagrid/Datagrid/addons/RowSize/index.js +15 -0
  165. package/lib/components/Datagrid/Datagrid/index.js +15 -0
  166. package/lib/components/Datagrid/Datagrid.stories/CustomizeColumnStory.js +13 -0
  167. package/lib/components/Datagrid/Datagrid.stories/LeftPanelStory.js +13 -0
  168. package/lib/components/Datagrid/Datagrid.stories/RowSizeDropdownStory.js +13 -0
  169. package/lib/components/Datagrid/Datagrid.stories/SelectAllWithToggleStory.js +13 -0
  170. package/lib/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +112 -0
  171. package/lib/components/Datagrid/Datagrid.stories/common.js +215 -0
  172. package/lib/components/Datagrid/Datagrid.stories/index.js +47 -0
  173. package/lib/components/Datagrid/common-column-ids.js +16 -0
  174. package/lib/components/Datagrid/index.js +127 -0
  175. package/lib/components/Datagrid/useActionsColumn.js +94 -0
  176. package/lib/components/Datagrid/useColumnRightAlign.js +59 -0
  177. package/lib/components/Datagrid/useCustomizeColumns.js +55 -0
  178. package/lib/components/Datagrid/useDatagrid.js +58 -0
  179. package/lib/components/Datagrid/useDefaultStringRenderer.js +54 -0
  180. package/lib/components/Datagrid/useDisableSelectRows.js +92 -0
  181. package/lib/components/Datagrid/useExpandedRow.js +58 -0
  182. package/lib/components/Datagrid/useFlexResize.js +61 -0
  183. package/lib/components/Datagrid/useFloatingScroll.js +101 -0
  184. package/lib/components/Datagrid/useInfiniteScroll.js +67 -0
  185. package/lib/components/Datagrid/useNestedRows.js +65 -0
  186. package/lib/components/Datagrid/useOnRowClick.js +45 -0
  187. package/lib/components/Datagrid/useParentDimensions.js +75 -0
  188. package/lib/components/Datagrid/useResizeTable.js +48 -0
  189. package/lib/components/Datagrid/useRowExpander.js +45 -0
  190. package/lib/components/Datagrid/useRowIsMouseOver.js +66 -0
  191. package/lib/components/Datagrid/useRowRenderer.js +40 -0
  192. package/lib/components/Datagrid/useRowSize.js +67 -0
  193. package/lib/components/Datagrid/useSelectAllToggle.js +88 -0
  194. package/lib/components/Datagrid/useSelectRows.js +119 -0
  195. package/lib/components/Datagrid/useSkeletonRows.js +42 -0
  196. package/lib/components/Datagrid/useSortableColumns.js +117 -0
  197. package/lib/components/Datagrid/useStickyColumn.js +190 -0
  198. package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +2 -3
  199. package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +2 -3
  200. package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +2 -3
  201. package/lib/components/ImportModal/ImportModal.js +1 -1
  202. package/lib/components/TagSet/TagSet.js +12 -3
  203. package/lib/components/UserProfileImage/UserProfileImage.js +38 -10
  204. package/lib/components/index.js +9 -1
  205. package/lib/global/js/package-settings.js +2 -1
  206. package/package.json +19 -15
  207. package/scss/components/AboutModal/_about-modal.scss +2 -2
  208. package/scss/components/ActionSet/_action-set.scss +3 -1
  209. package/scss/components/AddSelect/_add-select.scss +87 -3
  210. package/scss/components/CreateModal/_create-modal.scss +7 -5
  211. package/scss/components/CreateModal/_storybook-styles.scss +8 -7
  212. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +70 -10
  213. package/scss/components/Datagrid/_datagrid.scss +66 -0
  214. package/scss/components/Datagrid/_index.scss +8 -0
  215. package/scss/components/Datagrid/_storybook-styles.scss +26 -0
  216. package/scss/components/Datagrid/styles/_variables.scss +9 -0
  217. package/scss/components/Datagrid/styles/addons/CustomizeColumnsModal.scss +48 -0
  218. package/scss/components/Datagrid/styles/addons/RowSizeDropdown.scss +23 -0
  219. package/scss/components/Datagrid/styles/datagrid.scss +318 -0
  220. package/scss/components/Datagrid/styles/index.scss +17 -0
  221. package/scss/components/Datagrid/styles/useActionsColumn.scss +24 -0
  222. package/scss/components/Datagrid/styles/useColumnRightAlign.scss +29 -0
  223. package/scss/components/Datagrid/styles/useNestedRows.scss +17 -0
  224. package/scss/components/Datagrid/styles/useNestedTable.scss +28 -0
  225. package/scss/components/Datagrid/styles/useSelectAllToggle.scss +28 -0
  226. package/scss/components/Datagrid/styles/useSortableColumns.scss +55 -0
  227. package/scss/components/Datagrid/styles/useStickyColumn.scss +38 -0
  228. package/scss/components/ExportModal/_export-modal.scss +3 -3
  229. package/scss/components/HTTPErrors/_http-errors.scss +16 -16
  230. package/scss/components/InlineEdit/_inline-edit.scss +0 -1
  231. package/scss/components/ModifiedTabs/_modified-tabs.scss +0 -10
  232. package/scss/components/NotificationsPanel/_notifications-panel.scss +3 -3
  233. package/scss/components/OptionsTile/_options-tile.scss +0 -1
  234. package/scss/components/PageHeader/_page-header.scss +4 -0
  235. package/scss/components/RemoveModal/_remove-modal.scss +3 -3
  236. package/scss/components/TagSet/_tag-set.scss +2 -1
  237. package/scss/components/Tearsheet/_tearsheet.scss +5 -2
  238. package/scss/components/_index.scss +1 -0
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _carbonComponentsReact = require("carbon-components-react");
17
+
18
+ var _iconsReact = require("@carbon/icons-react");
19
+
20
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
+
22
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
+
24
+ var ordering = {
25
+ ASC: 'ASC',
26
+ DESC: 'DESC',
27
+ NONE: 'NONE'
28
+ };
29
+
30
+ var useSortableColumns = function useSortableColumns(hooks) {
31
+ var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref) {
32
+ var instance = _ref.instance;
33
+ var onSort = instance.onSort;
34
+
35
+ var onSortClick = function onSortClick(column) {
36
+ var key = column.id;
37
+ var sortDesc = column.isSortedDesc;
38
+
39
+ var _getNewSortOrder = getNewSortOrder(sortDesc),
40
+ newSortDesc = _getNewSortOrder.newSortDesc,
41
+ newOrder = _getNewSortOrder.newOrder;
42
+
43
+ if (onSort) {
44
+ onSort(key, newOrder);
45
+ }
46
+
47
+ instance.toggleSortBy(key, newSortDesc, false);
48
+ };
49
+
50
+ var sortableColumns = visibleColumns.map(function (column) {
51
+ var icon = function icon(col) {
52
+ if (col.isSorted) {
53
+ switch (col.isSortedDesc) {
54
+ case false:
55
+ return _iconsReact.ArrowUp16;
56
+
57
+ case true:
58
+ return _iconsReact.ArrowDown16;
59
+
60
+ default:
61
+ return _iconsReact.Arrows16;
62
+ }
63
+ }
64
+
65
+ return _iconsReact.Arrows16;
66
+ };
67
+
68
+ var Header = function Header(headerProp) {
69
+ return column.disableSortBy === true ? column.Header : /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
70
+ onClick: function onClick() {
71
+ return onSortClick(headerProp.column);
72
+ },
73
+ kind: "ghost",
74
+ renderIcon: icon(headerProp.column)
75
+ }, column.Header);
76
+ };
77
+
78
+ return _objectSpread(_objectSpread({}, column), {}, {
79
+ Header: Header
80
+ });
81
+ });
82
+ return (0, _toConsumableArray2.default)(sortableColumns);
83
+ };
84
+
85
+ var sortInstanceProps = function sortInstanceProps(instance) {
86
+ var onSort = instance.onSort;
87
+ Object.assign(instance, {
88
+ manualSortBy: !!onSort,
89
+ isTableSortable: true
90
+ });
91
+ };
92
+
93
+ var getNewSortOrder = function getNewSortOrder(sortOrder) {
94
+ var order = {
95
+ newSortDesc: undefined,
96
+ newOrder: ordering.NONE
97
+ };
98
+
99
+ if (sortOrder === false) {
100
+ order.newOrder = ordering.DESC;
101
+ order.newSortDesc = true;
102
+ }
103
+
104
+ if (sortOrder === undefined) {
105
+ order.newOrder = ordering.ASC;
106
+ order.newSortDesc = false;
107
+ }
108
+
109
+ return order;
110
+ };
111
+
112
+ hooks.visibleColumns.push(sortableVisibleColumns);
113
+ hooks.useInstance.push(sortInstanceProps);
114
+ };
115
+
116
+ var _default = useSortableColumns;
117
+ exports.default = _default;
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _react = require("react");
13
+
14
+ var _debounce = _interopRequireDefault(require("lodash/debounce"));
15
+
16
+ var _classnames = _interopRequireDefault(require("classnames"));
17
+
18
+ var _settings = require("../../settings");
19
+
20
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
+
22
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
+
24
+ var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
25
+ var styleClassPrefix = "".concat(blockClass, "__right-sticky-column");
26
+ var OFFSET_SCROLL_CLASS = "".concat(styleClassPrefix, "-offset-scroll");
27
+
28
+ var useStickyColumn = function useStickyColumn(hooks) {
29
+ var tableBodyRef = (0, _react.useRef)();
30
+ var stickyHeaderCellRef = (0, _react.useRef)();
31
+ hooks.getCellProps.push(changeProps.bind(null, 'cell', null));
32
+ hooks.getHeaderProps.push(changeProps.bind(null, 'header', stickyHeaderCellRef));
33
+ hooks.getTableBodyProps.push(addTableBodyProps.bind(null, tableBodyRef));
34
+ hooks.getHeaderGroupProps.push(function (props) {
35
+ return [props, {
36
+ style: _objectSpread(_objectSpread({}, props.style), {}, {
37
+ minWidth: 'unset' // unset the min-width calculated by sum of all column min-width
38
+
39
+ })
40
+ }];
41
+ });
42
+
43
+ var useEventListener = function useEventListener(instance) {
44
+ (0, _react.useEffect)(function () {
45
+ var tableBodyElement = tableBodyRef.current;
46
+ var headerCellElement = stickyHeaderCellRef.current;
47
+
48
+ if (hasVertScroll(tableBodyElement) && headerCellElement) {
49
+ headerCellElement.classList.add(OFFSET_SCROLL_CLASS);
50
+ }
51
+
52
+ var boundListener = (0, _debounce.default)(onBodyResize.bind(null, tableBodyElement, headerCellElement), 250);
53
+ window.addEventListener('resize', boundListener);
54
+ return function () {
55
+ window.removeEventListener('resize', boundListener);
56
+ };
57
+ }, [instance.rows, instance.isFetching]);
58
+ (0, _react.useEffect)(function () {
59
+ var tableBodyElement = tableBodyRef.current;
60
+ var headerCellElement = stickyHeaderCellRef.current;
61
+
62
+ var listener = function listener(evt) {
63
+ toggleStickyShadow(evt.target, headerCellElement);
64
+ };
65
+
66
+ toggleStickyShadow(tableBodyElement, headerCellElement);
67
+
68
+ if (tableBodyElement) {
69
+ tableBodyElement.addEventListener('scroll', listener);
70
+ }
71
+
72
+ return function () {
73
+ if (tableBodyElement) {
74
+ tableBodyElement.removeEventListener('scroll', listener);
75
+ }
76
+ };
77
+ }, [instance.rows, instance.isFetching]);
78
+ };
79
+
80
+ var useCheckScroll = function useCheckScroll(instance) {
81
+ var tableBodyElement = tableBodyRef.current;
82
+ var headerCellElement = stickyHeaderCellRef.current;
83
+ (0, _react.useEffect)(function () {
84
+ onBodyResize(tableBodyElement, headerCellElement);
85
+ }, [instance.rows, headerCellElement, tableBodyElement]);
86
+ };
87
+
88
+ hooks.useInstance.push(useEventListener);
89
+ hooks.useInstance.push(useCheckScroll);
90
+ hooks.useInstance.push(function (instance) {
91
+ Object.assign(instance, {
92
+ withStickyColumn: true
93
+ });
94
+ });
95
+ hooks.useInstance.push(function (instance) {
96
+ // sticky column is defined by consumer
97
+ // it will always comes after the spacer which is defined by useFlexResize
98
+ // swap them here to use the spacer to push
99
+ // sticky column to the right when there are few
100
+ // columns defined
101
+ var newColumns = instance.visibleColumns;
102
+ var spacerIdx = newColumns.findIndex(function (col) {
103
+ return col.id === 'spacer';
104
+ });
105
+ var stickyIdx = newColumns.findIndex(function (col) {
106
+ return col.sticky === 'right';
107
+ });
108
+
109
+ if (spacerIdx >= 0 && stickyIdx >= 0 && stickyIdx < spacerIdx) {
110
+ var temp = newColumns[spacerIdx];
111
+ newColumns[spacerIdx] = newColumns[stickyIdx];
112
+ newColumns[stickyIdx] = temp;
113
+ }
114
+
115
+ var newHeaders = instance.headers;
116
+ spacerIdx = newHeaders.findIndex(function (col) {
117
+ return col.id === 'spacer';
118
+ });
119
+ stickyIdx = newHeaders.findIndex(function (col) {
120
+ return col.sticky === 'right';
121
+ });
122
+
123
+ if (spacerIdx >= 0 && stickyIdx >= 0 && stickyIdx < spacerIdx) {
124
+ var _temp = newHeaders[spacerIdx];
125
+ newHeaders[spacerIdx] = newHeaders[stickyIdx];
126
+ newHeaders[stickyIdx] = _temp;
127
+ }
128
+ });
129
+ };
130
+
131
+ var addTableBodyProps = function addTableBodyProps(tableBodyRef, props) {
132
+ return [props, {
133
+ ref: tableBodyRef
134
+ }];
135
+ };
136
+
137
+ var changeProps = function changeProps(elementName, headerCellRef, props, data) {
138
+ var column = data.column || data.cell.column;
139
+
140
+ if (column.sticky === 'right') {
141
+ var _cx;
142
+
143
+ return [props, _objectSpread({
144
+ className: (0, _classnames.default)((_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(styleClassPrefix, "-").concat(elementName), true), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__resizableColumn"), false), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__sortableColumn"), false), _cx))
145
+ }, headerCellRef && {
146
+ ref: headerCellRef
147
+ })];
148
+ }
149
+
150
+ return [props];
151
+ };
152
+
153
+ var onBodyResize = function onBodyResize(tableBodyEle, headerCellEle) {
154
+ if (headerCellEle) {
155
+ if (hasVertScroll(tableBodyEle)) {
156
+ headerCellEle.classList.add(OFFSET_SCROLL_CLASS);
157
+ } else {
158
+ headerCellEle.classList.remove(OFFSET_SCROLL_CLASS);
159
+ }
160
+
161
+ toggleStickyShadow(tableBodyEle, headerCellEle);
162
+ }
163
+ };
164
+
165
+ var toggleStickyShadow = function toggleStickyShadow(tableBodyEle, headerCellEle) {
166
+ if (tableBodyEle && headerCellEle) {
167
+ var isScrolledToRight = tableBodyEle.scrollLeft + tableBodyEle.clientWidth === tableBodyEle.scrollWidth;
168
+
169
+ if (isScrolledToRight) {
170
+ headerCellEle.classList.add("".concat(blockClass, "__sticky-noShadow"));
171
+ tableBodyEle.classList.add("".concat(blockClass, "__sticky-column-noShadow"));
172
+ } else {
173
+ headerCellEle.classList.remove("".concat(blockClass, "__sticky-noShadow"));
174
+ tableBodyEle.classList.remove("".concat(blockClass, "__sticky-column-noShadow"));
175
+ }
176
+ }
177
+ };
178
+
179
+ var hasVertScroll = function hasVertScroll(element) {
180
+ if (!element) {
181
+ return false;
182
+ }
183
+
184
+ var scrollHeight = element.scrollHeight,
185
+ clientHeight = element.clientHeight;
186
+ return scrollHeight > clientHeight;
187
+ };
188
+
189
+ var _default = useStickyColumn;
190
+ exports.default = _default;
@@ -24,10 +24,9 @@ var HTTPErrorSvg403 = function HTTPErrorSvg403(_ref) {
24
24
  return /*#__PURE__*/_react.default.createElement("svg", {
25
25
  xmlns: "http://www.w3.org/2000/svg",
26
26
  xmlnsXlink: "http://www.w3.org/1999/xlink",
27
- width: 1584,
28
- height: 916,
29
27
  viewBox: "0 0 1584 916",
30
- className: className
28
+ className: className,
29
+ preserveAspectRatio: "xMinYMax meet"
31
30
  }, /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("clipPath", {
32
31
  id: "prefix__clip-path"
33
32
  }, /*#__PURE__*/_react.default.createElement("path", {
@@ -24,10 +24,9 @@ var HTTPErrorSvg404 = function HTTPErrorSvg404(_ref) {
24
24
  return /*#__PURE__*/_react.default.createElement("svg", {
25
25
  xmlns: "http://www.w3.org/2000/svg",
26
26
  xmlnsXlink: "http://www.w3.org/1999/xlink",
27
- width: 1584,
28
- height: 916,
29
27
  viewBox: "0 0 1584 916",
30
- className: className
28
+ className: className,
29
+ preserveAspectRatio: "xMinYMax meet"
31
30
  }, /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("clipPath", {
32
31
  id: "prefix__clip-path"
33
32
  }, /*#__PURE__*/_react.default.createElement("path", {
@@ -24,10 +24,9 @@ var HTTPErrorSvgOther = function HTTPErrorSvgOther(_ref) {
24
24
  return /*#__PURE__*/_react.default.createElement("svg", {
25
25
  xmlns: "http://www.w3.org/2000/svg",
26
26
  xmlnsXlink: "http://www.w3.org/1999/xlink",
27
- width: 1584,
28
- height: 916,
29
27
  viewBox: "0 0 1584 916",
30
- className: className
28
+ className: className,
29
+ preserveAspectRatio: "xMinYMax meet"
31
30
  }, /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("clipPath", {
32
31
  id: "prefix__clip-path"
33
32
  }, /*#__PURE__*/_react.default.createElement("path", {
@@ -275,7 +275,7 @@ var ImportModal = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
275
275
  size: "sm",
276
276
  disabled: importButtonDisabled
277
277
  }, inputButtonText)), /*#__PURE__*/_react.default.createElement("div", {
278
- className: "bx--file-container ".concat(blockClass, "__file-container")
278
+ className: "".concat(_settings.carbon.prefix, "--file-container ").concat(blockClass, "__file-container")
279
279
  }, hasFiles && /*#__PURE__*/_react.default.createElement("p", {
280
280
  className: "".concat(blockClass, "__helper-text")
281
281
  }, fileStatusString), files.map(function (file) {
@@ -57,7 +57,7 @@ var allTagsModalSearchThreshold = 10; // Default values for props
57
57
 
58
58
  var defaults = {
59
59
  align: 'start',
60
- allTagsModalTarget: document.body,
60
+ // allTagsModalTarget: document.body,
61
61
  overflowAlign: 'center',
62
62
  overflowDirection: 'bottom'
63
63
  };
@@ -65,8 +65,7 @@ var defaults = {
65
65
  var TagSet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
66
66
  var _ref$align = _ref.align,
67
67
  align = _ref$align === void 0 ? defaults.align : _ref$align,
68
- _ref$allTagsModalTarg = _ref.allTagsModalTarget,
69
- allTagsModalTarget = _ref$allTagsModalTarg === void 0 ? defaults.allTagsModalTarget : _ref$allTagsModalTarg,
68
+ allTagsModalTargetIn = _ref.allTagsModalTarget,
70
69
  className = _ref.className,
71
70
  maxVisible = _ref.maxVisible,
72
71
  _ref$overflowAlign = _ref.overflowAlign,
@@ -113,10 +112,20 @@ var TagSet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
113
112
 
114
113
  var overflowTag = (0, _react.useRef)(null);
115
114
 
115
+ var _useState11 = (0, _react.useState)(null),
116
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
117
+ allTagsModalTarget = _useState12[0],
118
+ setAllTagsModalTarget = _useState12[1];
119
+
116
120
  var handleShowAllClick = function handleShowAllClick() {
117
121
  setShowAllModalOpen(true);
118
122
  };
119
123
 
124
+ (0, _react.useEffect)(function () {
125
+ var _document;
126
+
127
+ setAllTagsModalTarget(allTagsModalTargetIn !== null && allTagsModalTargetIn !== void 0 ? allTagsModalTargetIn : (_document = document) === null || _document === void 0 ? void 0 : _document.body);
128
+ }, [allTagsModalTargetIn]);
120
129
  (0, _react.useEffect)(function () {
121
130
  var newSizingTags = []; // create sizing tags
122
131
 
@@ -27,7 +27,7 @@ var _iconsReact = require("@carbon/icons-react");
27
27
 
28
28
  var _carbonComponentsReact = require("carbon-components-react");
29
29
 
30
- var _excluded = ["backgroundColor", "className", "kind", "initials", "image", "imageDescription", "size", "theme", "tooltipText"];
30
+ var _excluded = ["backgroundColor", "className", "kind", "icon", "initials", "image", "imageDescription", "size", "theme", "tooltipText"];
31
31
  // The block part of our conventional BEM class names (blockClass__E--M).
32
32
  var blockClass = "".concat(_settings.pkg.prefix, "--user-profile-image");
33
33
  var componentName = 'UserProfileImage'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
@@ -40,6 +40,7 @@ var UserProfileImage = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
40
40
  var backgroundColor = _ref.backgroundColor,
41
41
  className = _ref.className,
42
42
  kind = _ref.kind,
43
+ icon = _ref.icon,
43
44
  initials = _ref.initials,
44
45
  image = _ref.image,
45
46
  imageDescription = _ref.imageDescription,
@@ -70,18 +71,40 @@ var UserProfileImage = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
70
71
  return initials.match(/(^\S\S?|\b\S)?/g).join('').match(/(^\S|\S$)?/g).join('').toUpperCase();
71
72
  };
72
73
 
73
- var FillItem = image ? function () {
74
- return /*#__PURE__*/_react.default.createElement("img", {
75
- alt: imageDescription,
76
- src: image,
77
- className: "".concat(blockClass, "__photo ").concat(blockClass, "__photo--").concat(size)
78
- });
79
- } : initials ? formatInitials : kind && size && icons[kind][size];
74
+ var getFillItem = function getFillItem() {
75
+ if (image) {
76
+ return function () {
77
+ return /*#__PURE__*/_react.default.createElement("img", {
78
+ alt: imageDescription,
79
+ src: image,
80
+ className: "".concat(blockClass, "__photo ").concat(blockClass, "__photo--").concat(size)
81
+ });
82
+ };
83
+ }
84
+
85
+ if (initials) {
86
+ return formatInitials;
87
+ }
88
+
89
+ if (kind && size) {
90
+ return icons[kind][size];
91
+ }
92
+
93
+ return icon;
94
+ }; // if user doesn't provide a color just generate a random one
95
+
96
+
97
+ var getRandomColor = function getRandomColor() {
98
+ var colors = ['light-cyan', 'dark-cyan', 'light-gray', 'dark-gray', 'light-green', 'dark-green', 'light-magenta', 'dark-magenta', 'light-purple', 'dark-purple', 'light-teal', 'dark-teal'];
99
+ return colors[Math.floor(Math.random() * colors.length)];
100
+ };
101
+
102
+ var FillItem = getFillItem();
80
103
 
81
104
  var renderUserProfileImage = function renderUserProfileImage() {
82
105
  return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
83
106
  ref: ref,
84
- className: (0, _classnames.default)([blockClass, className, "".concat(blockClass, "--").concat(size), "".concat(blockClass, "--").concat(theme), "".concat(blockClass, "--").concat(backgroundColor)])
107
+ className: (0, _classnames.default)([blockClass, className, "".concat(blockClass, "--").concat(size), "".concat(blockClass, "--").concat(theme), "".concat(blockClass, "--").concat(backgroundColor || getRandomColor())])
85
108
  }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(FillItem, null));
86
109
  };
87
110
 
@@ -107,6 +130,11 @@ UserProfileImage.propTypes = {
107
130
  */
108
131
  className: _propTypes.default.string,
109
132
 
133
+ /**
134
+ * Provide a custom icon to use if you need to use an icon other than the included ones
135
+ */
136
+ icon: _propTypes.default.object,
137
+
110
138
  /**
111
139
  * When passing the image prop, supply a full path to the image to be displayed.
112
140
  */
@@ -117,7 +145,7 @@ UserProfileImage.propTypes = {
117
145
  */
118
146
  imageDescription: _propTypes.default.string.isRequired.if(function (_ref2) {
119
147
  var image = _ref2.image;
120
- return image;
148
+ return !!image;
121
149
  }),
122
150
 
123
151
  /**
@@ -87,6 +87,12 @@ Object.defineProperty(exports, "DataSpreadsheet", {
87
87
  return _DataSpreadsheet.DataSpreadsheet;
88
88
  }
89
89
  });
90
+ Object.defineProperty(exports, "Datagrid", {
91
+ enumerable: true,
92
+ get: function get() {
93
+ return _Datagrid.Datagrid;
94
+ }
95
+ });
90
96
  Object.defineProperty(exports, "EditSidePanel", {
91
97
  enumerable: true,
92
98
  get: function get() {
@@ -356,4 +362,6 @@ var _OptionsTile = require("./OptionsTile");
356
362
 
357
363
  var _InlineEdit = require("./InlineEdit");
358
364
 
359
- var _DataSpreadsheet = require("./DataSpreadsheet");
365
+ var _DataSpreadsheet = require("./DataSpreadsheet");
366
+
367
+ var _Datagrid = require("./Datagrid");
@@ -67,7 +67,8 @@ var defaults = {
67
67
  EditSidePanel: false,
68
68
  CancelableTextEdit: false,
69
69
  InlineEdit: false,
70
- DataSpreadsheet: false
70
+ DataSpreadsheet: false,
71
+ Datagrid: false
71
72
  /* new component flags here - comment used by generate CLI */
72
73
 
73
74
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "1.11.2",
4
+ "version": "1.14.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -51,8 +51,8 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@babel/cli": "^7.17.6",
54
- "@babel/core": "^7.17.7",
55
- "babel-preset-ibm-cloud-cognitive": "^0.14.11",
54
+ "@babel/core": "^7.17.8",
55
+ "babel-preset-ibm-cloud-cognitive": "^0.14.12",
56
56
  "chalk": "^4.1.2",
57
57
  "change-case": "^4.1.2",
58
58
  "copyfiles": "^2.4.1",
@@ -60,33 +60,37 @@
60
60
  "fs-extra": "^10.0.1",
61
61
  "glob": "^7.2.0",
62
62
  "jest": "^27.5.1",
63
- "jest-config-ibm-cloud-cognitive": "^0.23.12",
63
+ "jest-config-ibm-cloud-cognitive": "^0.23.14",
64
+ "namor": "^1.1.2",
64
65
  "npm-check-updates": "^12.5.4",
65
66
  "npm-run-all": "^4.1.5",
66
67
  "rimraf": "^3.0.2",
67
- "sass": "^1.49.9",
68
- "yargs": "^17.3.1"
68
+ "sass": "^1.49.10",
69
+ "yargs": "^17.4.0"
69
70
  },
70
71
  "dependencies": {
71
- "@babel/runtime": "^7.17.7",
72
+ "@babel/runtime": "^7.17.8",
72
73
  "@carbon/telemetry": "^0.1.0",
74
+ "immutability-helper": "^3.1.1",
75
+ "react-dnd": "^15.1.2",
76
+ "react-dnd-html5-backend": "^15.1.3",
73
77
  "react-resize-detector": "^7.0.0",
74
78
  "react-table": "^7.7.0",
75
79
  "react-window": "^1.8.6"
76
80
  },
77
81
  "peerDependencies": {
78
- "@carbon/colors": "^10.37.0",
79
- "@carbon/icons-react": "^10.48.0",
82
+ "@carbon/colors": "^10.37.1",
83
+ "@carbon/icons-react": "^10.49.0",
80
84
  "@carbon/import-once": "^10.7.0",
81
- "@carbon/layout": "^10.37.0",
85
+ "@carbon/layout": "^10.37.1",
82
86
  "@carbon/motion": "^10.29.0",
83
- "@carbon/themes": "^10.53.1",
84
- "@carbon/type": "^10.43.1",
85
- "carbon-components": "^10.55.1",
86
- "carbon-components-react": "^7.55.1",
87
+ "@carbon/themes": "^10.54.0",
88
+ "@carbon/type": "^10.44.0",
89
+ "carbon-components": "^10.56.0",
90
+ "carbon-components-react": "^7.56.0",
87
91
  "carbon-icons": "^7.0.7",
88
92
  "react": "^16.8.6 || ^17.0.1",
89
93
  "react-dom": "^16.8.6 || ^17.0.1"
90
94
  },
91
- "gitHead": "1327941f8527f6ea940253307039bc99ba0a43f2"
95
+ "gitHead": "2d85df61f66068c1c23e29a498eb84b94b334d90"
92
96
  }
@@ -19,7 +19,7 @@
19
19
  // The block part of our conventional BEM class names (blockClass__E--M).
20
20
  $block-class: #{$pkg-prefix}--about-modal;
21
21
 
22
- .#{$block-class} .bx--modal-container {
22
+ .#{$block-class} .#{$carbon-prefix}--modal-container {
23
23
  grid-template-rows: auto auto 1fr auto;
24
24
  }
25
25
 
@@ -56,7 +56,7 @@
56
56
  }
57
57
 
58
58
  .#{$block-class}.#{$block-class}--with-tabs
59
- .bx--modal-content--overflow-indicator {
59
+ .#{$carbon-prefix}--modal-content--overflow-indicator {
60
60
  // stylelint-disable-next-line carbon/layout-token-use
61
61
  bottom: calc(#{$spacing-09} + #{$spacing-08});
62
62
  }
@@ -101,7 +101,9 @@
101
101
  flex: 1 1 25%;
102
102
  }
103
103
 
104
- .#{$block-class} .#{$block-class}__action-button .bx--inline-loading {
104
+ .#{$block-class}
105
+ .#{$block-class}__action-button
106
+ .#{$carbon-prefix}--inline-loading {
105
107
  position: absolute;
106
108
  top: 0;
107
109
  right: 0;