@carbon/ibm-products 1.65.0 → 1.67.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +13 -18
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +2 -2
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +13 -18
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +2 -2
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +13 -18
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +13 -18
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- package/css/index.min.css.map +1 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +50 -8
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/motion/variants.js +63 -41
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +49 -7
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +5 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/motion/variants.js +63 -41
- package/package.json +2 -2
- package/scss/components/Datagrid/styles/addons/_FilterFlyout.scss +11 -8
- package/scss/components/SidePanel/_side-panel.scss +4 -2
@@ -1,19 +1,19 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
-
// @flow
|
4
3
|
/**
|
5
|
-
* Copyright IBM Corp. 2022,
|
4
|
+
* Copyright IBM Corp. 2022, 2024
|
6
5
|
*
|
7
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
8
7
|
* LICENSE file in the root directory of this source tree.
|
9
8
|
*/
|
10
9
|
|
11
|
-
import {
|
10
|
+
import React, { useRef, useState, useEffect } from 'react';
|
12
11
|
import { Button } from 'carbon-components-react';
|
12
|
+
import { Filter16 } from '@carbon/icons-react';
|
13
|
+
import { px, breakpoints } from '@carbon/layout';
|
13
14
|
import cx from 'classnames';
|
14
15
|
import PropTypes from 'prop-types';
|
15
|
-
import
|
16
|
-
import { useClickOutside } from '../../../../../global/js/hooks';
|
16
|
+
import { useClickOutside, useWindowResize } from '../../../../../global/js/hooks';
|
17
17
|
import { pkg } from '../../../../../settings';
|
18
18
|
import { ActionSet } from '../../../../ActionSet';
|
19
19
|
import { BATCH, CLEAR_FILTERS, FLYOUT, INSTANT } from './constants';
|
@@ -53,6 +53,10 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
53
53
|
_useState2 = _slicedToArray(_useState, 2),
|
54
54
|
open = _useState2[0],
|
55
55
|
setOpen = _useState2[1];
|
56
|
+
var _useState3 = useState(false),
|
57
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
58
|
+
stackedLayout = _useState4[0],
|
59
|
+
setStackedLayout = _useState4[1];
|
56
60
|
var _useFilters = useFilters({
|
57
61
|
updateMethod: updateMethod,
|
58
62
|
filters: filters,
|
@@ -69,9 +73,13 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
69
73
|
renderFilter = _useFilters.renderFilter,
|
70
74
|
filtersObjectArray = _useFilters.filtersObjectArray,
|
71
75
|
lastAppliedFilters = _useFilters.lastAppliedFilters;
|
76
|
+
var width = breakpoints.md.width;
|
77
|
+
var mdPxWidth = parseInt(width) * 16;
|
72
78
|
|
73
79
|
/** Refs */
|
74
80
|
var filterFlyoutRef = useRef(null);
|
81
|
+
var flyoutInnerRef = useRef(null);
|
82
|
+
var flyoutFiltersContainerRef = useRef(null);
|
75
83
|
var _useShouldDisableButt = useShouldDisableButtons({
|
76
84
|
initialValue: true,
|
77
85
|
filtersState: filtersState,
|
@@ -80,6 +88,33 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
80
88
|
_useShouldDisableButt2 = _slicedToArray(_useShouldDisableButt, 2),
|
81
89
|
shouldDisableButtons = _useShouldDisableButt2[0],
|
82
90
|
setShouldDisableButtons = _useShouldDisableButt2[1];
|
91
|
+
var handleResize = function handleResize(current) {
|
92
|
+
var filterFlyoutRefPosition = flyoutInnerRef === null || flyoutInnerRef === void 0 ? void 0 : flyoutInnerRef.current.getBoundingClientRect();
|
93
|
+
var originalFlyoutWidth = parseInt(window.getComputedStyle(flyoutInnerRef === null || flyoutInnerRef === void 0 ? void 0 : flyoutInnerRef.current).getPropertyValue('width'));
|
94
|
+
// Check to see if left value from flyout getBoundingClientRect is a negative number
|
95
|
+
// If it is, that is the amount we need to subtract from the flyout width
|
96
|
+
if (Math.sign(filterFlyoutRefPosition.left) === -1) {
|
97
|
+
var newFlyoutWidth = originalFlyoutWidth - Math.abs(filterFlyoutRefPosition.left);
|
98
|
+
flyoutInnerRef.current.style.width = px(newFlyoutWidth);
|
99
|
+
}
|
100
|
+
// Check to see if left value from flyout getBoundingClientRect is a positive number or 0
|
101
|
+
// If it is, that is the amount we need to add to the flyout width until we reach the
|
102
|
+
// max-width of the flyout (642)
|
103
|
+
if (originalFlyoutWidth < 642 && Math.sign(filterFlyoutRefPosition.left) === 1 || Math.sign(filterFlyoutRefPosition.left).toString() === '0') {
|
104
|
+
var _newFlyoutWidth = originalFlyoutWidth + Math.abs(filterFlyoutRefPosition.left);
|
105
|
+
flyoutInnerRef.current.style.width = px(_newFlyoutWidth);
|
106
|
+
}
|
107
|
+
// Begin stacking filters at this specific point
|
108
|
+
if ((current === null || current === void 0 ? void 0 : current.innerWidth) <= mdPxWidth + 254) {
|
109
|
+
setStackedLayout(true);
|
110
|
+
} else {
|
111
|
+
setStackedLayout(false);
|
112
|
+
}
|
113
|
+
};
|
114
|
+
useWindowResize(function (_ref2) {
|
115
|
+
var current = _ref2.current;
|
116
|
+
handleResize(current);
|
117
|
+
});
|
83
118
|
|
84
119
|
/** Memos */
|
85
120
|
var showActionSet = updateMethod === BATCH;
|
@@ -92,7 +127,12 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
92
127
|
var closeFlyout = function closeFlyout() {
|
93
128
|
setOpen(false);
|
94
129
|
onFlyoutClose();
|
130
|
+
flyoutInnerRef.current.style.width = px(642);
|
95
131
|
};
|
132
|
+
useEffect(function () {
|
133
|
+
// Initialize flyout width
|
134
|
+
flyoutInnerRef.current.style.width = px(642);
|
135
|
+
}, []);
|
96
136
|
var apply = function apply() {
|
97
137
|
setAllFilters(filtersObjectArray);
|
98
138
|
closeFlyout();
|
@@ -151,7 +191,8 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
151
191
|
lastAppliedFilters.current = JSON.stringify(reactTableFiltersState);
|
152
192
|
}, [reactTableFiltersState, lastAppliedFilters]);
|
153
193
|
return /*#__PURE__*/React.createElement("div", {
|
154
|
-
className: "".concat(componentClass, "__container")
|
194
|
+
className: "".concat(componentClass, "__container"),
|
195
|
+
ref: filterFlyoutRef
|
155
196
|
}, /*#__PURE__*/React.createElement(Button, {
|
156
197
|
kind: "ghost",
|
157
198
|
hasIconOnly: true,
|
@@ -162,14 +203,15 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
162
203
|
className: cx("".concat(componentClass, "__trigger"), _defineProperty({}, "".concat(componentClass, "__trigger--open"), open)),
|
163
204
|
disabled: data.length === 0
|
164
205
|
}), /*#__PURE__*/React.createElement("div", {
|
165
|
-
ref:
|
206
|
+
ref: flyoutInnerRef,
|
166
207
|
className: cx(componentClass, (_cx2 = {}, _defineProperty(_cx2, "".concat(componentClass, "--open"), open), _defineProperty(_cx2, "".concat(componentClass, "--batch"), showActionSet), _defineProperty(_cx2, "".concat(componentClass, "--instant"), !showActionSet), _cx2))
|
167
208
|
}, /*#__PURE__*/React.createElement("div", {
|
168
209
|
className: "".concat(componentClass, "__inner-container")
|
169
210
|
}, /*#__PURE__*/React.createElement("span", {
|
170
211
|
className: "".concat(componentClass, "__title")
|
171
212
|
}, title), /*#__PURE__*/React.createElement("div", {
|
172
|
-
className: "".concat(componentClass, "__filters")
|
213
|
+
className: cx("".concat(componentClass, "__filters"), _defineProperty({}, "".concat(componentClass, "__stacked"), stackedLayout)),
|
214
|
+
ref: flyoutFiltersContainerRef
|
173
215
|
}, renderFilters())), renderActionSet()));
|
174
216
|
};
|
175
217
|
FilterFlyout.propTypes = {
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
3
|
/* eslint-disable react/jsx-key */
|
4
4
|
/**
|
5
|
-
* Copyright IBM Corp. 2022,
|
5
|
+
* Copyright IBM Corp. 2022, 2024
|
6
6
|
*
|
7
7
|
* This source code is licensed under the Apache-2.0 license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
@@ -15,7 +15,7 @@ import { rem } from '@carbon/layout';
|
|
15
15
|
import { pkg } from '../../../../../settings';
|
16
16
|
import { BATCH, CLEAR_FILTERS, INSTANT, PANEL } from './constants';
|
17
17
|
import cx from 'classnames';
|
18
|
-
import { motion } from 'framer-motion';
|
18
|
+
import { motion, useReducedMotion } from 'framer-motion';
|
19
19
|
import { panelVariants, innerContainerVariants, actionSetVariants } from './motion/variants';
|
20
20
|
import { Close32 } from '@carbon/icons-react';
|
21
21
|
import { ActionSet } from '../../../../ActionSet';
|
@@ -102,6 +102,7 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
102
102
|
_useShouldDisableButt2 = _slicedToArray(_useShouldDisableButt, 2),
|
103
103
|
shouldDisableButtons = _useShouldDisableButt2[0],
|
104
104
|
setShouldDisableButtons = _useShouldDisableButt2[1];
|
105
|
+
var shouldReduceMotion = useReducedMotion();
|
105
106
|
|
106
107
|
/** Memos */
|
107
108
|
var showActionSet = useMemo(function () {
|
@@ -146,6 +147,7 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
146
147
|
}],
|
147
148
|
className: "".concat(componentClass, "__action-set"),
|
148
149
|
ref: actionSetRef,
|
150
|
+
custom: shouldReduceMotion,
|
149
151
|
variants: actionSetVariants
|
150
152
|
});
|
151
153
|
};
|
@@ -183,8 +185,10 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
183
185
|
className: cx(componentClass, "".concat(componentClass, "__container"), (_cx = {}, _defineProperty(_cx, "".concat(componentClass, "--open"), panelOpen), _defineProperty(_cx, "".concat(componentClass, "--batch"), showActionSet), _defineProperty(_cx, "".concat(componentClass, "--instant"), !showActionSet), _cx)),
|
184
186
|
initial: false,
|
185
187
|
animate: panelOpen ? 'visible' : 'hidden',
|
188
|
+
custom: shouldReduceMotion,
|
186
189
|
variants: panelVariants
|
187
190
|
}, /*#__PURE__*/React.createElement(motion.div, {
|
191
|
+
custom: shouldReduceMotion,
|
188
192
|
variants: innerContainerVariants
|
189
193
|
}, /*#__PURE__*/React.createElement("header", {
|
190
194
|
ref: filterHeadingRef,
|
@@ -1,55 +1,77 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2023, 2024
|
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
|
+
|
1
8
|
import { DURATIONS, EASINGS } from '../../../../../../global/js/utils/motionConstants';
|
2
9
|
import { ACTION_SET_HEIGHT, PANEL_WIDTH } from '../constants';
|
3
10
|
export var panelVariants = {
|
4
|
-
hidden: {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
11
|
+
hidden: function hidden(shouldReduceMotion) {
|
12
|
+
return {
|
13
|
+
width: 0,
|
14
|
+
overflow: 'hidden',
|
15
|
+
transition: {
|
16
|
+
duration: shouldReduceMotion ? 0 : DURATIONS.fast02,
|
17
|
+
ease: shouldReduceMotion ? 0 : EASINGS.productive.exit,
|
18
|
+
when: 'afterChildren'
|
19
|
+
}
|
20
|
+
};
|
12
21
|
},
|
13
|
-
visible: {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
22
|
+
visible: function visible(shouldReduceMotion) {
|
23
|
+
return {
|
24
|
+
width: PANEL_WIDTH,
|
25
|
+
overflow: 'visible',
|
26
|
+
transition: {
|
27
|
+
duration: shouldReduceMotion ? 0 : DURATIONS.moderate02,
|
28
|
+
ease: shouldReduceMotion ? 0 : EASINGS.productive.entrance,
|
29
|
+
when: 'beforeChildren'
|
30
|
+
}
|
31
|
+
};
|
21
32
|
}
|
22
33
|
};
|
23
34
|
export var innerContainerVariants = {
|
24
|
-
hidden: {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
35
|
+
hidden: function hidden(shouldReduceMotion) {
|
36
|
+
return {
|
37
|
+
opacity: 0,
|
38
|
+
transition: {
|
39
|
+
duration: shouldReduceMotion ? DURATIONS.moderate01 : DURATIONS.fast01,
|
40
|
+
ease: shouldReduceMotion ? 0 : EASINGS.productive.exit
|
41
|
+
}
|
42
|
+
};
|
30
43
|
},
|
31
|
-
visible: {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
44
|
+
visible: function visible(shouldReduceMotion) {
|
45
|
+
return {
|
46
|
+
opacity: 1,
|
47
|
+
transition: {
|
48
|
+
duration: shouldReduceMotion ? DURATIONS.moderate01 : DURATIONS.fast02,
|
49
|
+
ease: shouldReduceMotion ? 0 : EASINGS.productive.entrance,
|
50
|
+
when: shouldReduceMotion ? null : 'beforeChildren'
|
51
|
+
}
|
52
|
+
};
|
38
53
|
}
|
39
54
|
};
|
40
55
|
export var actionSetVariants = {
|
41
|
-
hidden: {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
56
|
+
hidden: function hidden(shouldReduceMotion) {
|
57
|
+
return {
|
58
|
+
y: shouldReduceMotion ? 0 : ACTION_SET_HEIGHT,
|
59
|
+
opacity: shouldReduceMotion ? 0 : 1,
|
60
|
+
transition: {
|
61
|
+
duration: shouldReduceMotion ? DURATIONS.moderate01 : DURATIONS.fast01,
|
62
|
+
ease: shouldReduceMotion ? 0 : EASINGS.productive.exit
|
63
|
+
}
|
64
|
+
};
|
47
65
|
},
|
48
|
-
visible: {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
66
|
+
visible: function visible(shouldReduceMotion) {
|
67
|
+
return {
|
68
|
+
y: 0,
|
69
|
+
opacity: 1,
|
70
|
+
transition: {
|
71
|
+
duration: shouldReduceMotion ? DURATIONS.moderate01 : DURATIONS.fast02,
|
72
|
+
ease: shouldReduceMotion ? 0 : EASINGS.productive.entrance,
|
73
|
+
delay: shouldReduceMotion ? 0.075 : 0
|
74
|
+
}
|
75
|
+
};
|
54
76
|
}
|
55
77
|
};
|
@@ -8,11 +8,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
exports.default = void 0;
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
11
|
-
var
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
12
12
|
var _carbonComponentsReact = require("carbon-components-react");
|
13
|
+
var _iconsReact = require("@carbon/icons-react");
|
14
|
+
var _layout = require("@carbon/layout");
|
13
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
14
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
15
|
-
var _react = _interopRequireWildcard(require("react"));
|
16
17
|
var _hooks = require("../../../../../global/js/hooks");
|
17
18
|
var _settings = require("../../../../../settings");
|
18
19
|
var _ActionSet = require("../../../../ActionSet");
|
@@ -20,9 +21,8 @@ var _constants = require("./constants");
|
|
20
21
|
var _hooks2 = require("./hooks");
|
21
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
22
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
23
|
-
// @flow
|
24
24
|
/**
|
25
|
-
* Copyright IBM Corp. 2022,
|
25
|
+
* Copyright IBM Corp. 2022, 2024
|
26
26
|
*
|
27
27
|
* This source code is licensed under the Apache-2.0 license found in the
|
28
28
|
* LICENSE file in the root directory of this source tree.
|
@@ -62,6 +62,10 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
62
62
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
63
63
|
open = _useState2[0],
|
64
64
|
setOpen = _useState2[1];
|
65
|
+
var _useState3 = (0, _react.useState)(false),
|
66
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
67
|
+
stackedLayout = _useState4[0],
|
68
|
+
setStackedLayout = _useState4[1];
|
65
69
|
var _useFilters = (0, _hooks2.useFilters)({
|
66
70
|
updateMethod: updateMethod,
|
67
71
|
filters: filters,
|
@@ -78,9 +82,13 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
78
82
|
renderFilter = _useFilters.renderFilter,
|
79
83
|
filtersObjectArray = _useFilters.filtersObjectArray,
|
80
84
|
lastAppliedFilters = _useFilters.lastAppliedFilters;
|
85
|
+
var width = _layout.breakpoints.md.width;
|
86
|
+
var mdPxWidth = parseInt(width) * 16;
|
81
87
|
|
82
88
|
/** Refs */
|
83
89
|
var filterFlyoutRef = (0, _react.useRef)(null);
|
90
|
+
var flyoutInnerRef = (0, _react.useRef)(null);
|
91
|
+
var flyoutFiltersContainerRef = (0, _react.useRef)(null);
|
84
92
|
var _useShouldDisableButt = (0, _hooks2.useShouldDisableButtons)({
|
85
93
|
initialValue: true,
|
86
94
|
filtersState: filtersState,
|
@@ -89,6 +97,33 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
89
97
|
_useShouldDisableButt2 = (0, _slicedToArray2.default)(_useShouldDisableButt, 2),
|
90
98
|
shouldDisableButtons = _useShouldDisableButt2[0],
|
91
99
|
setShouldDisableButtons = _useShouldDisableButt2[1];
|
100
|
+
var handleResize = function handleResize(current) {
|
101
|
+
var filterFlyoutRefPosition = flyoutInnerRef === null || flyoutInnerRef === void 0 ? void 0 : flyoutInnerRef.current.getBoundingClientRect();
|
102
|
+
var originalFlyoutWidth = parseInt(window.getComputedStyle(flyoutInnerRef === null || flyoutInnerRef === void 0 ? void 0 : flyoutInnerRef.current).getPropertyValue('width'));
|
103
|
+
// Check to see if left value from flyout getBoundingClientRect is a negative number
|
104
|
+
// If it is, that is the amount we need to subtract from the flyout width
|
105
|
+
if (Math.sign(filterFlyoutRefPosition.left) === -1) {
|
106
|
+
var newFlyoutWidth = originalFlyoutWidth - Math.abs(filterFlyoutRefPosition.left);
|
107
|
+
flyoutInnerRef.current.style.width = (0, _layout.px)(newFlyoutWidth);
|
108
|
+
}
|
109
|
+
// Check to see if left value from flyout getBoundingClientRect is a positive number or 0
|
110
|
+
// If it is, that is the amount we need to add to the flyout width until we reach the
|
111
|
+
// max-width of the flyout (642)
|
112
|
+
if (originalFlyoutWidth < 642 && Math.sign(filterFlyoutRefPosition.left) === 1 || Math.sign(filterFlyoutRefPosition.left).toString() === '0') {
|
113
|
+
var _newFlyoutWidth = originalFlyoutWidth + Math.abs(filterFlyoutRefPosition.left);
|
114
|
+
flyoutInnerRef.current.style.width = (0, _layout.px)(_newFlyoutWidth);
|
115
|
+
}
|
116
|
+
// Begin stacking filters at this specific point
|
117
|
+
if ((current === null || current === void 0 ? void 0 : current.innerWidth) <= mdPxWidth + 254) {
|
118
|
+
setStackedLayout(true);
|
119
|
+
} else {
|
120
|
+
setStackedLayout(false);
|
121
|
+
}
|
122
|
+
};
|
123
|
+
(0, _hooks.useWindowResize)(function (_ref2) {
|
124
|
+
var current = _ref2.current;
|
125
|
+
handleResize(current);
|
126
|
+
});
|
92
127
|
|
93
128
|
/** Memos */
|
94
129
|
var showActionSet = updateMethod === _constants.BATCH;
|
@@ -101,7 +136,12 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
101
136
|
var closeFlyout = function closeFlyout() {
|
102
137
|
setOpen(false);
|
103
138
|
onFlyoutClose();
|
139
|
+
flyoutInnerRef.current.style.width = (0, _layout.px)(642);
|
104
140
|
};
|
141
|
+
(0, _react.useEffect)(function () {
|
142
|
+
// Initialize flyout width
|
143
|
+
flyoutInnerRef.current.style.width = (0, _layout.px)(642);
|
144
|
+
}, []);
|
105
145
|
var apply = function apply() {
|
106
146
|
setAllFilters(filtersObjectArray);
|
107
147
|
closeFlyout();
|
@@ -160,7 +200,8 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
160
200
|
lastAppliedFilters.current = JSON.stringify(reactTableFiltersState);
|
161
201
|
}, [reactTableFiltersState, lastAppliedFilters]);
|
162
202
|
return /*#__PURE__*/_react.default.createElement("div", {
|
163
|
-
className: "".concat(componentClass, "__container")
|
203
|
+
className: "".concat(componentClass, "__container"),
|
204
|
+
ref: filterFlyoutRef
|
164
205
|
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
165
206
|
kind: "ghost",
|
166
207
|
hasIconOnly: true,
|
@@ -171,14 +212,15 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
171
212
|
className: (0, _classnames.default)("".concat(componentClass, "__trigger"), (0, _defineProperty2.default)({}, "".concat(componentClass, "__trigger--open"), open)),
|
172
213
|
disabled: data.length === 0
|
173
214
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
174
|
-
ref:
|
215
|
+
ref: flyoutInnerRef,
|
175
216
|
className: (0, _classnames.default)(componentClass, (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(componentClass, "--open"), open), (0, _defineProperty2.default)(_cx2, "".concat(componentClass, "--batch"), showActionSet), (0, _defineProperty2.default)(_cx2, "".concat(componentClass, "--instant"), !showActionSet), _cx2))
|
176
217
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
177
218
|
className: "".concat(componentClass, "__inner-container")
|
178
219
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
179
220
|
className: "".concat(componentClass, "__title")
|
180
221
|
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
181
|
-
className: "".concat(componentClass, "__filters")
|
222
|
+
className: (0, _classnames.default)("".concat(componentClass, "__filters"), (0, _defineProperty2.default)({}, "".concat(componentClass, "__stacked"), stackedLayout)),
|
223
|
+
ref: flyoutFiltersContainerRef
|
182
224
|
}, renderFilters())), renderActionSet()));
|
183
225
|
};
|
184
226
|
FilterFlyout.propTypes = {
|
@@ -25,7 +25,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
25
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
26
26
|
/* eslint-disable react/jsx-key */
|
27
27
|
/**
|
28
|
-
* Copyright IBM Corp. 2022,
|
28
|
+
* Copyright IBM Corp. 2022, 2024
|
29
29
|
*
|
30
30
|
* This source code is licensed under the Apache-2.0 license found in the
|
31
31
|
* LICENSE file in the root directory of this source tree.
|
@@ -112,6 +112,7 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
112
112
|
_useShouldDisableButt2 = (0, _slicedToArray2.default)(_useShouldDisableButt, 2),
|
113
113
|
shouldDisableButtons = _useShouldDisableButt2[0],
|
114
114
|
setShouldDisableButtons = _useShouldDisableButt2[1];
|
115
|
+
var shouldReduceMotion = (0, _framerMotion.useReducedMotion)();
|
115
116
|
|
116
117
|
/** Memos */
|
117
118
|
var showActionSet = (0, _react.useMemo)(function () {
|
@@ -156,6 +157,7 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
156
157
|
}],
|
157
158
|
className: "".concat(componentClass, "__action-set"),
|
158
159
|
ref: actionSetRef,
|
160
|
+
custom: shouldReduceMotion,
|
159
161
|
variants: _variants.actionSetVariants
|
160
162
|
});
|
161
163
|
};
|
@@ -193,8 +195,10 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
193
195
|
className: (0, _classnames.default)(componentClass, "".concat(componentClass, "__container"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(componentClass, "--open"), panelOpen), (0, _defineProperty2.default)(_cx, "".concat(componentClass, "--batch"), showActionSet), (0, _defineProperty2.default)(_cx, "".concat(componentClass, "--instant"), !showActionSet), _cx)),
|
194
196
|
initial: false,
|
195
197
|
animate: panelOpen ? 'visible' : 'hidden',
|
198
|
+
custom: shouldReduceMotion,
|
196
199
|
variants: _variants.panelVariants
|
197
200
|
}, /*#__PURE__*/_react.default.createElement(_framerMotion.motion.div, {
|
201
|
+
custom: shouldReduceMotion,
|
198
202
|
variants: _variants.innerContainerVariants
|
199
203
|
}, /*#__PURE__*/_react.default.createElement("header", {
|
200
204
|
ref: filterHeadingRef,
|
@@ -6,59 +6,81 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.panelVariants = exports.innerContainerVariants = exports.actionSetVariants = void 0;
|
7
7
|
var _motionConstants = require("../../../../../../global/js/utils/motionConstants");
|
8
8
|
var _constants = require("../constants");
|
9
|
+
/**
|
10
|
+
* Copyright IBM Corp. 2023, 2024
|
11
|
+
*
|
12
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
14
|
+
*/
|
15
|
+
|
9
16
|
var panelVariants = {
|
10
|
-
hidden: {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
hidden: function hidden(shouldReduceMotion) {
|
18
|
+
return {
|
19
|
+
width: 0,
|
20
|
+
overflow: 'hidden',
|
21
|
+
transition: {
|
22
|
+
duration: shouldReduceMotion ? 0 : _motionConstants.DURATIONS.fast02,
|
23
|
+
ease: shouldReduceMotion ? 0 : _motionConstants.EASINGS.productive.exit,
|
24
|
+
when: 'afterChildren'
|
25
|
+
}
|
26
|
+
};
|
18
27
|
},
|
19
|
-
visible: {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
visible: function visible(shouldReduceMotion) {
|
29
|
+
return {
|
30
|
+
width: _constants.PANEL_WIDTH,
|
31
|
+
overflow: 'visible',
|
32
|
+
transition: {
|
33
|
+
duration: shouldReduceMotion ? 0 : _motionConstants.DURATIONS.moderate02,
|
34
|
+
ease: shouldReduceMotion ? 0 : _motionConstants.EASINGS.productive.entrance,
|
35
|
+
when: 'beforeChildren'
|
36
|
+
}
|
37
|
+
};
|
27
38
|
}
|
28
39
|
};
|
29
40
|
exports.panelVariants = panelVariants;
|
30
41
|
var innerContainerVariants = {
|
31
|
-
hidden: {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
42
|
+
hidden: function hidden(shouldReduceMotion) {
|
43
|
+
return {
|
44
|
+
opacity: 0,
|
45
|
+
transition: {
|
46
|
+
duration: shouldReduceMotion ? _motionConstants.DURATIONS.moderate01 : _motionConstants.DURATIONS.fast01,
|
47
|
+
ease: shouldReduceMotion ? 0 : _motionConstants.EASINGS.productive.exit
|
48
|
+
}
|
49
|
+
};
|
37
50
|
},
|
38
|
-
visible: {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
51
|
+
visible: function visible(shouldReduceMotion) {
|
52
|
+
return {
|
53
|
+
opacity: 1,
|
54
|
+
transition: {
|
55
|
+
duration: shouldReduceMotion ? _motionConstants.DURATIONS.moderate01 : _motionConstants.DURATIONS.fast02,
|
56
|
+
ease: shouldReduceMotion ? 0 : _motionConstants.EASINGS.productive.entrance,
|
57
|
+
when: shouldReduceMotion ? null : 'beforeChildren'
|
58
|
+
}
|
59
|
+
};
|
45
60
|
}
|
46
61
|
};
|
47
62
|
exports.innerContainerVariants = innerContainerVariants;
|
48
63
|
var actionSetVariants = {
|
49
|
-
hidden: {
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
64
|
+
hidden: function hidden(shouldReduceMotion) {
|
65
|
+
return {
|
66
|
+
y: shouldReduceMotion ? 0 : _constants.ACTION_SET_HEIGHT,
|
67
|
+
opacity: shouldReduceMotion ? 0 : 1,
|
68
|
+
transition: {
|
69
|
+
duration: shouldReduceMotion ? _motionConstants.DURATIONS.moderate01 : _motionConstants.DURATIONS.fast01,
|
70
|
+
ease: shouldReduceMotion ? 0 : _motionConstants.EASINGS.productive.exit
|
71
|
+
}
|
72
|
+
};
|
55
73
|
},
|
56
|
-
visible: {
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
74
|
+
visible: function visible(shouldReduceMotion) {
|
75
|
+
return {
|
76
|
+
y: 0,
|
77
|
+
opacity: 1,
|
78
|
+
transition: {
|
79
|
+
duration: shouldReduceMotion ? _motionConstants.DURATIONS.moderate01 : _motionConstants.DURATIONS.fast02,
|
80
|
+
ease: shouldReduceMotion ? 0 : _motionConstants.EASINGS.productive.entrance,
|
81
|
+
delay: shouldReduceMotion ? 0.075 : 0
|
82
|
+
}
|
83
|
+
};
|
62
84
|
}
|
63
85
|
};
|
64
86
|
exports.actionSetVariants = actionSetVariants;
|
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.
|
4
|
+
"version": "1.67.0",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -97,5 +97,5 @@
|
|
97
97
|
"react": "^16.8.6 || ^17.0.1",
|
98
98
|
"react-dom": "^16.8.6 || ^17.0.1"
|
99
99
|
},
|
100
|
-
"gitHead": "
|
100
|
+
"gitHead": "9d38cf405fc58bb75d8bab999816bf18c8d63167"
|
101
101
|
}
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
*/
|
1
|
+
//
|
2
|
+
// Copyright IBM Corp. 2022, 2024
|
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
|
// stylelint-disable carbon/layout-token-use
|
10
9
|
|
@@ -65,7 +64,7 @@ $action-set-height: rem(64px);
|
|
65
64
|
.#{$block-class}-filter-flyout__filters {
|
66
65
|
display: grid;
|
67
66
|
gap: rem(16px) rem(32px);
|
68
|
-
grid-template-columns:
|
67
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
69
68
|
}
|
70
69
|
|
71
70
|
// Carbon overrides
|
@@ -78,3 +77,7 @@ $action-set-height: rem(64px);
|
|
78
77
|
.#{$block-class}-filter-flyout .#{$carbon-prefix}--fieldset {
|
79
78
|
margin-bottom: 0;
|
80
79
|
}
|
80
|
+
|
81
|
+
.#{$block-class}-filter-flyout__stacked {
|
82
|
+
grid-template-columns: 1fr;
|
83
|
+
}
|
@@ -73,8 +73,7 @@ $action-set-block-class: #{$pkg-prefix}--action-set;
|
|
73
73
|
@include setPanelSize($size_value);
|
74
74
|
.#{$block-class}__title-container.#{$block-class}__title-container--no-title-animation,
|
75
75
|
.#{$block-class}__subtitle-text.#{$block-class}__subtitle-text-no-animation,
|
76
|
-
.#{$block-class}__action-toolbar.#{$block-class}__action-toolbar-no-animation
|
77
|
-
.#{$block-class}__actions-container.#{$action-set-block-class}--#{$size} {
|
76
|
+
.#{$block-class}__action-toolbar.#{$block-class}__action-toolbar-no-animation {
|
78
77
|
@include setPanelSize($size_value);
|
79
78
|
}
|
80
79
|
}
|
@@ -87,6 +86,9 @@ $action-set-block-class: #{$pkg-prefix}--action-set;
|
|
87
86
|
border-right: 1px solid $decorative-01;
|
88
87
|
}
|
89
88
|
}
|
89
|
+
.#{$block-class}__actions-container {
|
90
|
+
width: 100%;
|
91
|
+
}
|
90
92
|
&.#{$block-class}__container-with-action-toolbar.#{$block-class}__with-condensed-header {
|
91
93
|
.#{$block-class}__title-container {
|
92
94
|
&::before {
|