@patternfly/react-core 4.213.2 → 4.213.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.
Files changed (31) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/esm/components/Card/Card.d.ts +7 -0
  3. package/dist/esm/components/Card/Card.d.ts.map +1 -1
  4. package/dist/esm/components/Card/Card.js +24 -1
  5. package/dist/esm/components/Card/Card.js.map +1 -1
  6. package/dist/esm/components/Card/CardTitle.d.ts.map +1 -1
  7. package/dist/esm/components/Card/CardTitle.js +8 -1
  8. package/dist/esm/components/Card/CardTitle.js.map +1 -1
  9. package/dist/js/components/Card/Card.d.ts +7 -0
  10. package/dist/js/components/Card/Card.d.ts.map +1 -1
  11. package/dist/js/components/Card/Card.js +24 -1
  12. package/dist/js/components/Card/Card.js.map +1 -1
  13. package/dist/js/components/Card/CardTitle.d.ts.map +1 -1
  14. package/dist/js/components/Card/CardTitle.js +8 -1
  15. package/dist/js/components/Card/CardTitle.js.map +1 -1
  16. package/dist/umd/react-core.css +475 -475
  17. package/dist/umd/react-core.js +31 -2
  18. package/dist/umd/react-core.min.css +107 -107
  19. package/dist/umd/react-core.min.js +1 -1
  20. package/package.json +5 -5
  21. package/src/components/Card/Card.tsx +53 -0
  22. package/src/components/Card/CardTitle.tsx +11 -1
  23. package/src/components/Card/__tests__/Card.test.tsx +90 -1
  24. package/src/components/Card/__tests__/CardTitle.test.tsx +13 -0
  25. package/src/components/Card/examples/Card.md +17 -0
  26. package/src/components/Card/examples/CardLegacySelectable.tsx +11 -2
  27. package/src/components/Card/examples/CardSelectable.tsx +10 -1
  28. package/src/components/Card/examples/CardSelectableA11yHighlight.tsx +61 -0
  29. package/src/demos/Card/Card.md +29 -29
  30. package/src/demos/PrimaryDetail.md +16 -2
  31. package/src/demos/examples/Tabs/ModalTabs.tsx +4 -1
@@ -8045,12 +8045,15 @@
8045
8045
 
8046
8046
  const CardContext = React__namespace.createContext({
8047
8047
  cardId: '',
8048
+ registerTitleId: () => { },
8048
8049
  isExpanded: false
8049
8050
  });
8050
8051
  const Card = (_a) => {
8051
- var { children = null, id = '', className = '', component = 'article', isHoverable = false, isCompact = false, isSelectable = false, isSelectableRaised = false, isSelected = false, isDisabledRaised = false, isFlat = false, isExpanded = false, isRounded = false, isLarge = false, isFullHeight = false, isPlain = false, ouiaId, ouiaSafe = true } = _a, props = __rest$1(_a, ["children", "id", "className", "component", "isHoverable", "isCompact", "isSelectable", "isSelectableRaised", "isSelected", "isDisabledRaised", "isFlat", "isExpanded", "isRounded", "isLarge", "isFullHeight", "isPlain", "ouiaId", "ouiaSafe"]);
8052
+ var { children = null, id = '', className = '', component = 'article', isHoverable = false, isCompact = false, isSelectable = false, isSelectableRaised = false, isSelected = false, isDisabledRaised = false, isFlat = false, isExpanded = false, isRounded = false, isLarge = false, isFullHeight = false, isPlain = false, ouiaId, ouiaSafe = true, hasSelectableInput = false, selectableInputAriaLabel, onSelectableInputChange = () => { } } = _a, props = __rest$1(_a, ["children", "id", "className", "component", "isHoverable", "isCompact", "isSelectable", "isSelectableRaised", "isSelected", "isDisabledRaised", "isFlat", "isExpanded", "isRounded", "isLarge", "isFullHeight", "isPlain", "ouiaId", "ouiaSafe", "hasSelectableInput", "selectableInputAriaLabel", "onSelectableInputChange"]);
8052
8053
  const Component = component;
8053
8054
  const ouiaProps = useOUIAProps(Card.displayName, ouiaId, ouiaSafe);
8055
+ const [titleId, setTitleId] = React__namespace.useState('');
8056
+ const [ariaProps, setAriaProps] = React__namespace.useState();
8054
8057
  if (isCompact && isLarge) {
8055
8058
  // eslint-disable-next-line no-console
8056
8059
  console.warn('Card: Cannot use isCompact with isLarge. Defaulting to isCompact');
@@ -8068,10 +8071,30 @@
8068
8071
  }
8069
8072
  return '';
8070
8073
  };
