@carbon/ibm-products 2.0.0-rc.2 → 2.0.0-rc.21
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +19 -2
- package/css/index-full-carbon.css +1376 -403
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +8 -8
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +1413 -385
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +4 -8
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +1295 -453
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +8 -8
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +1170 -333
- package/css/index.css.map +1 -1
- package/css/index.min.css +8 -8
- package/css/index.min.css.map +1 -1
- package/es/components/APIKeyModal/APIKeyModal.js +1 -1
- package/es/components/ActionBar/ActionBarOverflowItems.js +1 -0
- package/es/components/ActionSet/ActionSet.js +7 -3
- package/es/components/AddSelect/AddSelect.js +6 -6
- package/es/components/AddSelect/AddSelectBody.js +73 -32
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +12 -4
- package/es/components/AddSelect/AddSelectColumn.js +8 -8
- package/es/components/AddSelect/AddSelectFilter.js +10 -7
- package/es/components/AddSelect/AddSelectList.js +64 -29
- package/es/components/AddSelect/AddSelectMetaPanel.js +7 -1
- package/es/components/AddSelect/AddSelectSidebar.js +5 -2
- package/es/components/AddSelect/AddSelectSort.js +2 -2
- package/es/components/AddSelect/add-select-utils.js +9 -2
- package/es/components/AddSelect/hooks/useItemSort.js +6 -0
- package/es/components/AddSelect/hooks/useParentSelect.js +6 -0
- package/es/components/AddSelect/hooks/usePath.js +23 -2
- package/es/components/AddSelect/index.js +1 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +4 -6
- package/es/components/ButtonMenu/ButtonMenu.js +4 -3
- package/es/components/Card/Card.js +16 -6
- package/es/components/Card/CardFooter.js +3 -1
- package/es/components/Card/CardHeader.js +20 -1
- package/es/components/ComboButton/ComboButton.js +1 -1
- package/es/components/CreateFullPage/CreateFullPage.js +13 -3
- package/es/components/CreateTearsheet/CreateTearsheet.js +17 -3
- package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +3 -1
- package/es/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +2 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +65 -15
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -1
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +7 -0
- package/es/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +6 -5
- package/es/components/DataSpreadsheet/utils/handleCellDeletion.js +42 -0
- package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +1 -1
- package/es/components/Datagrid/Datagrid/Datagrid.js +16 -40
- package/es/components/Datagrid/Datagrid/DatagridContent.js +194 -0
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +18 -8
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -1
- package/es/components/Datagrid/Datagrid/DatagridHead.js +1 -2
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -4
- package/es/components/Datagrid/Datagrid/DatagridRow.js +44 -7
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +11 -5
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +13 -4
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +1 -2
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +14 -10
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +32 -11
- package/es/components/Datagrid/Datagrid/DraggableElement.js +12 -4
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +11 -54
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +15 -14
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +63 -31
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +193 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +56 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +256 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +270 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +91 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/constants.js +28 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/index.js +10 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +310 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +25 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +38 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useSubscribeToEventEmitter.js +25 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/index.js +9 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/motion/variants.js +55 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/utils.js +72 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +60 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +541 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +112 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js +27 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +39 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js +19 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +262 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +87 -0
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +17 -14
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +13 -36
- package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/index.js +0 -1
- package/es/components/Datagrid/index.js +4 -1
- package/es/components/Datagrid/useActionsColumn.js +28 -12
- package/es/components/Datagrid/useColumnOrder.js +8 -0
- package/es/components/Datagrid/useCustomizeColumns.js +13 -8
- package/es/components/Datagrid/useDisableSelectRows.js +6 -2
- package/es/components/Datagrid/useExpandedRow.js +0 -1
- package/es/components/Datagrid/useFiltering.js +99 -0
- package/es/components/Datagrid/useInfiniteScroll.js +5 -2
- package/es/components/Datagrid/useInlineEdit.js +71 -0
- package/es/components/Datagrid/useNestedRowExpander.js +47 -0
- package/es/components/Datagrid/useNestedRows.js +16 -4
- package/es/components/Datagrid/useParentDimensions.js +3 -1
- package/es/components/Datagrid/useRowExpander.js +12 -4
- package/es/components/Datagrid/useRowSize.js +17 -6
- package/es/components/Datagrid/useSelectAllToggle.js +17 -4
- package/es/components/Datagrid/useSelectRows.js +13 -4
- package/es/components/Datagrid/useSortableColumns.js +15 -9
- package/es/components/Datagrid/useStickyColumn.js +11 -0
- package/es/components/Datagrid/utils/DatagridActions.js +249 -0
- package/es/components/Datagrid/utils/DatagridPagination.js +33 -0
- package/es/components/Datagrid/utils/Wrapper.js +21 -0
- package/es/components/Datagrid/utils/getArgTypes.js +94 -0
- package/es/components/Datagrid/utils/getInlineEditColumns.js +159 -0
- package/es/components/Datagrid/utils/makeData.js +54 -1
- package/es/components/EditUpdateCards/EditUpdateCards.js +144 -0
- package/es/components/EditUpdateCards/index.js +7 -0
- package/es/components/ExportModal/ExportModal.js +1 -1
- package/es/components/FilterSummary/FilterSummary.js +54 -0
- package/es/components/FilterSummary/index.js +7 -0
- package/es/components/ImportModal/ImportModal.js +3 -3
- package/es/components/InlineEdit/InlineEdit.js +28 -426
- package/es/components/InlineEditV1/InlineEditV1.js +447 -0
- package/es/components/InlineEditV1/index.js +7 -0
- package/es/components/InlineEditV2/InlineEditV2.js +289 -0
- package/es/components/InlineEditV2/index.js +7 -0
- package/es/components/ModifiedTabs/ModifiedTabLabelNew.js +1 -1
- package/es/components/ModifiedTabs/ModifiedTabLabelWithClose.js +1 -1
- package/es/components/MultiAddSelect/MultiAddSelect.js +14 -7
- package/es/components/MultiAddSelect/index.js +6 -0
- package/es/components/NotificationsPanel/NotificationsPanel.js +1 -1
- package/es/components/OptionsTile/OptionsTile.js +32 -16
- package/es/components/PageHeader/PageHeader.js +4 -4
- package/es/components/PageHeader/PageHeaderTitle.js +1 -1
- package/es/components/ProductiveCard/ProductiveCard.js +5 -0
- package/es/components/RemoveModal/RemoveModal.js +20 -3
- package/es/components/Saving/Saving.js +1 -1
- package/es/components/SidePanel/SidePanel.js +45 -52
- package/es/components/SidePanel/motion/variants.js +45 -0
- package/es/components/SingleAddSelect/SingleAddSelect.js +6 -0
- package/es/components/SingleAddSelect/index.js +6 -0
- package/es/components/StatusIcon/StatusIcon.js +1 -1
- package/es/components/Tearsheet/Tearsheet.js +5 -0
- package/es/components/Tearsheet/TearsheetNarrow.js +5 -0
- package/es/components/Tearsheet/TearsheetShell.js +1 -1
- package/es/components/UserProfileImage/UserProfileImage.js +1 -1
- package/es/components/WebTerminal/WebTerminal.js +1 -1
- package/es/components/WebTerminal/preview-components/Navigation.js +1 -1
- package/es/components/index.js +4 -3
- package/es/global/js/hooks/index.js +2 -1
- package/es/global/js/hooks/useClickOutside.js +1 -1
- package/es/global/js/hooks/useControllableState.js +83 -0
- package/es/global/js/hooks/useCreateComponentFocus.js +38 -10
- package/es/global/js/hooks/useResetCreateComponent.js +6 -2
- package/es/global/js/package-settings.js +9 -6
- package/es/global/js/utils/getBezierValues.js +20 -0
- package/es/global/js/utils/getNumberOfHiddenSteps.js +19 -0
- package/es/global/js/utils/motionConstants.js +45 -0
- package/es/global/js/utils/rangeWithCallback.js +13 -0
- package/es/global/js/utils/story-helper.js +5 -1
- package/es/global/js/utils/uuidv4.spec.js +4 -0
- package/lib/components/APIKeyModal/APIKeyModal.js +4 -4
- package/lib/components/ActionBar/ActionBarOverflowItems.js +1 -0
- package/lib/components/ActionSet/ActionSet.js +7 -3
- package/lib/components/AddSelect/AddSelect.js +5 -6
- package/lib/components/AddSelect/AddSelectBody.js +68 -31
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +15 -4
- package/lib/components/AddSelect/AddSelectColumn.js +7 -7
- package/lib/components/AddSelect/AddSelectFilter.js +9 -6
- package/lib/components/AddSelect/AddSelectList.js +65 -30
- package/lib/components/AddSelect/AddSelectMetaPanel.js +8 -2
- package/lib/components/AddSelect/AddSelectSidebar.js +4 -1
- package/lib/components/AddSelect/AddSelectSort.js +5 -5
- package/lib/components/AddSelect/add-select-utils.js +9 -2
- package/lib/components/AddSelect/hooks/useItemSort.js +6 -0
- package/lib/components/AddSelect/hooks/useParentSelect.js +6 -0
- package/lib/components/AddSelect/hooks/usePath.js +16 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +6 -6
- package/lib/components/ButtonMenu/ButtonMenu.js +4 -3
- package/lib/components/Card/Card.js +16 -6
- package/lib/components/Card/CardFooter.js +3 -1
- package/lib/components/Card/CardHeader.js +21 -1
- package/lib/components/ComboButton/ComboButton.js +3 -3
- package/lib/components/CreateFullPage/CreateFullPage.js +13 -3
- package/lib/components/CreateTearsheet/CreateTearsheet.js +18 -3
- package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +3 -1
- package/lib/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +2 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +65 -14
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +7 -0
- package/lib/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +6 -5
- package/lib/components/DataSpreadsheet/utils/handleCellDeletion.js +53 -0
- package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +1 -1
- package/lib/components/Datagrid/Datagrid/Datagrid.js +19 -47
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +230 -0
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +19 -9
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -1
- package/lib/components/Datagrid/Datagrid/DatagridHead.js +1 -3
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +2 -5
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +46 -8
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +14 -6
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +16 -5
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +1 -2
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +14 -10
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +33 -10
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +12 -4
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +11 -49
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +11 -8
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +76 -46
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/{CustomizeColumnsModal.js → CustomizeColumnsTearsheet.js} +85 -48
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/{ModalWrapper.js → TearsheetWrapper.js} +32 -36
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +3 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +284 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +301 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +112 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/constants.js +47 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/index.js +39 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +325 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +37 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +50 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useSubscribeToEventEmitter.js +35 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/index.js +37 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/motion/variants.js +67 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/utils.js +82 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +76 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/index.js +13 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +566 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/index.js +13 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +129 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js +36 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/index.js +19 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +45 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js +28 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +271 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +100 -0
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +17 -13
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +13 -35
- package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/index.js +0 -8
- package/lib/components/Datagrid/index.js +25 -1
- package/lib/components/Datagrid/useActionsColumn.js +28 -13
- package/lib/components/Datagrid/useColumnOrder.js +17 -0
- package/lib/components/Datagrid/useCustomizeColumns.js +12 -7
- package/lib/components/Datagrid/useDisableSelectRows.js +6 -2
- package/lib/components/Datagrid/useExpandedRow.js +0 -1
- package/lib/components/Datagrid/useFiltering.js +105 -0
- package/lib/components/Datagrid/useInfiniteScroll.js +5 -2
- package/lib/components/Datagrid/useInlineEdit.js +85 -0
- package/lib/components/Datagrid/useNestedRowExpander.js +63 -0
- package/lib/components/Datagrid/useNestedRows.js +17 -4
- package/lib/components/Datagrid/useParentDimensions.js +3 -1
- package/lib/components/Datagrid/useRowExpander.js +17 -5
- package/lib/components/Datagrid/useRowSize.js +18 -13
- package/lib/components/Datagrid/useSelectAllToggle.js +18 -4
- package/lib/components/Datagrid/useSelectRows.js +13 -4
- package/lib/components/Datagrid/useSortableColumns.js +16 -7
- package/lib/components/Datagrid/useStickyColumn.js +11 -0
- package/lib/components/Datagrid/utils/DatagridActions.js +275 -0
- package/lib/components/Datagrid/utils/DatagridPagination.js +46 -0
- package/lib/components/Datagrid/utils/Wrapper.js +33 -0
- package/lib/components/Datagrid/utils/getArgTypes.js +102 -0
- package/lib/components/Datagrid/utils/getInlineEditColumns.js +174 -0
- package/lib/components/Datagrid/utils/makeData.js +56 -2
- package/lib/components/EditUpdateCards/EditUpdateCards.js +152 -0
- package/lib/components/EditUpdateCards/index.js +13 -0
- package/lib/components/ExportModal/ExportModal.js +3 -3
- package/lib/components/FilterSummary/FilterSummary.js +72 -0
- package/lib/components/FilterSummary/index.js +15 -0
- package/lib/components/ImportModal/ImportModal.js +4 -4
- package/lib/components/InlineEdit/InlineEdit.js +27 -426
- package/lib/components/InlineEditV1/InlineEditV1.js +464 -0
- package/lib/components/InlineEditV1/index.js +13 -0
- package/lib/components/InlineEditV2/InlineEditV2.js +309 -0
- package/lib/components/InlineEditV2/index.js +13 -0
- package/lib/components/ModifiedTabs/ModifiedTabLabelNew.js +2 -2
- package/lib/components/ModifiedTabs/ModifiedTabLabelWithClose.js +3 -3
- package/lib/components/MultiAddSelect/MultiAddSelect.js +14 -7
- package/lib/components/NotificationsPanel/NotificationsPanel.js +8 -8
- package/lib/components/OptionsTile/OptionsTile.js +36 -19
- package/lib/components/PageHeader/PageHeader.js +5 -5
- package/lib/components/PageHeader/PageHeaderTitle.js +1 -1
- package/lib/components/ProductiveCard/ProductiveCard.js +5 -0
- package/lib/components/RemoveModal/RemoveModal.js +20 -3
- package/lib/components/Saving/Saving.js +5 -5
- package/lib/components/SidePanel/SidePanel.js +48 -53
- package/lib/components/SidePanel/motion/variants.js +55 -0
- package/lib/components/SingleAddSelect/SingleAddSelect.js +6 -0
- package/lib/components/StatusIcon/StatusIcon.js +45 -45
- package/lib/components/Tearsheet/Tearsheet.js +5 -0
- package/lib/components/Tearsheet/TearsheetNarrow.js +5 -0
- package/lib/components/Tearsheet/TearsheetShell.js +1 -1
- package/lib/components/UserProfileImage/UserProfileImage.js +7 -7
- package/lib/components/WebTerminal/WebTerminal.js +3 -3
- package/lib/components/WebTerminal/preview-components/Navigation.js +4 -4
- package/lib/components/index.js +33 -1
- package/lib/global/js/hooks/index.js +9 -1
- package/lib/global/js/hooks/useClickOutside.js +1 -1
- package/lib/global/js/hooks/useControllableState.js +94 -0
- package/lib/global/js/hooks/useCreateComponentFocus.js +42 -11
- package/lib/global/js/hooks/useResetCreateComponent.js +7 -2
- package/lib/global/js/package-settings.js +9 -6
- package/lib/global/js/utils/getBezierValues.js +29 -0
- package/lib/global/js/utils/getNumberOfHiddenSteps.js +28 -0
- package/lib/global/js/utils/motionConstants.js +55 -0
- package/lib/global/js/utils/rangeWithCallback.js +22 -0
- package/lib/global/js/utils/story-helper.js +5 -1
- package/lib/global/js/utils/uuidv4.spec.js +4 -0
- package/package.json +18 -16
- package/scss/components/ActionSet/_action-set.scss +9 -4
- package/scss/components/AddSelect/_add-select.scss +132 -34
- package/scss/components/AddSelect/_index.scss +1 -1
- package/scss/components/AddSelect/_storybook-styles.scss +1 -1
- package/scss/components/Card/_card.scss +1 -0
- package/scss/components/Cascade/_cascade.scss +1 -1
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +2 -0
- package/scss/components/Datagrid/_datagrid.scss +7 -1
- package/scss/components/Datagrid/_storybook-styles.scss +29 -5
- package/scss/components/Datagrid/styles/_datagrid.scss +133 -41
- package/scss/components/Datagrid/styles/_draggableElement.scss +50 -18
- package/scss/components/Datagrid/styles/_index.scss +10 -8
- package/scss/components/Datagrid/styles/_useActionsColumn.scss +14 -0
- package/scss/components/Datagrid/styles/_useExpandedRow.scss +56 -10
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +419 -0
- package/scss/components/Datagrid/styles/_useNestedRows.scss +33 -1
- package/scss/components/Datagrid/styles/_useSortableColumns.scss +35 -16
- package/scss/components/Datagrid/styles/_useStickyColumn.scss +31 -2
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsTearsheet.scss +69 -0
- package/scss/components/Datagrid/styles/addons/_FilterFlyout.scss +87 -0
- package/scss/components/Datagrid/styles/addons/_FilterPanel.scss +129 -0
- package/scss/components/Datagrid/styles/addons/_RowSizeDropdown.scss +12 -4
- package/scss/components/EditUpdateCards/_carbon-imports.scss +9 -0
- package/scss/components/EditUpdateCards/_edit-update-cards.scss +85 -0
- package/scss/components/EditUpdateCards/_index-with-carbon.scss +9 -0
- package/scss/components/EditUpdateCards/_index.scss +8 -0
- package/scss/components/EditUpdateCards/_storybook-styles.scss +55 -0
- package/scss/components/FilterSummary/_filter-summary.scss +21 -0
- package/scss/components/FilterSummary/_index.scss +10 -0
- package/scss/components/FilterSummary/_storybook-styles.scss +14 -0
- package/scss/components/{InlineEdit → InlineEditV1}/_index-with-carbon.scss +1 -1
- package/scss/components/{InlineEdit → InlineEditV1}/_index.scss +1 -1
- package/scss/components/{InlineEdit/_inline-edit.scss → InlineEditV1/_inline-edit-v1.scss} +4 -2
- package/scss/components/InlineEditV2/_carbon-imports.scss +9 -0
- package/scss/components/InlineEditV2/_index-with-carbon.scss +9 -0
- package/scss/components/InlineEditV2/_index.scss +10 -0
- package/scss/components/InlineEditV2/_inline-edit-v2.scss +83 -0
- package/scss/components/InlineEditV2/_storybook-styles.scss +9 -0
- package/scss/components/MultiAddSelect/_multi-add-select.scss +8 -1
- package/scss/components/MultiAddSelect/_storybook-styles.scss +1 -1
- package/scss/components/NotificationsPanel/_notifications-panel.scss +3 -6
- package/scss/components/OptionsTile/_options-tile.scss +10 -3
- package/scss/components/RemoveModal/_remove-modal.scss +0 -4
- package/scss/components/SidePanel/_side-panel.scss +3 -82
- package/scss/components/SidePanel/_storybook-styles.scss +6 -1
- package/scss/components/SingleAddSelect/_carbon-imports.scss +1 -1
- package/scss/components/SingleAddSelect/_index-with-carbon.scss +1 -1
- package/scss/components/SingleAddSelect/_index.scss +7 -0
- package/scss/components/SingleAddSelect/_single-add-select.scss +8 -1
- package/scss/components/SingleAddSelect/_storybook-styles.scss +1 -1
- package/scss/components/Tearsheet/_tearsheet.scss +4 -2
- package/scss/components/_index-released-only-with-carbon.scss +3 -1
- package/scss/components/_index-released-only.scss +4 -1
- package/scss/components/_index-with-carbon.scss +3 -1
- package/scss/components/_index.scss +4 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +0 -157
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +0 -62
- package/es/components/Datagrid/Datagrid.stories-helpers/LeftPanelStory.js +0 -6
- package/lib/components/Datagrid/Datagrid.stories-helpers/LeftPanelStory.js +0 -13
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsModal.scss +0 -52
- /package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/CustomizeColumnStory.js +0 -0
- /package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/RowSizeDropdownStory.js +0 -0
- /package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/SelectAllWithToggleStory.js +0 -0
- /package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/StickyActionsColumnStory.js +0 -0
- /package/es/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/common.js +0 -0
- /package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/CustomizeColumnStory.js +0 -0
- /package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/RowSizeDropdownStory.js +0 -0
- /package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/SelectAllWithToggleStory.js +0 -0
- /package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/StickyActionsColumnStory.js +0 -0
- /package/lib/components/Datagrid/{Datagrid.stories-helpers → Datagrid.stories}/common.js +0 -0
- /package/scss/components/{InlineEdit → InlineEditV1}/_carbon-imports.scss +0 -0
- /package/scss/components/{InlineEdit → InlineEditV1}/_storybook-styles.scss +0 -0
@@ -0,0 +1,310 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
5
|
+
|
6
|
+
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; }
|
7
|
+
|
8
|
+
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) { _defineProperty(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; }
|
9
|
+
|
10
|
+
/*
|
11
|
+
* Licensed Materials - Property of IBM
|
12
|
+
* 5724-Q36
|
13
|
+
* (c) Copyright IBM Corp. 2023
|
14
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
15
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
16
|
+
*/
|
17
|
+
import React, { useState, useRef } from 'react';
|
18
|
+
import { Checkbox, DatePicker, DatePickerInput, Dropdown, FormGroup, NumberInput, RadioButton, RadioButtonGroup, Layer } from '@carbon/react';
|
19
|
+
import { INSTANT, DATE, CHECKBOX, NUMBER, RADIO, DROPDOWN, PANEL } from '../constants';
|
20
|
+
import useInitialStateFromFilters from './useInitialStateFromFilters';
|
21
|
+
import { getInitialStateFromFilters } from '../utils';
|
22
|
+
|
23
|
+
var useFilters = function useFilters(_ref) {
|
24
|
+
var updateMethod = _ref.updateMethod,
|
25
|
+
_ref$filters = _ref.filters,
|
26
|
+
filters = _ref$filters === void 0 ? [] : _ref$filters,
|
27
|
+
setAllFilters = _ref.setAllFilters,
|
28
|
+
variation = _ref.variation;
|
29
|
+
|
30
|
+
/** State */
|
31
|
+
var _useInitialStateFromF = useInitialStateFromFilters(filters, variation),
|
32
|
+
_useInitialStateFromF2 = _slicedToArray(_useInitialStateFromF, 2),
|
33
|
+
filtersState = _useInitialStateFromF2[0],
|
34
|
+
setFiltersState = _useInitialStateFromF2[1];
|
35
|
+
|
36
|
+
var _useState = useState([]),
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
38
|
+
filtersObjectArray = _useState2[0],
|
39
|
+
setFiltersObjectArray = _useState2[1]; // When using batch actions we have to store the filters to then apply them later
|
40
|
+
|
41
|
+
|
42
|
+
var prevFiltersRef = useRef(JSON.stringify(filtersState));
|
43
|
+
var prevFiltersObjectArrayRef = useRef(JSON.stringify(filtersObjectArray));
|
44
|
+
/** Methods */
|
45
|
+
// If the user decides to cancel or click outside the flyout, it reverts back to the filters that were
|
46
|
+
// there when they opened the flyout
|
47
|
+
|
48
|
+
var revertToPreviousFilters = function revertToPreviousFilters() {
|
49
|
+
setFiltersState(JSON.parse(prevFiltersRef.current));
|
50
|
+
setFiltersObjectArray(JSON.parse(prevFiltersObjectArrayRef.current));
|
51
|
+
};
|
52
|
+
|
53
|
+
var reset = function reset() {
|
54
|
+
// Get the initial values for the filters
|
55
|
+
var initialFiltersState = getInitialStateFromFilters(filters, variation);
|
56
|
+
var initialFiltersObjectArray = []; // Set the state to the initial values
|
57
|
+
|
58
|
+
setFiltersState(initialFiltersState);
|
59
|
+
setFiltersObjectArray(initialFiltersObjectArray);
|
60
|
+
setAllFilters([]); // Update their respective refs so everything is in sync
|
61
|
+
|
62
|
+
prevFiltersRef.current = JSON.stringify(initialFiltersState);
|
63
|
+
prevFiltersObjectArrayRef.current = JSON.stringify(initialFiltersObjectArray);
|
64
|
+
};
|
65
|
+
|
66
|
+
var applyFilters = function applyFilters(_ref2) {
|
67
|
+
var column = _ref2.column,
|
68
|
+
value = _ref2.value,
|
69
|
+
type = _ref2.type;
|
70
|
+
|
71
|
+
// If no end date is selected return because we need the end date to do computations
|
72
|
+
if (type === DATE && value.length > 0 && !value[1]) {
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
|
76
|
+
var filtersObjectArrayCopy = _toConsumableArray(filtersObjectArray); // // check if the filter already exists in the array
|
77
|
+
|
78
|
+
|
79
|
+
var filter = filtersObjectArrayCopy.find(function (item) {
|
80
|
+
return item.id === column;
|
81
|
+
}); // // if filter exists in array then update the filter's new value
|
82
|
+
|
83
|
+
if (filter) {
|
84
|
+
filter.value = value;
|
85
|
+
} else {
|
86
|
+
filtersObjectArrayCopy.push({
|
87
|
+
id: column,
|
88
|
+
value: value,
|
89
|
+
type: type
|
90
|
+
});
|
91
|
+
} // ATTENTION: this is where you would reset or remove individual filters from the filters array
|
92
|
+
|
93
|
+
|
94
|
+
if (type === CHECKBOX) {
|
95
|
+
/**
|
96
|
+
When all checkboxes of a group are all unselected the value still exists in the filtersObjectArray
|
97
|
+
This checks if all the checkboxes are selected = false and removes it from the array
|
98
|
+
*/
|
99
|
+
var index = filtersObjectArrayCopy.findIndex(function (filter) {
|
100
|
+
return filter.id === column;
|
101
|
+
}); // If all the selected state is false remove from array
|
102
|
+
|
103
|
+
var shouldRemoveFromArray = filtersObjectArrayCopy[index].value.every(function (val) {
|
104
|
+
return val.selected === false;
|
105
|
+
});
|
106
|
+
|
107
|
+
if (shouldRemoveFromArray) {
|
108
|
+
filtersObjectArrayCopy.splice(index, 1);
|
109
|
+
}
|
110
|
+
} else if (type === DATE) {
|
111
|
+
if (value.length === 0) {
|
112
|
+
/**
|
113
|
+
Checks to see if the date value is an empty array, if it is that means the user wants
|
114
|
+
to reset the date filter
|
115
|
+
*/
|
116
|
+
var _index = filtersObjectArrayCopy.findIndex(function (filter) {
|
117
|
+
return filter.id === column;
|
118
|
+
}); // Remove it from the filters array since there is nothing to filter
|
119
|
+
|
120
|
+
|
121
|
+
filtersObjectArrayCopy.splice(_index, 1);
|
122
|
+
}
|
123
|
+
} else if (type === DROPDOWN || type === RADIO) {
|
124
|
+
if (value === 'Any') {
|
125
|
+
/**
|
126
|
+
Checks to see if the selected value is 'Any', that means the user wants
|
127
|
+
to reset specific filter
|
128
|
+
*/
|
129
|
+
var _index2 = filtersObjectArrayCopy.findIndex(function (filter) {
|
130
|
+
return filter.id === column;
|
131
|
+
}); // Remove it from the filters array
|
132
|
+
|
133
|
+
|
134
|
+
filtersObjectArrayCopy.splice(_index2, 1);
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
setFiltersObjectArray(filtersObjectArrayCopy); // // Automatically apply the filters if the updateMethod is instant
|
139
|
+
|
140
|
+
if (updateMethod === INSTANT) {
|
141
|
+
setAllFilters(filtersObjectArrayCopy);
|
142
|
+
}
|
143
|
+
};
|
144
|
+
/** Render the individual filter component */
|
145
|
+
|
146
|
+
|
147
|
+
var renderFilter = function renderFilter(_ref3) {
|
148
|
+
var _filtersState$column, _filtersState$column2, _filtersState$column3, _filtersState$column4;
|
149
|
+
|
150
|
+
var type = _ref3.type,
|
151
|
+
column = _ref3.column,
|
152
|
+
components = _ref3.props;
|
153
|
+
var isPanel = variation === PANEL;
|
154
|
+
var filter;
|
155
|
+
|
156
|
+
switch (type) {
|
157
|
+
case DATE:
|
158
|
+
filter = /*#__PURE__*/React.createElement(DatePicker, _extends({}, components.DatePicker, {
|
159
|
+
onChange: function onChange(value) {
|
160
|
+
var _components$DatePicke, _components$DatePicke2;
|
161
|
+
|
162
|
+
setFiltersState(_objectSpread(_objectSpread({}, filtersState), {}, _defineProperty({}, column, {
|
163
|
+
value: value,
|
164
|
+
type: type
|
165
|
+
})));
|
166
|
+
applyFilters({
|
167
|
+
column: column,
|
168
|
+
value: value,
|
169
|
+
type: type
|
170
|
+
});
|
171
|
+
(_components$DatePicke = (_components$DatePicke2 = components.DatePicker).onChange) === null || _components$DatePicke === void 0 ? void 0 : _components$DatePicke.call(_components$DatePicke2, value);
|
172
|
+
},
|
173
|
+
value: filtersState[column].value,
|
174
|
+
datePickerType: "range"
|
175
|
+
}), /*#__PURE__*/React.createElement(DatePickerInput, _extends({
|
176
|
+
placeholder: "mm/dd/yyyy",
|
177
|
+
labelText: "Start date"
|
178
|
+
}, components.DatePickerInput.start)), /*#__PURE__*/React.createElement(DatePickerInput, _extends({
|
179
|
+
placeholder: "mm/dd/yyyy",
|
180
|
+
labelText: "End date"
|
181
|
+
}, components.DatePickerInput.end)));
|
182
|
+
break;
|
183
|
+
|
184
|
+
case NUMBER:
|
185
|
+
filter = /*#__PURE__*/React.createElement(NumberInput, _extends({
|
186
|
+
step: 1,
|
187
|
+
allowEmpty: true,
|
188
|
+
hideSteppers: true
|
189
|
+
}, components.NumberInput, {
|
190
|
+
onChange: function onChange(event) {
|
191
|
+
var _components$NumberInp, _components$NumberInp2;
|
192
|
+
|
193
|
+
setFiltersState(_objectSpread(_objectSpread({}, filtersState), {}, _defineProperty({}, column, {
|
194
|
+
value: event.target.value,
|
195
|
+
type: type
|
196
|
+
})));
|
197
|
+
applyFilters({
|
198
|
+
column: column,
|
199
|
+
value: event.target.value,
|
200
|
+
type: type
|
201
|
+
});
|
202
|
+
(_components$NumberInp = (_components$NumberInp2 = components.NumberInput).onChange) === null || _components$NumberInp === void 0 ? void 0 : _components$NumberInp.call(_components$NumberInp2, event);
|
203
|
+
},
|
204
|
+
value: filtersState[column].value
|
205
|
+
}));
|
206
|
+
break;
|
207
|
+
|
208
|
+
case CHECKBOX:
|
209
|
+
filter = /*#__PURE__*/React.createElement(FormGroup, components.FormGroup, filtersState[column].value.map(function (option) {
|
210
|
+
return /*#__PURE__*/React.createElement(Checkbox, _extends({
|
211
|
+
key: option.labelText
|
212
|
+
}, option, {
|
213
|
+
onChange: function onChange(_, _ref4) {
|
214
|
+
var _option$onChange;
|
215
|
+
|
216
|
+
var isSelected = _ref4.checked;
|
217
|
+
var checkboxCopy = filtersState[column].value;
|
218
|
+
var foundCheckbox = checkboxCopy.find(function (checkbox) {
|
219
|
+
return checkbox.value === option.value;
|
220
|
+
});
|
221
|
+
foundCheckbox.selected = isSelected;
|
222
|
+
setFiltersState(_objectSpread(_objectSpread({}, filtersState), {}, _defineProperty({}, column, {
|
223
|
+
value: checkboxCopy,
|
224
|
+
type: type
|
225
|
+
})));
|
226
|
+
applyFilters({
|
227
|
+
column: column,
|
228
|
+
value: _toConsumableArray(filtersState[column].value),
|
229
|
+
type: type
|
230
|
+
});
|
231
|
+
(_option$onChange = option.onChange) === null || _option$onChange === void 0 ? void 0 : _option$onChange.call(option, isSelected);
|
232
|
+
},
|
233
|
+
checked: option.selected
|
234
|
+
}));
|
235
|
+
}));
|
236
|
+
break;
|
237
|
+
|
238
|
+
case RADIO:
|
239
|
+
filter = /*#__PURE__*/React.createElement(FormGroup, components.FormGroup, /*#__PURE__*/React.createElement(RadioButtonGroup, _extends({}, components.RadioButtonGroup, {
|
240
|
+
valueSelected: ((_filtersState$column = filtersState[column]) === null || _filtersState$column === void 0 ? void 0 : _filtersState$column.value) === '' ? 'Any' : (_filtersState$column2 = filtersState[column]) === null || _filtersState$column2 === void 0 ? void 0 : _filtersState$column2.value,
|
241
|
+
onChange: function onChange(selected) {
|
242
|
+
var _components$RadioButt, _components$RadioButt2;
|
243
|
+
|
244
|
+
setFiltersState(_objectSpread(_objectSpread({}, filtersState), {}, _defineProperty({}, column, {
|
245
|
+
value: selected,
|
246
|
+
type: type
|
247
|
+
})));
|
248
|
+
applyFilters({
|
249
|
+
column: column,
|
250
|
+
value: selected,
|
251
|
+
type: type
|
252
|
+
});
|
253
|
+
(_components$RadioButt = (_components$RadioButt2 = components.RadioButtonGroup).onChange) === null || _components$RadioButt === void 0 ? void 0 : _components$RadioButt.call(_components$RadioButt2, selected);
|
254
|
+
}
|
255
|
+
}), /*#__PURE__*/React.createElement(RadioButton, {
|
256
|
+
id: "any",
|
257
|
+
labelText: "Any",
|
258
|
+
value: "Any"
|
259
|
+
}), components.RadioButton.map(function (radio) {
|
260
|
+
var _ref5, _radio$id;
|
261
|
+
|
262
|
+
return /*#__PURE__*/React.createElement(RadioButton, _extends({
|
263
|
+
key: (_ref5 = (_radio$id = radio.id) !== null && _radio$id !== void 0 ? _radio$id : radio.labelText) !== null && _ref5 !== void 0 ? _ref5 : radio.value
|
264
|
+
}, radio));
|
265
|
+
})));
|
266
|
+
break;
|
267
|
+
|
268
|
+
case DROPDOWN:
|
269
|
+
filter = /*#__PURE__*/React.createElement(Dropdown, _extends({}, components.Dropdown, {
|
270
|
+
selectedItem: ((_filtersState$column3 = filtersState[column]) === null || _filtersState$column3 === void 0 ? void 0 : _filtersState$column3.value) === '' ? 'Any' : (_filtersState$column4 = filtersState[column]) === null || _filtersState$column4 === void 0 ? void 0 : _filtersState$column4.value,
|
271
|
+
items: ['Any'].concat(_toConsumableArray(components.Dropdown.items)),
|
272
|
+
onChange: function onChange(_ref6) {
|
273
|
+
var _components$Dropdown$, _components$Dropdown;
|
274
|
+
|
275
|
+
var selectedItem = _ref6.selectedItem;
|
276
|
+
setFiltersState(_objectSpread(_objectSpread({}, filtersState), {}, _defineProperty({}, column, {
|
277
|
+
value: selectedItem,
|
278
|
+
type: type
|
279
|
+
})));
|
280
|
+
applyFilters({
|
281
|
+
column: column,
|
282
|
+
value: selectedItem,
|
283
|
+
type: type
|
284
|
+
});
|
285
|
+
(_components$Dropdown$ = (_components$Dropdown = components.Dropdown).onChange) === null || _components$Dropdown$ === void 0 ? void 0 : _components$Dropdown$.call(_components$Dropdown, selectedItem);
|
286
|
+
}
|
287
|
+
}));
|
288
|
+
break;
|
289
|
+
}
|
290
|
+
|
291
|
+
if (isPanel) {
|
292
|
+
return /*#__PURE__*/React.createElement(Layer, null, filter);
|
293
|
+
}
|
294
|
+
|
295
|
+
return filter;
|
296
|
+
};
|
297
|
+
|
298
|
+
return {
|
299
|
+
filtersState: filtersState,
|
300
|
+
setFiltersState: setFiltersState,
|
301
|
+
prevFiltersObjectArrayRef: prevFiltersObjectArrayRef,
|
302
|
+
prevFiltersRef: prevFiltersRef,
|
303
|
+
revertToPreviousFilters: revertToPreviousFilters,
|
304
|
+
reset: reset,
|
305
|
+
renderFilter: renderFilter,
|
306
|
+
filtersObjectArray: filtersObjectArray
|
307
|
+
};
|
308
|
+
};
|
309
|
+
|
310
|
+
export default useFilters;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
+
|
3
|
+
/*
|
4
|
+
* Licensed Materials - Property of IBM
|
5
|
+
* 5724-Q36
|
6
|
+
* (c) Copyright IBM Corp. 2022
|
7
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
8
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
9
|
+
*/
|
10
|
+
import { useState } from 'react';
|
11
|
+
import { FLYOUT } from '../constants';
|
12
|
+
import { getInitialStateFromFilters } from '../utils';
|
13
|
+
|
14
|
+
var useInitialStateFromFilters = function useInitialStateFromFilters(filters) {
|
15
|
+
var variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FLYOUT;
|
16
|
+
|
17
|
+
var _useState = useState(getInitialStateFromFilters(filters, variation)),
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
19
|
+
state = _useState2[0],
|
20
|
+
setState = _useState2[1];
|
21
|
+
|
22
|
+
return [state, setState];
|
23
|
+
};
|
24
|
+
|
25
|
+
export default useInitialStateFromFilters;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Copyright IBM Corp. 2023, 2023
|
5
|
+
*
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
|
+
|
10
|
+
/* eslint-disable jsdoc/check-param-names */
|
11
|
+
import { useState, useEffect } from 'react';
|
12
|
+
import isEqual from 'lodash/isEqual';
|
13
|
+
/**
|
14
|
+
* Keeps track of the button disabled state
|
15
|
+
* @param {string} initialValue - the initial value if the buttons should be enabled or disabled
|
16
|
+
* @param {object} filtersState - the filter state from the filter panel or flyout
|
17
|
+
* @param {object} prevFiltersRef - reference of the prev filterState
|
18
|
+
* @returns {Array} returns a tuple of the state and setter function
|
19
|
+
*/
|
20
|
+
|
21
|
+
var useShouldDisableButtons = function useShouldDisableButtons(_ref) {
|
22
|
+
var _ref$initialValue = _ref.initialValue,
|
23
|
+
initialValue = _ref$initialValue === void 0 ? true : _ref$initialValue,
|
24
|
+
filtersState = _ref.filtersState,
|
25
|
+
prevFiltersRef = _ref.prevFiltersRef;
|
26
|
+
|
27
|
+
var _useState = useState(initialValue),
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
29
|
+
shouldDisableButtons = _useState2[0],
|
30
|
+
setShouldDisableButtons = _useState2[1];
|
31
|
+
|
32
|
+
useEffect(function updateDisabledButtonsState() {
|
33
|
+
setShouldDisableButtons(isEqual(filtersState, JSON.parse(prevFiltersRef.current)));
|
34
|
+
}, [filtersState, prevFiltersRef]);
|
35
|
+
return [shouldDisableButtons, setShouldDisableButtons];
|
36
|
+
};
|
37
|
+
|
38
|
+
export default useShouldDisableButtons;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2022, 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { useEffect, useContext } from 'react';
|
8
|
+
import { FilterContext } from '../FilterProvider';
|
9
|
+
/**
|
10
|
+
* Subscribes to the filter event emitter
|
11
|
+
* @param {string} type - the type of event to call
|
12
|
+
* @param {Function} callback - a callback to run when the event is dispatched
|
13
|
+
*/
|
14
|
+
|
15
|
+
var useSubscribeToEventEmitter = function useSubscribeToEventEmitter(type, callback) {
|
16
|
+
var _useContext = useContext(FilterContext),
|
17
|
+
EventEmitter = _useContext.EventEmitter;
|
18
|
+
|
19
|
+
useEffect(function subscribeToEmitter() {
|
20
|
+
// This event is emitted from the DatagridToolbar component when clearFilters is clicked in FilterSummary
|
21
|
+
EventEmitter.subscribe(type, callback);
|
22
|
+
});
|
23
|
+
};
|
24
|
+
|
25
|
+
export default useSubscribeToEventEmitter;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2022, 2022
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
export { default as FilterFlyout } from './FilterFlyout';
|
8
|
+
export { default as FilterPanel } from './FilterPanel';
|
9
|
+
export { FilterProvider, FilterContext } from './FilterProvider';
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { DURATIONS, EASINGS } from '../../../../../../global/js/utils/motionConstants';
|
2
|
+
import { ACTION_SET_HEIGHT, PANEL_WIDTH } from '../constants';
|
3
|
+
export var panelVariants = {
|
4
|
+
hidden: {
|
5
|
+
width: 0,
|
6
|
+
overflow: 'hidden',
|
7
|
+
transition: {
|
8
|
+
duration: DURATIONS.fast02,
|
9
|
+
ease: EASINGS.productive.exit,
|
10
|
+
when: 'afterChildren'
|
11
|
+
}
|
12
|
+
},
|
13
|
+
visible: {
|
14
|
+
width: PANEL_WIDTH,
|
15
|
+
overflow: 'visible',
|
16
|
+
transition: {
|
17
|
+
duration: DURATIONS.moderate02,
|
18
|
+
ease: EASINGS.productive.entrance,
|
19
|
+
when: 'beforeChildren'
|
20
|
+
}
|
21
|
+
}
|
22
|
+
};
|
23
|
+
export var innerContainerVariants = {
|
24
|
+
hidden: {
|
25
|
+
opacity: 0,
|
26
|
+
transition: {
|
27
|
+
duration: DURATIONS.fast01,
|
28
|
+
ease: EASINGS.productive.exit
|
29
|
+
}
|
30
|
+
},
|
31
|
+
visible: {
|
32
|
+
opacity: 1,
|
33
|
+
transition: {
|
34
|
+
duration: DURATIONS.fast02,
|
35
|
+
ease: EASINGS.productive.entrance,
|
36
|
+
when: 'beforeChildren'
|
37
|
+
}
|
38
|
+
}
|
39
|
+
};
|
40
|
+
export var actionSetVariants = {
|
41
|
+
hidden: {
|
42
|
+
y: ACTION_SET_HEIGHT,
|
43
|
+
transition: {
|
44
|
+
duration: DURATIONS.fast01,
|
45
|
+
ease: EASINGS.productive.exit
|
46
|
+
}
|
47
|
+
},
|
48
|
+
visible: {
|
49
|
+
y: 0,
|
50
|
+
transition: {
|
51
|
+
duration: DURATIONS.fast02,
|
52
|
+
ease: EASINGS.productive.entrance
|
53
|
+
}
|
54
|
+
}
|
55
|
+
};
|
@@ -0,0 +1,72 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2022, 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { CHECKBOX, DATE, DROPDOWN, FLYOUT, NUMBER, PANEL, RADIO } from './constants'; // This functions takes the filters passed in and makes an object to track it's state
|
8
|
+
|
9
|
+
export var getInitialStateFromFilters = function getInitialStateFromFilters(filters) {
|
10
|
+
var variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FLYOUT;
|
11
|
+
var initialFilterState = {};
|
12
|
+
|
13
|
+
var setInitialState = function setInitialState(_ref) {
|
14
|
+
var type = _ref.type,
|
15
|
+
column = _ref.column,
|
16
|
+
props = _ref.props;
|
17
|
+
|
18
|
+
if (type === CHECKBOX) {
|
19
|
+
initialFilterState[column] = {
|
20
|
+
value: props.Checkbox.map(function (_ref2) {
|
21
|
+
var id = _ref2.id,
|
22
|
+
labelText = _ref2.labelText,
|
23
|
+
value = _ref2.value;
|
24
|
+
return {
|
25
|
+
id: id,
|
26
|
+
labelText: labelText,
|
27
|
+
value: value,
|
28
|
+
selected: false
|
29
|
+
};
|
30
|
+
}),
|
31
|
+
type: type
|
32
|
+
};
|
33
|
+
} else if (type === DATE) {
|
34
|
+
initialFilterState[column] = {
|
35
|
+
value: [null, null],
|
36
|
+
type: type
|
37
|
+
};
|
38
|
+
} else if (type === NUMBER) {
|
39
|
+
initialFilterState[column] = {
|
40
|
+
value: '',
|
41
|
+
type: type
|
42
|
+
};
|
43
|
+
} else if (type === RADIO) {
|
44
|
+
initialFilterState[column] = {
|
45
|
+
value: '',
|
46
|
+
type: type
|
47
|
+
};
|
48
|
+
} else if (type === DROPDOWN) {
|
49
|
+
initialFilterState[column] = {
|
50
|
+
value: '',
|
51
|
+
type: type
|
52
|
+
};
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
if (variation === FLYOUT) {
|
57
|
+
filters.forEach(setInitialState);
|
58
|
+
} else if (variation === PANEL) {
|
59
|
+
filters.forEach(function (_ref3) {
|
60
|
+
var _ref3$filters = _ref3.filters,
|
61
|
+
sections = _ref3$filters === void 0 ? [] : _ref3$filters;
|
62
|
+
sections.forEach(function (_ref4) {
|
63
|
+
var filter = _ref4.filter;
|
64
|
+
return setInitialState(filter);
|
65
|
+
});
|
66
|
+
});
|
67
|
+
} else {
|
68
|
+
console.error('No variation passed into useInitialStateFromFilters');
|
69
|
+
}
|
70
|
+
|
71
|
+
return initialFilterState;
|
72
|
+
};
|
package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
+
|
3
|
+
/*
|
4
|
+
* Licensed Materials - Property of IBM
|
5
|
+
* 5724-Q36
|
6
|
+
* (c) Copyright IBM Corp. 2022
|
7
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
8
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
9
|
+
*/
|
10
|
+
import React from 'react';
|
11
|
+
import cx from 'classnames';
|
12
|
+
import PropTypes from 'prop-types';
|
13
|
+
import { pkg } from '../../../../../../settings';
|
14
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
15
|
+
export var InlineEditButton = function InlineEditButton(_ref) {
|
16
|
+
var _cx, _cx2;
|
17
|
+
|
18
|
+
var label = _ref.label,
|
19
|
+
Icon = _ref.renderIcon,
|
20
|
+
disabled = _ref.disabled,
|
21
|
+
LabelIcon = _ref.labelIcon,
|
22
|
+
placeholder = _ref.placeholder,
|
23
|
+
nonEditCell = _ref.nonEditCell,
|
24
|
+
isActiveCell = _ref.isActiveCell,
|
25
|
+
columnConfig = _ref.columnConfig,
|
26
|
+
totalInlineEditColumns = _ref.totalInlineEditColumns,
|
27
|
+
totalColumns = _ref.totalColumns,
|
28
|
+
type = _ref.type;
|
29
|
+
var inlineEditColsLessThanHalfOfTotal = totalInlineEditColumns < totalColumns / 2;
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
31
|
+
className: cx("".concat(blockClass, "__inline-edit-button"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--disabled"), disabled || nonEditCell), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--with-label-icon"), LabelIcon), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--non-edit"), nonEditCell), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--active"), isActiveCell), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--edit-less-than-half-of-total-cols"), inlineEditColsLessThanHalfOfTotal), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--").concat(type), type === 'date' || type === 'selection'), _cx)),
|
32
|
+
tabIndex: isActiveCell ? 0 : -1,
|
33
|
+
"data-disabled": disabled || nonEditCell,
|
34
|
+
"aria-disabled": disabled || nonEditCell,
|
35
|
+
role: "button",
|
36
|
+
title: label
|
37
|
+
}, LabelIcon && /*#__PURE__*/React.createElement("div", {
|
38
|
+
className: "".concat(blockClass, "__label-icon")
|
39
|
+
}, /*#__PURE__*/React.createElement(LabelIcon, null)), label !== '' ? /*#__PURE__*/React.createElement("span", {
|
40
|
+
className: cx("".concat(blockClass, "__inline-edit-button-label"), (_cx2 = {}, _defineProperty(_cx2, "".concat(blockClass, "__inline-edit-button-label-with-icon"), !nonEditCell), _defineProperty(_cx2, "".concat(blockClass, "__defaultStringRenderer--multiline"), columnConfig === null || columnConfig === void 0 ? void 0 : columnConfig.multiLineWrap), _cx2))
|
41
|
+
}, label) : /*#__PURE__*/React.createElement("span", {
|
42
|
+
className: "".concat(blockClass, "__placeholder")
|
43
|
+
}, placeholder), !nonEditCell && Icon && /*#__PURE__*/React.createElement("div", {
|
44
|
+
className: "".concat(blockClass, "__inline-edit-button-icon")
|
45
|
+
}, /*#__PURE__*/React.createElement(Icon, null)));
|
46
|
+
};
|
47
|
+
InlineEditButton.propTypes = {
|
48
|
+
columnConfig: PropTypes.object,
|
49
|
+
disabled: PropTypes.bool,
|
50
|
+
isActiveCell: PropTypes.bool,
|
51
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
52
|
+
labelIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
53
|
+
nonEditCell: PropTypes.bool,
|
54
|
+
placeholder: PropTypes.string,
|
55
|
+
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
56
|
+
totalColumns: PropTypes.number,
|
57
|
+
totalInlineEditColumns: PropTypes.number,
|
58
|
+
type: PropTypes.oneOf(['text', 'number', 'selection', 'date']),
|
59
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
|
60
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { InlineEditButton } from './InlineEditButton';
|