@carbon/ibm-products 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/index-full-carbon.css +192 -56
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +53 -10
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +68 -28
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +3 -3
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +97 -27
- package/css/index.css.map +1 -1
- package/css/index.min.css +3 -3
- package/css/index.min.css.map +1 -1
- package/es/components/AboutModal/AboutModal.js +1 -3
- package/es/components/ActionBar/ActionBar.js +2 -6
- package/es/components/AddSelect/AddSelectFormControl.js +6 -6
- package/es/components/AddSelect/AddSelectRow.js +15 -5
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -6
- package/es/components/ButtonMenu/ButtonMenu.js +4 -4
- package/es/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +3 -9
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +1 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +34 -36
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +20 -24
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/index.js +0 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +44 -15
- package/es/components/Datagrid/useFiltering.js +1 -1
- package/es/components/Datagrid/useStickyColumn.js +10 -3
- package/es/components/PageHeader/PageHeader.js +2 -6
- package/es/components/SidePanel/SidePanel.js +1 -3
- package/es/components/TagSet/TagSet.js +4 -7
- package/es/components/UserProfileImage/UserProfileImage.js +13 -2
- package/es/global/js/hooks/useResizeObserver.js +14 -28
- package/lib/components/AboutModal/AboutModal.js +1 -3
- package/lib/components/ActionBar/ActionBar.js +2 -6
- package/lib/components/AddSelect/AddSelectFormControl.js +6 -6
- package/lib/components/AddSelect/AddSelectRow.js +15 -5
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -6
- package/lib/components/ButtonMenu/ButtonMenu.js +4 -4
- package/lib/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +3 -9
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +1 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +33 -35
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +20 -24
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/index.js +0 -7
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +42 -13
- package/lib/components/Datagrid/useFiltering.js +1 -1
- package/lib/components/Datagrid/useStickyColumn.js +10 -3
- package/lib/components/PageHeader/PageHeader.js +2 -6
- package/lib/components/SidePanel/SidePanel.js +1 -3
- package/lib/components/TagSet/TagSet.js +4 -7
- package/lib/components/UserProfileImage/UserProfileImage.js +13 -2
- package/lib/global/js/hooks/useResizeObserver.js +13 -27
- package/package.json +17 -17
- package/scss/components/AddSelect/_add-select.scss +4 -0
- package/scss/components/BreadcrumbWithOverflow/_breadcrumb-with-overflow.scss +0 -1
- package/scss/components/ButtonMenu/_button-menu.scss +32 -1
- package/scss/components/Datagrid/_datagrid.scss +4 -2
- package/scss/components/Datagrid/_storybook-styles.scss +8 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +12 -13
- package/scss/components/NotificationsPanel/_notifications-panel.scss +1 -1
- package/scss/components/PageHeader/_page-header.scss +0 -1
- package/scss/components/SidePanel/_side-panel.scss +0 -2
- package/scss/components/Tearsheet/_tearsheet.scss +0 -5
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +0 -21
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +0 -30
@@ -14,13 +14,7 @@ var _react = require("react");
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
15
15
|
*/
|
16
16
|
|
17
|
-
var useResizeObserver = function useResizeObserver(ref) {
|
18
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
19
|
-
callback: null,
|
20
|
-
throttleInterval: 0
|
21
|
-
};
|
22
|
-
var callback = options.callback,
|
23
|
-
throttleInterval = options.throttleInterval;
|
17
|
+
var useResizeObserver = function useResizeObserver(ref, callback) {
|
24
18
|
var _useState = (0, _react.useState)(0),
|
25
19
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
26
20
|
width = _useState2[0],
|
@@ -29,8 +23,14 @@ var useResizeObserver = function useResizeObserver(ref) {
|
|
29
23
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
30
24
|
height = _useState4[0],
|
31
25
|
setHeight = _useState4[1];
|
32
|
-
var throttleTimeout = (0, _react.useRef)(null);
|
33
26
|
var entriesToHandle = (0, _react.useRef)(null);
|
27
|
+
var cb = (0, _react.useRef)(callback);
|
28
|
+
(0, _react.useEffect)(function () {
|
29
|
+
// ref for callback removes it as dependency fro useLayoutEffect
|
30
|
+
// This significantly reduces repeated calls if a function is redefined on every
|
31
|
+
// render
|
32
|
+
cb.current = callback;
|
33
|
+
}, [callback]);
|
34
34
|
(0, _react.useLayoutEffect)(function () {
|
35
35
|
if (!(ref !== null && ref !== void 0 && ref.current)) {
|
36
36
|
return;
|
@@ -42,29 +42,15 @@ var useResizeObserver = function useResizeObserver(ref) {
|
|
42
42
|
var entry = entriesToHandle.current[0];
|
43
43
|
setWidth(entry.contentRect.width);
|
44
44
|
setHeight(entry.contentRect.height);
|
45
|
-
|
46
|
-
callback && callback(entry.contentRect);
|
45
|
+
cb.current && cb.current(entry.contentRect);
|
47
46
|
};
|
48
47
|
var observer = new ResizeObserver(function (entries) {
|
49
48
|
// always update entriesToHandle
|
50
49
|
entriesToHandle.current = entries;
|
51
|
-
|
52
|
-
//
|
53
|
-
if (throttleTimeout.current === null) {
|
54
|
-
// no live timeout set entries to handle and move on
|
55
|
-
|
56
|
-
// set up throttle
|
57
|
-
throttleTimeout.current = setTimeout(function () {
|
58
|
-
// do callbacks
|
59
|
-
doCallbacks();
|
60
|
-
// reset throttle
|
61
|
-
throttleTimeout.current = null;
|
62
|
-
}, throttleInterval);
|
63
|
-
}
|
64
|
-
} else {
|
65
|
-
// no throttle do callbacks every time
|
50
|
+
window.requestAnimationFrame(function () {
|
51
|
+
// do callbacks
|
66
52
|
doCallbacks();
|
67
|
-
}
|
53
|
+
});
|
68
54
|
});
|
69
55
|
|
70
56
|
// observe all refs passed
|
@@ -74,7 +60,7 @@ var useResizeObserver = function useResizeObserver(ref) {
|
|
74
60
|
observer = null;
|
75
61
|
};
|
76
62
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
77
|
-
}, [ref
|
63
|
+
}, [ref]);
|
78
64
|
return {
|
79
65
|
width: width,
|
80
66
|
height: height
|
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": "2.
|
4
|
+
"version": "2.1.1",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -54,27 +54,27 @@
|
|
54
54
|
"upgrade-dependencies": "npm-check-updates -u --dep dev,peer,prod --color --reject '/(carbon|^react$|^react-dom$|^chalk$|^react-dnd|^namor)/'"
|
55
55
|
},
|
56
56
|
"devDependencies": {
|
57
|
-
"@babel/cli": "^7.
|
58
|
-
"@babel/core": "^7.
|
59
|
-
"babel-preset-ibm-cloud-cognitive": "^0.14.
|
57
|
+
"@babel/cli": "^7.21.5",
|
58
|
+
"@babel/core": "^7.22.1",
|
59
|
+
"babel-preset-ibm-cloud-cognitive": "^0.14.35",
|
60
60
|
"chalk": "^4.1.2",
|
61
61
|
"change-case": "^4.1.2",
|
62
62
|
"copyfiles": "^2.4.1",
|
63
63
|
"cross-env": "^7.0.3",
|
64
64
|
"fs-extra": "^11.1.1",
|
65
|
-
"glob": "^10.2.
|
66
|
-
"jest": "^29.
|
67
|
-
"jest-config-ibm-cloud-cognitive": "^0.24.
|
68
|
-
"jest-environment-jsdom": "^29.
|
65
|
+
"glob": "^10.2.6",
|
66
|
+
"jest": "^29.5.0",
|
67
|
+
"jest-config-ibm-cloud-cognitive": "^0.24.22",
|
68
|
+
"jest-environment-jsdom": "^29.5.0",
|
69
69
|
"namor": "^1.1.2",
|
70
70
|
"npm-check-updates": "^16.10.12",
|
71
71
|
"npm-run-all": "^4.1.5",
|
72
|
-
"rimraf": "^5.0.
|
72
|
+
"rimraf": "^5.0.1",
|
73
73
|
"sass": "^1.62.1",
|
74
74
|
"yargs": "^17.7.2"
|
75
75
|
},
|
76
76
|
"dependencies": {
|
77
|
-
"@babel/runtime": "^7.
|
77
|
+
"@babel/runtime": "^7.22.3",
|
78
78
|
"@carbon/telemetry": "^0.1.0",
|
79
79
|
"framer-motion": "^6.5.1 < 7",
|
80
80
|
"immutability-helper": "^3.1.1",
|
@@ -85,14 +85,14 @@
|
|
85
85
|
"react-window": "^1.8.9"
|
86
86
|
},
|
87
87
|
"peerDependencies": {
|
88
|
-
"@carbon/grid": "^11.
|
89
|
-
"@carbon/layout": "^11.
|
90
|
-
"@carbon/motion": "^11.
|
91
|
-
"@carbon/react": "~1.
|
92
|
-
"@carbon/themes": "^11.
|
93
|
-
"@carbon/type": "^11.
|
88
|
+
"@carbon/grid": "^11.14.0",
|
89
|
+
"@carbon/layout": "^11.14.0",
|
90
|
+
"@carbon/motion": "^11.11.0",
|
91
|
+
"@carbon/react": "~1.30.0",
|
92
|
+
"@carbon/themes": "^11.19.0",
|
93
|
+
"@carbon/type": "^11.18.0",
|
94
94
|
"react": "^16.8.6 || ^17.0.1",
|
95
95
|
"react-dom": "^16.8.6 || ^17.0.1"
|
96
96
|
},
|
97
|
-
"gitHead": "
|
97
|
+
"gitHead": "30b5fa97e450c8587e04b5e2e1be98c9a7379d45"
|
98
98
|
}
|
@@ -92,6 +92,5 @@ $_block-class: #{c4p-settings.$pkg-prefix}--breadcrumb-with-overflow;
|
|
92
92
|
|
93
93
|
.#{$_block-class}__overflow-menu-options.#{$_block-class}__overflow-menu-options {
|
94
94
|
// Need to disable stylelint until dart sass namespace support is added
|
95
|
-
/* stylelint-disable-next-line function-no-unknown */
|
96
95
|
z-index: utilities.z('header');
|
97
96
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
//
|
2
|
-
// Copyright IBM Corp. 2021,
|
2
|
+
// Copyright IBM Corp. 2021, 2023
|
3
3
|
//
|
4
4
|
// This source code is licensed under the Apache-2.0 license found in the
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
@@ -7,7 +7,10 @@
|
|
7
7
|
|
8
8
|
// Standard imports.
|
9
9
|
@use '@carbon/styles/scss/spacing' as *;
|
10
|
+
@use '@carbon/styles/scss/components/button/tokens' as *;
|
10
11
|
@use '../../global/styles/project-settings' as c4p-settings;
|
12
|
+
@use '@carbon/react/scss/theme' as *;
|
13
|
+
@use '@carbon/styles/scss/type';
|
11
14
|
|
12
15
|
// TODO: @use(s) of Carbon settings and component styles and other
|
13
16
|
// related component styles used by ButtonMenu
|
@@ -17,9 +20,37 @@ $block-class: #{c4p-settings.$pkg-prefix}--button-menu;
|
|
17
20
|
|
18
21
|
.#{$block-class} {
|
19
22
|
min-width: 160px;
|
23
|
+
&.#{$block-class}__wrapper--primary,
|
24
|
+
&.#{$block-class}__wrapper--primary.#{c4p-settings.$carbon-prefix}--overflow-menu.#{c4p-settings.$carbon-prefix}--overflow-menu--open {
|
25
|
+
background-color: $button-primary;
|
26
|
+
}
|
27
|
+
&.#{c4p-settings.$carbon-prefix}--overflow-menu.#{$block-class}__wrapper--primary:hover {
|
28
|
+
background-color: $button-primary-hover;
|
29
|
+
}
|
30
|
+
|
31
|
+
&.#{$block-class}__wrapper--tertiary,
|
32
|
+
&.#{$block-class}__wrapper--tertiary.#{c4p-settings.$carbon-prefix}--overflow-menu.#{c4p-settings.$carbon-prefix}--overflow-menu--open {
|
33
|
+
background-color: $button-tertiary;
|
34
|
+
}
|
35
|
+
&.#{c4p-settings.$carbon-prefix}--overflow-menu.#{$block-class}__wrapper--tertiary:hover {
|
36
|
+
background-color: $button-tertiary-hover;
|
37
|
+
}
|
38
|
+
|
39
|
+
&.#{$block-class}__wrapper--ghost,
|
40
|
+
&.#{$block-class}__wrapper--ghost.#{c4p-settings.$carbon-prefix}--overflow-menu.#{c4p-settings.$carbon-prefix}--overflow-menu--open {
|
41
|
+
background-color: transparent;
|
42
|
+
}
|
43
|
+
&.#{c4p-settings.$carbon-prefix}--overflow-menu.#{$block-class}__wrapper--ghost:hover {
|
44
|
+
background-color: $layer-hover;
|
45
|
+
}
|
20
46
|
|
21
47
|
.#{$block-class}__trigger {
|
48
|
+
@include type.type-style('body-compact-01');
|
49
|
+
|
50
|
+
display: flex;
|
22
51
|
width: 100%;
|
52
|
+
align-items: center;
|
53
|
+
justify-content: space-between;
|
23
54
|
padding: 0 $spacing-05;
|
24
55
|
}
|
25
56
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
//
|
2
|
-
// Copyright IBM Corp. 2022,
|
2
|
+
// Copyright IBM Corp. 2022, 2023
|
3
3
|
//
|
4
4
|
// This source code is licensed under the Apache-2.0 license found in the
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
@@ -22,6 +22,7 @@
|
|
22
22
|
|
23
23
|
// Datagrid uses the following Carbon for IBM Products components:
|
24
24
|
// TODO: @use(s) of IBM Products component styles used by Datagrid
|
25
|
+
@use '../ButtonMenu';
|
25
26
|
|
26
27
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
27
28
|
$block-class: #{c4p-settings.$pkg-prefix}--datagrid;
|
@@ -33,7 +34,8 @@ $block-class: #{c4p-settings.$pkg-prefix}--datagrid;
|
|
33
34
|
display: none;
|
34
35
|
}
|
35
36
|
|
36
|
-
|
37
|
+
.#{c4p-settings.$carbon-prefix}--overflow-menu-options
|
38
|
+
> .#{c4p-settings.$pkg-prefix}--datagrid__row-size-dropdown {
|
37
39
|
left: $spacing-01;
|
38
40
|
width: 112px;
|
39
41
|
}
|
@@ -114,3 +114,11 @@ $block-class: #{c4p-settings.$pkg-prefix}--datagrid;
|
|
114
114
|
margin-right: $spacing-03;
|
115
115
|
background-color: $field-01;
|
116
116
|
}
|
117
|
+
|
118
|
+
.#{c4p-settings.$carbon-prefix}--body--with-modal-open {
|
119
|
+
.#{$block-class}__mobile-toolbar-modal.#{c4p-settings.$carbon-prefix}--modal {
|
120
|
+
top: -$spacing-07;
|
121
|
+
left: -$spacing-07;
|
122
|
+
width: 100vw;
|
123
|
+
}
|
124
|
+
}
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
*/
|
1
|
+
//
|
2
|
+
// Copyright IBM Corp. 2020, 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
|
+
//
|
8
7
|
|
9
8
|
@use '@carbon/styles/scss/theme' as *;
|
10
9
|
@use '@carbon/styles/scss/spacing' as *;
|
@@ -582,12 +581,6 @@
|
|
582
581
|
width: 100%;
|
583
582
|
}
|
584
583
|
|
585
|
-
.#{c4p-settings.$carbon-prefix}--body--with-modal-open
|
586
|
-
.#{$block-class}__grid-container {
|
587
|
-
overflow: hidden;
|
588
|
-
height: 100vh;
|
589
|
-
}
|
590
|
-
|
591
584
|
.#{$block-class} .#{c4p-settings.$carbon-prefix}--modal {
|
592
585
|
width: 100%;
|
593
586
|
}
|
@@ -632,3 +625,9 @@
|
|
632
625
|
.#{$block-class} .#{c4p-settings.$pkg-prefix}--datagrid__head-wrap {
|
633
626
|
background-color: $layer-accent;
|
634
627
|
}
|
628
|
+
|
629
|
+
.#{$block-class}
|
630
|
+
.#{c4p-settings.$carbon-prefix}--action-list
|
631
|
+
.#{c4p-settings.$carbon-prefix}--btn.#{c4p-settings.$pkg-prefix}--button-menu {
|
632
|
+
padding: 0;
|
633
|
+
}
|
@@ -29,7 +29,6 @@ $block-class: #{$pkg-prefix}--page-header;
|
|
29
29
|
$breadcrumb-block-class: #{$pkg-prefix}--breadcrumb-with-overflow;
|
30
30
|
|
31
31
|
$raised-z-index: 99;
|
32
|
-
/* stylelint-disable-next-line function-no-unknown */
|
33
32
|
$z-index-header-minus: utilities.z('header') - 1;
|
34
33
|
|
35
34
|
$left-section-std-width: 60%;
|
@@ -64,7 +64,6 @@ $action-set-block-class: #{c4p-settings.$pkg-prefix}--action-set;
|
|
64
64
|
|
65
65
|
position: fixed;
|
66
66
|
// Need to disable stylelint until dart sass namespace support is added
|
67
|
-
/* stylelint-disable-next-line function-no-unknown */
|
68
67
|
z-index: utilities.z('modal');
|
69
68
|
top: $spacing-09;
|
70
69
|
height: calc(100% - 3rem);
|
@@ -441,7 +440,6 @@ $action-set-block-class: #{c4p-settings.$pkg-prefix}--action-set;
|
|
441
440
|
.#{$block-class}__overlay {
|
442
441
|
position: fixed;
|
443
442
|
// Need to disable stylelint until dart sass namespace support is added
|
444
|
-
/* stylelint-disable-next-line function-no-unknown */
|
445
443
|
z-index: utilities.z('overlay');
|
446
444
|
width: 100%;
|
447
445
|
height: 100%;
|
@@ -30,7 +30,6 @@ $motion-duration: $duration-moderate-02;
|
|
30
30
|
@include block-wrap($block-class) {
|
31
31
|
&.#{$block-class} {
|
32
32
|
// Need to disable stylelint until dart sass namespace support is added
|
33
|
-
/* stylelint-disable-next-line function-no-unknown */
|
34
33
|
z-index: utilities.z('modal') + 1;
|
35
34
|
align-items: flex-end;
|
36
35
|
color: $text-primary;
|
@@ -44,7 +43,6 @@ $motion-duration: $duration-moderate-02;
|
|
44
43
|
|
45
44
|
&.is-visible {
|
46
45
|
// Need to disable stylelint until dart sass namespace support is added
|
47
|
-
/* stylelint-disable-next-line function-no-unknown */
|
48
46
|
z-index: utilities.z('modal');
|
49
47
|
align-items: flex-end;
|
50
48
|
// stylelint-disable-next-line carbon/motion-duration-use, carbon/motion-easing-use
|
@@ -58,7 +56,6 @@ $motion-duration: $duration-moderate-02;
|
|
58
56
|
|
59
57
|
&.#{$block-class}--stacked-1-of-2 {
|
60
58
|
// Need to disable stylelint until dart sass namespace support is added
|
61
|
-
/* stylelint-disable-next-line function-no-unknown */
|
62
59
|
z-index: utilities.z('modal') - 1;
|
63
60
|
// stylelint-disable-next-line carbon/theme-token-use
|
64
61
|
background-color: rgba($overlay-color, 0.33);
|
@@ -66,7 +63,6 @@ $motion-duration: $duration-moderate-02;
|
|
66
63
|
|
67
64
|
&.#{$block-class}--stacked-1-of-3 {
|
68
65
|
// Need to disable stylelint until dart sass namespace support is added
|
69
|
-
/* stylelint-disable-next-line function-no-unknown */
|
70
66
|
z-index: utilities.z('modal') - 2;
|
71
67
|
// stylelint-disable-next-line carbon/theme-token-use
|
72
68
|
background-color: rgba($overlay-color, 0.11);
|
@@ -74,7 +70,6 @@ $motion-duration: $duration-moderate-02;
|
|
74
70
|
|
75
71
|
&.#{$block-class}--stacked-2-of-3 {
|
76
72
|
// Need to disable stylelint until dart sass namespace support is added
|
77
|
-
/* stylelint-disable-next-line function-no-unknown */
|
78
73
|
z-index: utilities.z('modal') - 1;
|
79
74
|
// stylelint-disable-next-line carbon/theme-token-use
|
80
75
|
background-color: rgba($overlay-color, 0.25);
|
package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
-
/*
|
3
|
-
* Licensed Materials - Property of IBM
|
4
|
-
* 5724-Q36
|
5
|
-
* (c) Copyright IBM Corp. 2022
|
6
|
-
* US Government Users Restricted Rights - Use, duplication or disclosure
|
7
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
8
|
-
*/
|
9
|
-
import { useState } from 'react';
|
10
|
-
import { FLYOUT } from '../constants';
|
11
|
-
import { getInitialStateFromFilters } from '../utils';
|
12
|
-
var useInitialStateFromFilters = function useInitialStateFromFilters(filters) {
|
13
|
-
var variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FLYOUT;
|
14
|
-
var initialFilters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
15
|
-
var _useState = useState(getInitialStateFromFilters(filters, variation, initialFilters)),
|
16
|
-
_useState2 = _slicedToArray(_useState, 2),
|
17
|
-
state = _useState2[0],
|
18
|
-
setState = _useState2[1];
|
19
|
-
return [state, setState];
|
20
|
-
};
|
21
|
-
export default useInitialStateFromFilters;
|
package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
5
|
-
value: true
|
6
|
-
});
|
7
|
-
exports.default = void 0;
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
|
-
var _react = require("react");
|
10
|
-
var _constants = require("../constants");
|
11
|
-
var _utils = require("../utils");
|
12
|
-
/*
|
13
|
-
* Licensed Materials - Property of IBM
|
14
|
-
* 5724-Q36
|
15
|
-
* (c) Copyright IBM Corp. 2022
|
16
|
-
* US Government Users Restricted Rights - Use, duplication or disclosure
|
17
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
18
|
-
*/
|
19
|
-
|
20
|
-
var useInitialStateFromFilters = function useInitialStateFromFilters(filters) {
|
21
|
-
var variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.FLYOUT;
|
22
|
-
var initialFilters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
23
|
-
var _useState = (0, _react.useState)((0, _utils.getInitialStateFromFilters)(filters, variation, initialFilters)),
|
24
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
25
|
-
state = _useState2[0],
|
26
|
-
setState = _useState2[1];
|
27
|
-
return [state, setState];
|
28
|
-
};
|
29
|
-
var _default = useInitialStateFromFilters;
|
30
|
-
exports.default = _default;
|