8074
+ const containsCardTitleChildRef = React__namespace.useRef(false);
8075
+ const registerTitleId = (id) => {
8076
+ setTitleId(id);
8077
+ containsCardTitleChildRef.current = !!id;
8078
+ };
8079
+ React__namespace.useEffect(() => {
8080
+ if (selectableInputAriaLabel) {
8081
+ setAriaProps({ 'aria-label': selectableInputAriaLabel });
8082
+ }
8083
+ else if (titleId) {
8084
+ setAriaProps({ 'aria-labelledby': titleId });
8085
+ }
8086
+ else if (hasSelectableInput && !containsCardTitleChildRef.current) {
8087
+ setAriaProps({});
8088
+ // eslint-disable-next-line no-console
8089
+ console.warn('If no CardTitle component is passed as a child of Card the selectableInputAriaLabel prop must be passed');
8090
+ }
8091
+ }, [hasSelectableInput, selectableInputAriaLabel, titleId]);
8071
8092
  return (React__namespace.createElement(CardContext.Provider, { value: {
8072
8093
  cardId: id,
8094
+ registerTitleId,
8073
8095
  isExpanded
8074
8096
  } },
8097
+ hasSelectableInput && (React__namespace.createElement("input", Object.assign({ className: "pf-screen-reader", id: `${id}-input` }, ariaProps, { type: "checkbox", checked: isSelected, onChange: event => onSelectableInputChange(id, event), disabled: isDisabledRaised, tabIndex: -1 }))),
8075
8098
  React__namespace.createElement(Component, Object.assign({ id: id, className: css(styles$U.card, isCompact && styles$U.modifiers.compact, isExpanded && styles$U.modifiers.expanded, isFlat && styles$U.modifiers.flat, isRounded && styles$U.modifiers.rounded, isLarge && styles$U.modifiers.displayLg, isFullHeight && styles$U.modifiers.fullHeight, isPlain && styles$U.modifiers.plain, getSelectableModifiers(), className), tabIndex: isSelectable || isSelectableRaised ? '0' : undefined }, props, ouiaProps), children)));
8076
8099
  };
8077
8100
  Card.displayName = 'Card';
@@ -8104,8 +8127,14 @@
8104
8127
 
8105
8128
  const CardTitle = (_a) => {
8106
8129
  var { children = null, className = '', component = 'div' } = _a, props = __rest$1(_a, ["children", "className", "component"]);
8130
+ const { cardId, registerTitleId } = React__namespace.useContext(CardContext);
8107
8131
  const Component = component;
8108
- return (React__namespace.createElement(Component, Object.assign({ className: css(styles$U.cardTitle, className) }, props), children));
8132
+ const titleId = cardId ? `${cardId}-title` : '';
8133
+ React__namespace.useEffect(() => {
8134
+ registerTitleId(titleId);
8135
+ return () => registerTitleId('');
8136
+ }, [registerTitleId, titleId]);
8137
+ return (React__namespace.createElement(Component, Object.assign({ className: css(styles$U.cardTitle, className), id: titleId || undefined }, props), children));
8109
8138
  };
8110
8139
  CardTitle.displayName = 'CardTitle';
8111
8140
 
@@ -17578,6 +17578,20 @@ label.pf-c-radio, .pf-c-radio__label,
17578
17578
  transform: translateX(100%);
17579
17579
  }
17580
17580
  }
17581
+ .pf-c-skip-to-content {
17582
+ --pf-c-skip-to-content--Top: var(--pf-global--spacer--md);
17583
+ --pf-c-skip-to-content--ZIndex: var(--pf-global--ZIndex--2xl);
17584
+ --pf-c-skip-to-content--focus--Left: var(--pf-global--spacer--md);
17585
+ position: absolute;
17586
+ top: var(--pf-c-skip-to-content--Top);
17587
+ left: -300%;
17588
+ z-index: var(--pf-c-skip-to-content--ZIndex);
17589
+ }
17590
+
17591
+ .pf-c-skip-to-content:focus {
17592
+ left: var(--pf-c-skip-to-content--focus--Left);
17593
+ }
17594
+
17581
17595
  .pf-c-slider {
17582
17596
  --pf-c-slider--value: 0;
17583
17597
  --pf-c-slider__rail--PaddingTop: var(--pf-global--spacer--md);
@@ -17797,20 +17811,6 @@ label.pf-c-radio, .pf-c-radio__label,
17797
17811
  margin-left: var(--pf-c-slider__main--actions--MarginLeft);
17798
17812
  }
