@patternfly/react-core 4.189.1 → 4.189.5
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/CHANGELOG.md +35 -0
- package/dist/esm/components/Tabs/Tabs.d.ts +2 -0
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +24 -18
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/helpers/util.d.ts +2 -1
- package/dist/esm/helpers/util.d.ts.map +1 -1
- package/dist/esm/helpers/util.js +5 -4
- package/dist/esm/helpers/util.js.map +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts +2 -0
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +24 -18
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/helpers/util.d.ts +2 -1
- package/dist/js/helpers/util.d.ts.map +1 -1
- package/dist/js/helpers/util.js +5 -4
- package/dist/js/helpers/util.js.map +1 -1
- package/dist/umd/react-core.css +18 -0
- package/dist/umd/react-core.js +30 -22
- package/dist/umd/react-core.min.css +18 -0
- package/dist/umd/react-core.min.js +3 -3
- package/package.json +6 -6
- package/src/components/Tabs/Tabs.tsx +25 -18
- package/src/helpers/util.ts +10 -4
package/dist/umd/react-core.js
CHANGED
|
@@ -987,22 +987,23 @@
|
|
|
987
987
|
* @param {HTMLElement} container The container to check if the element is in view of.
|
|
988
988
|
* @param {HTMLElement} element The element to check if it is view
|
|
989
989
|
* @param {boolean} partial true if partial view is allowed
|
|
990
|
+
* @param {boolean} strict true if strict mode is set, never consider the container width and element width
|
|
990
991
|
*
|
|
991
992
|
* @returns { boolean } True if the component is in View.
|
|
992
993
|
*/
|
|
993
|
-
function isElementInView(container, element, partial) {
|
|
994
|
+
function isElementInView(container, element, partial, strict = false) {
|
|
994
995
|
if (!container || !element) {
|
|
995
996
|
return false;
|
|
996
997
|
}
|
|
997
998
|
const containerBounds = container.getBoundingClientRect();
|
|
998
999
|
const elementBounds = element.getBoundingClientRect();
|
|
999
|
-
const containerBoundsLeft = Math.
|
|
1000
|
+
const containerBoundsLeft = Math.ceil(containerBounds.left);
|
|
1000
1001
|
const containerBoundsRight = Math.floor(containerBounds.right);
|
|
1001
|
-
const elementBoundsLeft = Math.
|
|
1002
|
+
const elementBoundsLeft = Math.ceil(elementBounds.left);
|
|
1002
1003
|
const elementBoundsRight = Math.floor(elementBounds.right);
|
|
1003
1004
|
// Check if in view
|
|
1004
1005
|
const isTotallyInView = elementBoundsLeft >= containerBoundsLeft && elementBoundsRight <= containerBoundsRight;
|
|
1005
|
-
const isPartiallyInView = partial &&
|
|
1006
|
+
const isPartiallyInView = (partial || (!strict && containerBounds.width < elementBounds.width)) &&
|
|
1006
1007
|
((elementBoundsLeft < containerBoundsLeft && elementBoundsRight > containerBoundsLeft) ||
|
|
1007
1008
|
(elementBoundsRight > containerBoundsRight && elementBoundsLeft < containerBoundsRight));
|
|
1008
1009
|
// Return outcome
|
|
@@ -9315,6 +9316,7 @@
|
|
|
9315
9316
|
"descriptionListDescription": "pf-c-description-list__description",
|
|
9316
9317
|
"descriptionListGroup": "pf-c-description-list__group",
|
|
9317
9318
|
"descriptionListTerm": "pf-c-description-list__term",
|
|
9319
|
+
"descriptionListTermIcon": "pf-c-description-list__term-icon",
|
|
9318
9320
|
"descriptionListText": "pf-c-description-list__text",
|
|
9319
9321
|
"modifiers": {
|
|
9320
9322
|
"inlineGrid": "pf-m-inline-grid",
|
|
@@ -17545,25 +17547,30 @@
|
|
|
17545
17547
|
constructor(props) {
|
|
17546
17548
|
super(props);
|
|
17547
17549
|
this.tabList = React__namespace.createRef();
|
|
17550
|
+
this.scrollTimeout = null;
|
|
17548
17551
|
this.handleScrollButtons = () => {
|
|
17549
|
-
|
|
17550
|
-
|
|
17551
|
-
|
|
17552
|
-
|
|
17553
|
-
|
|
17554
|
-
|
|
17555
|
-
|
|
17556
|
-
|
|
17557
|
-
|
|
17558
|
-
|
|
17559
|
-
|
|
17560
|
-
|
|
17561
|
-
|
|
17562
|
-
|
|
17563
|
-
|
|
17564
|
-
|
|
17565
|
-
|
|
17566
|
-
|
|
17552
|
+
// add debounce to the scroll event
|
|
17553
|
+
clearTimeout(this.scrollTimeout);
|
|
17554
|
+
this.scrollTimeout = setTimeout(() => {
|
|
17555
|
+
const container = this.tabList.current;
|
|
17556
|
+
let disableLeftScrollButton = true;
|
|
17557
|
+
let disableRightScrollButton = true;
|
|
17558
|
+
let showScrollButtons = false;
|
|
17559
|
+
if (container && !this.props.isVertical) {
|
|
17560
|
+
// get first element and check if it is in view
|
|
17561
|
+
const overflowOnLeft = !isElementInView(container, container.firstChild, false);
|
|
17562
|
+
// get last element and check if it is in view
|
|
17563
|
+
const overflowOnRight = !isElementInView(container, container.lastChild, false);
|
|
17564
|
+
showScrollButtons = overflowOnLeft || overflowOnRight;
|
|
17565
|
+
disableLeftScrollButton = !overflowOnLeft;
|
|
17566
|
+
disableRightScrollButton = !overflowOnRight;
|
|
17567
|
+
}
|
|
17568
|
+
this.setState({
|
|
17569
|
+
showScrollButtons,
|
|
17570
|
+
disableLeftScrollButton,
|
|
17571
|
+
disableRightScrollButton
|
|
17572
|
+
});
|
|
17573
|
+
}, 100);
|
|
17567
17574
|
};
|
|
17568
17575
|
this.scrollLeft = () => {
|
|
17569
17576
|
// find first Element that is fully in view on the left, then scroll to the element before it
|
|
@@ -17662,6 +17669,7 @@
|
|
|
17662
17669
|
window.removeEventListener('resize', this.handleScrollButtons, false);
|
|
17663
17670
|
}
|
|
17664
17671
|
}
|
|
17672
|
+
clearTimeout(this.scrollTimeout);
|
|
17665
17673
|
}
|
|
17666
17674
|
componentDidUpdate(prevProps) {
|
|
17667
17675
|
const { activeKey, mountOnEnter } = this.props;
|
|
@@ -4907,9 +4907,14 @@ label.pf-c-check, .pf-c-check__label,
|
|
|
4907
4907
|
--pf-c-description-list__group--GridColumn: auto;
|
|
4908
4908
|
--pf-c-description-list--m-compact--RowGap: var(--pf-global--gutter);
|
|
4909
4909
|
--pf-c-description-list--m-compact--ColumnGap: var(--pf-global--spacer--sm);
|
|
4910
|
+
--pf-c-description-list__term--Display: inline;
|
|
4911
|
+
--pf-c-description-list__term--sm--Display: flex;
|
|
4910
4912
|
--pf-c-description-list__term--FontWeight: var(--pf-global--FontWeight--bold);
|
|
4911
4913
|
--pf-c-description-list__term--FontSize: var(--pf-global--FontSize--sm);
|
|
4912
4914
|
--pf-c-description-list__term--LineHeight: var(--pf-global--LineHeight--sm);
|
|
4915
|
+
--pf-c-description-list__term-icon--MinWidth: var(--pf-global--icon--FontSize--sm);
|
|
4916
|
+
--pf-c-description-list__term-icon--MarginRight: var(--pf-global--spacer--sm);
|
|
4917
|
+
--pf-c-description-list__term-icon--Color: var(--pf-global--icon--Color--light);
|
|
4913
4918
|
--pf-c-description-list--m-vertical__group--GridTemplateColumns: repeat(var(--pf-c-description-list--GridTemplateColumns--count));
|
|
4914
4919
|
--pf-c-description-list--m-horizontal__term--width: 12ch;
|
|
4915
4920
|
--pf-c-description-list--m-horizontal__description--width: minmax(10ch, auto);
|
|
@@ -4931,6 +4936,11 @@ label.pf-c-check, .pf-c-check__label,
|
|
|
4931
4936
|
grid-template-columns: var(--pf-c-description-list--GridTemplateColumns);
|
|
4932
4937
|
}
|
|
4933
4938
|
|
|
4939
|
+
@media screen and (min-width: 576px) {
|
|
4940
|
+
.pf-c-description-list {
|
|
4941
|
+
--pf-c-description-list__term--Display: var(--pf-c-description-list__term--sm--Display);
|
|
4942
|
+
}
|
|
4943
|
+
}
|
|
4934
4944
|
.pf-c-description-list[class*=pf-m-horizontal] {
|
|
4935
4945
|
--pf-c-description-list__term--width: var(--pf-c-description-list--m-horizontal__term--width);
|
|
4936
4946
|
}
|
|
@@ -5040,6 +5050,7 @@ label.pf-c-check, .pf-c-check__label,
|
|
|
5040
5050
|
}
|
|
5041
5051
|
|
|
5042
5052
|
.pf-c-description-list__term {
|
|
5053
|
+
display: var(--pf-c-description-list__term--Display);
|
|
5043
5054
|
font-size: var(--pf-c-description-list__term--FontSize);
|
|
5044
5055
|
font-weight: var(--pf-c-description-list__term--FontWeight);
|
|
5045
5056
|
line-height: var(--pf-c-description-list__term--LineHeight);
|
|
@@ -5049,6 +5060,13 @@ label.pf-c-check, .pf-c-check__label,
|
|
|
5049
5060
|
display: inline;
|
|
5050
5061
|
}
|
|
5051
5062
|
|
|
5063
|
+
.pf-c-description-list__term-icon {
|
|
5064
|
+
flex-shrink: 0;
|
|
5065
|
+
min-width: var(--pf-c-description-list__term-icon--MinWidth);
|
|
5066
|
+
margin-right: var(--pf-c-description-list__term-icon--MarginRight);
|
|
5067
|
+
color: var(--pf-c-description-list__term-icon--Color);
|
|
5068
|
+
}
|
|
5069
|
+
|
|
5052
5070
|
.pf-c-description-list__text.pf-m-help-text {
|
|
5053
5071
|
text-decoration: underline;
|
|
5054
5072
|
cursor: pointer;
|