17799
17813
 
17800
- .pf-c-skip-to-content {
17801
- --pf-c-skip-to-content--Top: var(--pf-global--spacer--md);
17802
- --pf-c-skip-to-content--ZIndex: var(--pf-global--ZIndex--2xl);
17803
- --pf-c-skip-to-content--focus--Left: var(--pf-global--spacer--md);
17804
- position: absolute;
17805
- top: var(--pf-c-skip-to-content--Top);
17806
- left: -300%;
17807
- z-index: var(--pf-c-skip-to-content--ZIndex);
17808
- }
17809
-
17810
- .pf-c-skip-to-content:focus {
17811
- left: var(--pf-c-skip-to-content--focus--Left);
17812
- }
17813
-
17814
17814
  .pf-c-spinner {
17815
17815
  --pf-c-spinner--diameter: var(--pf-global--icon--FontSize--xl);
17816
17816
  --pf-c-spinner--Width: var(--pf-c-spinner--diameter);
@@ -21150,6 +21150,99 @@ svg.pf-c-spinner.pf-m-xl {
21150
21150
  --pf-c-toolbar--spacer: 0;
21151
21151
  }
21152
21152
 
21153
+ .pf-c-tooltip {
21154
+ --pf-c-tooltip--MaxWidth: 18.75rem;
21155
+ --pf-c-tooltip--BoxShadow: var(--pf-global--BoxShadow--md);
21156
+ --pf-c-tooltip__content--PaddingTop: var(--pf-global--spacer--sm);
21157
+ --pf-c-tooltip__content--PaddingRight: var(--pf-global--spacer--sm);
21158
+ --pf-c-tooltip__content--PaddingBottom: var(--pf-global--spacer--sm);
21159
+ --pf-c-tooltip__content--PaddingLeft: var(--pf-global--spacer--sm);
21160
+ --pf-c-tooltip__content--Color: var(--pf-global--Color--light-100);
21161
+ --pf-c-tooltip__content--BackgroundColor: var(--pf-global--BackgroundColor--dark-100);
21162
+ --pf-c-tooltip__content--FontSize: var(--pf-global--FontSize--sm);
21163
+ --pf-c-tooltip__arrow--Width: 0.5rem;
21164
+ --pf-c-tooltip__arrow--Height: 0.5rem;
21165
+ --pf-c-tooltip__arrow--m-top--TranslateX: -50%;
21166
+ --pf-c-tooltip__arrow--m-top--TranslateY: 50%;
21167
+ --pf-c-tooltip__arrow--m-top--Rotate: 45deg;
21168
+ --pf-c-tooltip__arrow--m-right--TranslateX: -50%;
21169
+ --pf-c-tooltip__arrow--m-right--TranslateY: -50%;
21170
+ --pf-c-tooltip__arrow--m-right--Rotate: 45deg;
21171
+ --pf-c-tooltip__arrow--m-bottom--TranslateX: -50%;
21172
+ --pf-c-tooltip__arrow--m-bottom--TranslateY: -50%;
21173
+ --pf-c-tooltip__arrow--m-bottom--Rotate: 45deg;
21174
+ --pf-c-tooltip__arrow--m-left--TranslateX: 50%;
21175
+ --pf-c-tooltip__arrow--m-left--TranslateY: -50%;
21176
+ --pf-c-tooltip__arrow--m-left--Rotate: 45deg;
21177
+ position: relative;
21178
+ max-width: var(--pf-c-tooltip--MaxWidth);
21179
+ box-shadow: var(--pf-c-tooltip--BoxShadow);
21180
+ }
21181
+
21182
+ .pf-c-tooltip.pf-m-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-top-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-top-right .pf-c-tooltip__arrow {
21183
+ bottom: 0;
21184
+ left: 50%;
21185
+ transform: translateX(var(--pf-c-tooltip__arrow--m-top--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-top--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-top--Rotate));
21186
+ }
21187
+
21188
+ .pf-c-tooltip.pf-m-bottom .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-right .pf-c-tooltip__arrow {
21189
+ top: 0;
21190
+ left: 50%;
21191
+ transform: translateX(var(--pf-c-tooltip__arrow--m-bottom--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-bottom--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-bottom--Rotate));
21192
+ }
21193
+
21194
+ .pf-c-tooltip.pf-m-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-left-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-left-bottom .pf-c-tooltip__arrow {
21195
+ top: 50%;
21196
+ right: 0;
21197
+ transform: translateX(var(--pf-c-tooltip__arrow--m-left--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-left--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-left--Rotate));
21198
+ }
21199
+
21200
+ .pf-c-tooltip.pf-m-right .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-bottom .pf-c-tooltip__arrow {
21201
+ top: 50%;
21202
+ left: 0;
21203
+ transform: translateX(var(--pf-c-tooltip__arrow--m-right--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-right--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-right--Rotate));
21204
+ }
21205
+
21206
+ .pf-c-tooltip.pf-m-left-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-top .pf-c-tooltip__arrow {
21207
+ top: var(--pf-c-tooltip__arrow--Height);
21208
+ }
21209
+
21210
+ .pf-c-tooltip.pf-m-left-bottom .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-bottom .pf-c-tooltip__arrow {
21211
+ top: auto;
21212
+ bottom: 0;
21213
+ }
21214
+
21215
+ .pf-c-tooltip.pf-m-top-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-left .pf-c-tooltip__arrow {
21216
+ left: var(--pf-c-tooltip__arrow--Width);
21217
+ }
21218
+
21219
+ .pf-c-tooltip.pf-m-top-right .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-right .pf-c-tooltip__arrow {
21220
+ right: 0;
21221
+ left: auto;
21222
+ }
21223
+
21224
+ .pf-c-tooltip__content {
21225
+ position: relative;
21226
+ padding: var(--pf-c-tooltip__content--PaddingTop) var(--pf-c-tooltip__content--PaddingRight) var(--pf-c-tooltip__content--PaddingBottom) var(--pf-c-tooltip__content--PaddingLeft);
21227
+ font-size: var(--pf-c-tooltip__content--FontSize);
21228
+ color: var(--pf-c-tooltip__content--Color);
21229
+ text-align: center;
21230
+ word-break: break-word;
21231
+ background-color: var(--pf-c-tooltip__content--BackgroundColor);
21232
+ }
21233
+
21234
+ .pf-c-tooltip__content.pf-m-text-align-left {
21235
+ text-align: left;
21236
+ }
21237
+
21238
+ .pf-c-tooltip__arrow {
21239
+ position: absolute;
21240
+ width: var(--pf-c-tooltip__arrow--Width);
21241
+ height: var(--pf-c-tooltip__arrow--Height);
21242
+ pointer-events: none;
21243
+ background-color: var(--pf-c-tooltip__content--BackgroundColor);
21244
+ }
21245
+
21153
21246
  .pf-c-number-input .pf-c-form-control {
21154
21247
  appearance: textfield;
21155
21248
  }
@@ -25954,99 +26047,6 @@ svg.pf-c-spinner.pf-m-xl {
25954
26047
  margin-bottom: var(--pf-l-stack--m-gutter--MarginBottom);
25955
26048
  }
25956
26049
 
25957
- .pf-c-tooltip {
25958
- --pf-c-tooltip--MaxWidth: 18.75rem;
25959
- --pf-c-tooltip--BoxShadow: var(--pf-global--BoxShadow--md);
25960
- --pf-c-tooltip__content--PaddingTop: var(--pf-global--spacer--sm);
25961
- --pf-c-tooltip__content--PaddingRight: var(--pf-global--spacer--sm);
25962
- --pf-c-tooltip__content--PaddingBottom: var(--pf-global--spacer--sm);
25963
- --pf-c-tooltip__content--PaddingLeft: var(--pf-global--spacer--sm);
25964
- --pf-c-tooltip__content--Color: var(--pf-global--Color--light-100);
25965
- --pf-c-tooltip__content--BackgroundColor: var(--pf-global--BackgroundColor--dark-100);
25966
- --pf-c-tooltip__content--FontSize: var(--pf-global--FontSize--sm);
25967
- --pf-c-tooltip__arrow--Width: 0.5rem;
25968
- --pf-c-tooltip__arrow--Height: 0.5rem;
25969
- --pf-c-tooltip__arrow--m-top--TranslateX: -50%;
25970
- --pf-c-tooltip__arrow--m-top--TranslateY: 50%;
25971
- --pf-c-tooltip__arrow--m-top--Rotate: 45deg;
25972
- --pf-c-tooltip__arrow--m-right--TranslateX: -50%;
25973
- --pf-c-tooltip__arrow--m-right--TranslateY: -50%;
25974
- --pf-c-tooltip__arrow--m-right--Rotate: 45deg;
25975
- --pf-c-tooltip__arrow--m-bottom--TranslateX: -50%;
25976
- --pf-c-tooltip__arrow--m-bottom--TranslateY: -50%;
25977
- --pf-c-tooltip__arrow--m-bottom--Rotate: 45deg;
25978
- --pf-c-tooltip__arrow--m-left--TranslateX: 50%;
25979
- --pf-c-tooltip__arrow--m-left--TranslateY: -50%;
25980
- --pf-c-tooltip__arrow--m-left--Rotate: 45deg;
25981
- position: relative;
25982
- max-width: var(--pf-c-tooltip--MaxWidth);
25983
- box-shadow: var(--pf-c-tooltip--BoxShadow);
25984
- }
25985
-
25986
- .pf-c-tooltip.pf-m-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-top-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-top-right .pf-c-tooltip__arrow {
25987
- bottom: 0;
25988
- left: 50%;
25989
- transform: translateX(var(--pf-c-tooltip__arrow--m-top--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-top--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-top--Rotate));
25990
- }
25991
-
25992
- .pf-c-tooltip.pf-m-bottom .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-right .pf-c-tooltip__arrow {
25993
- top: 0;
25994
- left: 50%;
25995
- transform: translateX(var(--pf-c-tooltip__arrow--m-bottom--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-bottom--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-bottom--Rotate));
25996
- }
25997
-
25998
- .pf-c-tooltip.pf-m-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-left-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-left-bottom .pf-c-tooltip__arrow {
25999
- top: 50%;
26000
- right: 0;
26001
- transform: translateX(var(--pf-c-tooltip__arrow--m-left--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-left--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-left--Rotate));
26002
- }
26003
-
26004
- .pf-c-tooltip.pf-m-right .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-bottom .pf-c-tooltip__arrow {
26005
- top: 50%;
26006
- left: 0;
26007
- transform: translateX(var(--pf-c-tooltip__arrow--m-right--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-right--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-right--Rotate));
26008
- }
26009
-
26010
- .pf-c-tooltip.pf-m-left-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-top .pf-c-tooltip__arrow {
26011
- top: var(--pf-c-tooltip__arrow--Height);
26012
- }
26013
-
26014
- .pf-c-tooltip.pf-m-left-bottom .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-bottom .pf-c-tooltip__arrow {
26015
- top: auto;
26016
- bottom: 0;
26017
- }
26018
-
26019
- .pf-c-tooltip.pf-m-top-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-left .pf-c-tooltip__arrow {
26020
- left: var(--pf-c-tooltip__arrow--Width);
26021
- }
26022
-
26023
- .pf-c-tooltip.pf-m-top-right .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-right .pf-c-tooltip__arrow {
26024
- right: 0;
26025
- left: auto;
26026
- }
26027
-
26028
- .pf-c-tooltip__content {
26029
- position: relative;
26030
- padding: var(--pf-c-tooltip__content--PaddingTop) var(--pf-c-tooltip__content--PaddingRight) var(--pf-c-tooltip__content--PaddingBottom) var(--pf-c-tooltip__content--PaddingLeft);
26031
- font-size: var(--pf-c-tooltip__content--FontSize);
26032
- color: var(--pf-c-tooltip__content--Color);
26033
- text-align: center;
26034
- word-break: break-word;
26035
- background-color: var(--pf-c-tooltip__content--BackgroundColor);
26036
- }
26037
-
26038
- .pf-c-tooltip__content.pf-m-text-align-left {
26039
- text-align: left;
26040
- }
26041
-
26042
- .pf-c-tooltip__arrow {
26043
- position: absolute;
26044
- width: var(--pf-c-tooltip__arrow--Width);
26045
- height: var(--pf-c-tooltip__arrow--Height);
26046
- pointer-events: none;
26047
- background-color: var(--pf-c-tooltip__content--BackgroundColor);
26048
- }
26049
-
26050
26050
  .pf-c-alert-group {
26051
26051
  --pf-c-alert-group__item--MarginTop: var(--pf-global--spacer--sm);
26052
26052
  --pf-c-alert-group--m-toast--Top: var(--pf-global--spacer--2xl);