@patternfly/patternfly-doc-core 1.5.0 → 1.7.0
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/.astro/collections/examples.schema.json +56 -0
- package/.astro/collections/textContent.schema.json +16 -0
- package/.astro/content-modules.mjs +4 -1
- package/.astro/content.d.ts +20 -1
- package/astro.config.mjs +2 -2
- package/declarations.d.ts +2 -0
- package/dist/client/_astro/Button.IBWho7ny.js +9 -0
- package/dist/client/_astro/CSSTable.DHtMmTtQ.js +1185 -0
- package/dist/client/_astro/LiveExample.B7IM_dLQ.css +1 -0
- package/dist/client/_astro/LiveExample.CwKQ5TSc.js +33 -0
- package/dist/client/_astro/Navigation.BSSYIa2f.js +1 -0
- package/dist/client/_astro/PageContext.ipir86Hm.js +1 -0
- package/dist/client/_astro/PageSidebarBody.tzSXGYXP.js +1 -0
- package/dist/client/_astro/PageToggle.C6_rp-Bm.js +1 -0
- package/dist/client/_astro/PageToggleButton.CagcouJB.js +1 -0
- package/dist/client/_astro/SearchInput.BjY-zTwj.js +1 -0
- package/dist/client/_astro/Toolbar.D4TQG77s.js +1 -0
- package/dist/client/_astro/ToolbarContent.DzYW_pmy.js +1 -0
- package/dist/client/_astro/_page_.BWicMEzd.css +1 -0
- package/dist/client/_astro/_page_.Chv_bGyU.css +1 -0
- package/dist/client/_astro/_page_.CtheD08_.css +1 -0
- package/dist/client/_astro/_page_.DxJDkZPc.css +1 -0
- package/dist/client/_astro/client.zs76E0tG.js +1 -0
- package/dist/client/_astro/divider.DTvtnAAt.js +1 -0
- package/dist/client/_astro/help-icon.CDKTE3GW.js +8 -0
- package/dist/client/_astro/index.BQFV5hT1.js +24 -0
- package/dist/client/_astro/index.eCxJ45ll.js +9 -0
- package/dist/client/_astro/page.BTC3Kf3x.js +1 -0
- package/dist/client/components/accordion/index.html +110 -0
- package/dist/client/design-foundations/typography/index.html +35 -8
- package/dist/client/design-foundations/usage-and-behavior/index.html +35 -8
- package/dist/client/get-started/contribute/index.html +35 -8
- package/dist/client/index.html +4 -3
- package/dist/server/_@astrojs-ssr-adapter.mjs +1 -1
- package/dist/server/chunks/Button_DVSwQ8oX.mjs +639 -0
- package/dist/server/chunks/CSSTable_CG80uW98.mjs +740 -0
- package/dist/server/chunks/CSSTable_Dj2CroFz.mjs +4 -0
- package/dist/server/chunks/{PropsTables_MQNZVYdD.mjs → PropsTables_DUo7F9VR.mjs} +169 -246
- package/dist/server/chunks/Stack_Xm3fJVbK.mjs +22 -0
- package/dist/server/chunks/{_@astrojs-ssr-adapter_8jk9s5dg.mjs → _@astrojs-ssr-adapter_CbICuCdt.mjs} +2 -2
- package/dist/server/chunks/{_astro_assets_CmxVRFAY.mjs → _astro_assets_DaYumpRZ.mjs} +2 -2
- package/dist/server/chunks/_astro_data-layer-content_1EAcQtZj.mjs +1 -0
- package/dist/server/chunks/{angle-down-icon_BNJvzYv-.mjs → angle-down-icon_DtGGiMR5.mjs} +150 -832
- package/dist/server/chunks/astro/{server_zRMEhmuT.mjs → server_Cl9jPh4p.mjs} +179 -89
- package/dist/server/chunks/{astro-designed-error-pages_DRBnGamN.mjs → astro-designed-error-pages_BFveJFnQ.mjs} +1 -1
- package/dist/server/chunks/content-modules_BzUEG69n.mjs +1 -0
- package/dist/server/chunks/{sharp_BAxaBZQw.mjs → sharp_CbOL3WDk.mjs} +2 -2
- package/dist/server/entry.mjs +4 -3
- package/dist/server/{manifest_7YAgSoyv.mjs → manifest_Dpwo8Jjv.mjs} +3 -3
- package/dist/server/pages/_image.astro.mjs +1 -1
- package/dist/server/renderers.mjs +63 -14
- package/jest.config.ts +1 -1
- package/package.json +5 -2
- package/src/components/AutoLinkHeader.tsx +56 -0
- package/src/components/CSSSearch.tsx +33 -0
- package/src/components/CSSTable.astro +33 -0
- package/src/components/CSSTable.tsx +268 -0
- package/src/components/Content.tsx +61 -0
- package/src/components/ExampleToolbar.tsx +296 -0
- package/src/components/LiveExample.astro +7 -0
- package/src/components/LiveExample.tsx +42 -0
- package/src/content.config.ts +10 -3
- package/src/content.ts +2 -1
- package/src/layouts/Main.astro +12 -8
- package/src/pages/[section]/[...page].astro +16 -6
- package/src/pages/[section]/[page]/[...tab].astro +107 -40
- package/src/pages/index.astro +0 -1
- package/src/styles/global.scss +47 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/slugger.ts +14 -0
- package/textContent/contribute.md +19 -13
- package/textContent/examples/Accordion/Accordion.mdx +45 -0
- package/textContent/examples/Accordion/AccordionBordered.tsx +141 -0
- package/textContent/examples/Accordion/AccordionDefinitionList.tsx +102 -0
- package/textContent/examples/Accordion/AccordionFixedWithMultipleExpandBehavior.tsx +128 -0
- package/textContent/examples/Accordion/AccordionSingleExpandBehavior.tsx +118 -0
- package/textContent/examples/Accordion/AccordionToggleIconAtStart.tsx +118 -0
- package/dist/client/_astro/Button.C3_jB5tC.js +0 -9
- package/dist/client/_astro/Navigation.CULUlMEB.js +0 -1
- package/dist/client/_astro/PageContext.C7BqCh9N.js +0 -1
- package/dist/client/_astro/PageToggle.DDEjruql.js +0 -1
- package/dist/client/_astro/Toolbar.TAdHxLSQ.js +0 -1
- package/dist/client/_astro/_page_.CXyz_BEo.css +0 -1
- package/dist/client/_astro/_page_.DVvr_Mfl.css +0 -1
- package/dist/client/_astro/_page_.SnUmZn2y.css +0 -1
- package/dist/client/_astro/client.CeeiqVaE.js +0 -1
- package/dist/client/_astro/divider.BSD-oFoh.js +0 -1
- package/dist/client/_astro/index.CTH3fVMn.js +0 -32
- package/dist/client/_astro/page.B65lVdBS.js +0 -1
- /package/dist/server/chunks/{_astro_data-layer-content_DDGBHvtb.mjs → Accordion_CGgMUho2.mjs} +0 -0
- /package/dist/server/chunks/{content-modules_Dz-S_Wwv.mjs → Accordion_DlM2LvlF.mjs} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { c as createComponent, a as createAstro, r as renderComponent, b as renderTemplate } from './astro/
|
|
1
|
+
import { c as createComponent, a as createAstro, r as renderComponent, b as renderTemplate } from './astro/server_Cl9jPh4p.mjs';
|
|
2
2
|
import 'kleur/colors';
|
|
3
|
-
import {
|
|
4
|
-
import { c as css, b as createIcon, B as Button,
|
|
3
|
+
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
4
|
+
import { c as css, b as createIcon, B as Button, r as getUniqueId, K as KeyTypes, v as BellIcon, I as InfoCircleIcon, d as ExclamationCircleIcon, E as ExclamationTriangleIcon, C as CheckCircleIcon, u as useOUIAProps } from './Button_DVSwQ8oX.mjs';
|
|
5
5
|
/* empty css */
|
|
6
|
+
import { S as Stack } from './Stack_Xm3fJVbK.mjs';
|
|
6
7
|
import { __rest } from 'tslib';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
/* empty css */
|
|
8
|
+
import { useRef, useEffect, forwardRef, useImperativeHandle, createContext, useState, createRef, Fragment, createElement, cloneElement, useContext } from 'react';
|
|
9
|
+
import { T as TimesIcon, P as Popper, u as useIsomorphicLayoutEffect, e as Tooltip, b as Dropdown, M as MenuToggle, c as DropdownList, D as Divider, d as DropdownItem, a as AngleDownIcon, f as checkStyles, S as StarIcon, g as Checkbox, s as setTabIndex, h as handleArrows } from './angle-down-icon_DtGGiMR5.mjs';
|
|
10
10
|
import mergeWith from 'lodash/mergeWith.js';
|
|
11
|
+
/* empty css */
|
|
11
12
|
import { createFocusTrap } from 'focus-trap';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -58,11 +59,11 @@ const FocusTrap = forwardRef(function FocusTrap(_a, forwardedRef) {
|
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
|
-
return
|
|
62
|
+
return jsx("div", Object.assign({ ref: ref }, props));
|
|
62
63
|
});
|
|
63
64
|
FocusTrap.displayName = 'FocusTrap';
|
|
64
65
|
|
|
65
|
-
const styles$
|
|
66
|
+
const styles$4 = {
|
|
66
67
|
"actionList": "pf-v6-c-action-list",
|
|
67
68
|
"modifiers": {
|
|
68
69
|
"icons": "pf-m-icons"
|
|
@@ -71,13 +72,13 @@ const styles$5 = {
|
|
|
71
72
|
|
|
72
73
|
const ActionList = (_a) => {
|
|
73
74
|
var { children, isIconList, className } = _a, props = __rest(_a, ["children", "isIconList", "className"]);
|
|
74
|
-
return (
|
|
75
|
+
return (jsx("div", Object.assign({ className: css(styles$4.actionList, isIconList && styles$4.modifiers.icons, className) }, props, { children: children })));
|
|
75
76
|
};
|
|
76
77
|
ActionList.displayName = 'ActionList';
|
|
77
78
|
|
|
78
79
|
const ActionListItem = (_a) => {
|
|
79
80
|
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
|
|
80
|
-
return (
|
|
81
|
+
return (jsx("div", Object.assign({ className: css(`${styles$4.actionList}__item`, className) }, props, { children: children })));
|
|
81
82
|
};
|
|
82
83
|
ActionListItem.displayName = 'ActionListItem';
|
|
83
84
|
|
|
@@ -92,7 +93,7 @@ const GripVerticalIconConfig = {
|
|
|
92
93
|
|
|
93
94
|
const GripVerticalIcon = createIcon(GripVerticalIconConfig);
|
|
94
95
|
|
|
95
|
-
const styles$
|
|
96
|
+
const styles$3 = {
|
|
96
97
|
"modifiers": {
|
|
97
98
|
"noPadding": "pf-m-no-padding",
|
|
98
99
|
"widthAuto": "pf-m-width-auto",
|
|
@@ -126,60 +127,54 @@ const styles$4 = {
|
|
|
126
127
|
"popoverTitleText": "pf-v6-c-popover__title-text"
|
|
127
128
|
};
|
|
128
129
|
|
|
129
|
-
const PopoverContext =
|
|
130
|
+
const PopoverContext = createContext({});
|
|
130
131
|
|
|
131
132
|
const PopoverContent = (_a) => {
|
|
132
133
|
var { className = null, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
133
|
-
return (
|
|
134
|
+
return (jsx("div", Object.assign({ className: css(styles$3.popoverContent, className) }, props, { children: children })));
|
|
134
135
|
};
|
|
135
136
|
PopoverContent.displayName = 'PopoverContent';
|
|
136
137
|
|
|
137
138
|
const PopoverBody = (_a) => {
|
|
138
139
|
var { children, id, className } = _a, props = __rest(_a, ["children", "id", "className"]);
|
|
139
|
-
return (
|
|
140
|
+
return (jsx("div", Object.assign({ className: css(styles$3.popoverBody, className), id: id }, props, { children: children })));
|
|
140
141
|
};
|
|
141
142
|
PopoverBody.displayName = 'PopoverBody';
|
|
142
143
|
|
|
143
144
|
const PopoverHeaderIcon = (_a) => {
|
|
144
145
|
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
|
|
145
|
-
return (
|
|
146
|
+
return (jsx("span", Object.assign({ className: css(styles$3.popoverTitleIcon, className) }, props, { children: children })));
|
|
146
147
|
};
|
|
147
148
|
PopoverHeaderIcon.displayName = 'PopoverHeaderIcon';
|
|
148
149
|
|
|
149
150
|
const PopoverHeaderText = (_a) => {
|
|
150
151
|
var { children, className, headingLevel } = _a, props = __rest(_a, ["children", "className", "headingLevel"]);
|
|
151
152
|
const HeadingLevel = headingLevel;
|
|
152
|
-
return (
|
|
153
|
+
return (jsx(HeadingLevel, Object.assign({ className: css(styles$3.popoverTitleText, className) }, props, { children: children })));
|
|
153
154
|
};
|
|
154
155
|
PopoverHeaderText.displayName = 'PopoverHeaderText';
|
|
155
156
|
|
|
156
157
|
const PopoverHeader = (_a) => {
|
|
157
158
|
var { children, icon, className, titleHeadingLevel = 'h6', alertSeverityVariant, id, alertSeverityScreenReaderText } = _a, props = __rest(_a, ["children", "icon", "className", "titleHeadingLevel", "alertSeverityVariant", "id", "alertSeverityScreenReaderText"]);
|
|
158
|
-
return (
|
|
159
|
-
React.createElement("div", { className: css(styles$4.popoverTitle), id: id },
|
|
160
|
-
icon && React.createElement(PopoverHeaderIcon, null, icon),
|
|
161
|
-
React.createElement(PopoverHeaderText, { headingLevel: titleHeadingLevel },
|
|
162
|
-
alertSeverityVariant && alertSeverityScreenReaderText && (React.createElement("span", { className: "pf-v6-screen-reader" }, alertSeverityScreenReaderText)),
|
|
163
|
-
children))));
|
|
159
|
+
return (jsx("header", Object.assign({ className: css(styles$3.popoverHeader, className) }, props, { children: jsxs("div", { className: css(styles$3.popoverTitle), id: id, children: [icon && jsx(PopoverHeaderIcon, { children: icon }), jsxs(PopoverHeaderText, { headingLevel: titleHeadingLevel, children: [alertSeverityVariant && alertSeverityScreenReaderText && (jsx("span", { className: "pf-v6-screen-reader", children: alertSeverityScreenReaderText })), children] })] }) })));
|
|
164
160
|
};
|
|
165
161
|
PopoverHeader.displayName = 'PopoverHeader';
|
|
166
162
|
|
|
167
163
|
const PopoverFooter = (_a) => {
|
|
168
164
|
var { children, className = '' } = _a, props = __rest(_a, ["children", "className"]);
|
|
169
|
-
return (
|
|
165
|
+
return (jsx("footer", Object.assign({ className: css(styles$3.popoverFooter, className) }, props, { children: children })));
|
|
170
166
|
};
|
|
171
167
|
PopoverFooter.displayName = 'PopoverFooter';
|
|
172
168
|
|
|
173
169
|
const PopoverCloseButton = (_a) => {
|
|
174
170
|
var { onClose = () => undefined } = _a, props = __rest(_a, ["onClose"]);
|
|
175
|
-
return (
|
|
176
|
-
React.createElement(Button, Object.assign({ onClick: onClose, variant: "plain", "aria-label": true }, props, { style: { pointerEvents: 'auto' }, icon: React.createElement(TimesIcon, null) }))));
|
|
171
|
+
return (jsx("div", { className: css(styles$3.popoverClose), children: jsx(Button, Object.assign({ onClick: onClose, variant: "plain", "aria-label": true }, props, { style: { pointerEvents: 'auto' }, icon: jsx(TimesIcon, {}) })) }));
|
|
177
172
|
};
|
|
178
173
|
PopoverCloseButton.displayName = 'PopoverCloseButton';
|
|
179
174
|
|
|
180
175
|
const PopoverArrow = (_a) => {
|
|
181
176
|
var { className = '' } = _a, props = __rest(_a, ["className"]);
|
|
182
|
-
return
|
|
177
|
+
return jsx("div", Object.assign({ className: css(styles$3.popoverArrow, className) }, props));
|
|
183
178
|
};
|
|
184
179
|
PopoverArrow.displayName = 'PopoverArrow';
|
|
185
180
|
|
|
@@ -212,11 +207,11 @@ var PopoverPosition;
|
|
|
212
207
|
PopoverPosition["rightEnd"] = "right-end";
|
|
213
208
|
})(PopoverPosition || (PopoverPosition = {}));
|
|
214
209
|
const alertStyle = {
|
|
215
|
-
custom: styles$
|
|
216
|
-
info: styles$
|
|
217
|
-
success: styles$
|
|
218
|
-
warning: styles$
|
|
219
|
-
danger: styles$
|
|
210
|
+
custom: styles$3.modifiers.custom,
|
|
211
|
+
info: styles$3.modifiers.info,
|
|
212
|
+
success: styles$3.modifiers.success,
|
|
213
|
+
warning: styles$3.modifiers.warning,
|
|
214
|
+
danger: styles$3.modifiers.danger
|
|
220
215
|
};
|
|
221
216
|
const Popover = (_a) => {
|
|
222
217
|
var { children, position = 'top', enableFlip = true, className = '', isVisible = null, shouldClose = () => null, shouldOpen = () => null, 'aria-label': ariaLabel = '', bodyContent, headerContent = null, headerComponent = 'h6', headerIcon = null, alertSeverityVariant, alertSeverityScreenReaderText, footerContent = null, appendTo = () => document.body, hideOnOutsideClick = true, onHide = () => null, onHidden = () => null, onShow = () => null, onShown = () => null, onMount = () => null, zIndex = 9999, triggerAction = 'click', minWidth = c_popover_MinWidth && c_popover_MinWidth.value, maxWidth = c_popover_MaxWidth && c_popover_MaxWidth.value, closeBtnAriaLabel = 'Close', showClose = true, distance = 25, flipBehavior = [
|
|
@@ -237,13 +232,13 @@ const Popover = (_a) => {
|
|
|
237
232
|
// const hideOnClick = true;
|
|
238
233
|
const uniqueId = id || getUniqueId();
|
|
239
234
|
const triggerManually = isVisible !== null;
|
|
240
|
-
const [visible, setVisible] =
|
|
241
|
-
const [focusTrapActive, setFocusTrapActive] =
|
|
242
|
-
const popoverRef =
|
|
243
|
-
|
|
235
|
+
const [visible, setVisible] = useState(false);
|
|
236
|
+
const [focusTrapActive, setFocusTrapActive] = useState(Boolean(propWithFocusTrap));
|
|
237
|
+
const popoverRef = useRef(null);
|
|
238
|
+
useEffect(() => {
|
|
244
239
|
onMount();
|
|
245
240
|
}, []);
|
|
246
|
-
|
|
241
|
+
useEffect(() => {
|
|
247
242
|
if (triggerManually) {
|
|
248
243
|
if (isVisible) {
|
|
249
244
|
show(undefined, true);
|
|
@@ -263,18 +258,18 @@ const Popover = (_a) => {
|
|
|
263
258
|
setVisible(false);
|
|
264
259
|
};
|
|
265
260
|
const positionModifiers = {
|
|
266
|
-
top: styles$
|
|
267
|
-
bottom: styles$
|
|
268
|
-
left: styles$
|
|
269
|
-
right: styles$
|
|
270
|
-
'top-start': styles$
|
|
271
|
-
'top-end': styles$
|
|
272
|
-
'bottom-start': styles$
|
|
273
|
-
'bottom-end': styles$
|
|
274
|
-
'left-start': styles$
|
|
275
|
-
'left-end': styles$
|
|
276
|
-
'right-start': styles$
|
|
277
|
-
'right-end': styles$
|
|
261
|
+
top: styles$3.modifiers.top,
|
|
262
|
+
bottom: styles$3.modifiers.bottom,
|
|
263
|
+
left: styles$3.modifiers.left,
|
|
264
|
+
right: styles$3.modifiers.right,
|
|
265
|
+
'top-start': styles$3.modifiers.topLeft,
|
|
266
|
+
'top-end': styles$3.modifiers.topRight,
|
|
267
|
+
'bottom-start': styles$3.modifiers.bottomLeft,
|
|
268
|
+
'bottom-end': styles$3.modifiers.bottomRight,
|
|
269
|
+
'left-start': styles$3.modifiers.leftTop,
|
|
270
|
+
'left-end': styles$3.modifiers.leftBottom,
|
|
271
|
+
'right-start': styles$3.modifiers.rightTop,
|
|
272
|
+
'right-end': styles$3.modifiers.rightBottom
|
|
278
273
|
};
|
|
279
274
|
const hasCustomMinWidth = minWidth !== c_popover_MinWidth.value;
|
|
280
275
|
const hasCustomMaxWidth = maxWidth !== c_popover_MaxWidth.value;
|
|
@@ -368,7 +363,7 @@ const Popover = (_a) => {
|
|
|
368
363
|
hide(event);
|
|
369
364
|
}
|
|
370
365
|
};
|
|
371
|
-
const content = (
|
|
366
|
+
const content = (jsxs(FocusTrap, Object.assign({ ref: popoverRef, active: focusTrapActive, focusTrapOptions: {
|
|
372
367
|
returnFocusOnDeactivate: propWithFocusTrap !== false,
|
|
373
368
|
clickOutsideDeactivates: true,
|
|
374
369
|
// FocusTrap's initialFocus can accept false as a value to prevent initial focus.
|
|
@@ -394,18 +389,11 @@ const Popover = (_a) => {
|
|
|
394
389
|
}
|
|
395
390
|
return node;
|
|
396
391
|
}
|
|
397
|
-
}, preventScrollOnDeactivate: true, className: css(styles$
|
|
392
|
+
}, preventScrollOnDeactivate: true, className: css(styles$3.popover, alertSeverityVariant && alertStyle[alertSeverityVariant], hasNoPadding && styles$3.modifiers.noPadding, hasAutoWidth && styles$3.modifiers.widthAuto, className), role: "dialog", "aria-modal": "true", "aria-label": headerContent ? undefined : ariaLabel, "aria-labelledby": headerContent ? `popover-${uniqueId}-header` : undefined, "aria-describedby": `popover-${uniqueId}-body`, onMouseDown: onContentMouseDown, style: {
|
|
398
393
|
minWidth: hasCustomMinWidth ? minWidth : null,
|
|
399
394
|
maxWidth: hasCustomMaxWidth ? maxWidth : null
|
|
400
|
-
} }, rest),
|
|
401
|
-
|
|
402
|
-
React.createElement(PopoverContent, null,
|
|
403
|
-
showClose && triggerAction === 'click' && (React.createElement(PopoverCloseButton, { onClose: closePopover, "aria-label": closeBtnAriaLabel })),
|
|
404
|
-
headerContent && (React.createElement(PopoverHeader, { id: `popover-${uniqueId}-header`, icon: headerIcon, alertSeverityVariant: alertSeverityVariant, alertSeverityScreenReaderText: alertSeverityScreenReaderText || `${alertSeverityVariant} alert:`, titleHeadingLevel: headerComponent }, typeof headerContent === 'function' ? headerContent(hide) : headerContent)),
|
|
405
|
-
React.createElement(PopoverBody, { id: `popover-${uniqueId}-body` }, typeof bodyContent === 'function' ? bodyContent(hide) : bodyContent),
|
|
406
|
-
footerContent && (React.createElement(PopoverFooter, { id: `popover-${uniqueId}-footer` }, typeof footerContent === 'function' ? footerContent(hide) : footerContent)))));
|
|
407
|
-
return (React.createElement(PopoverContext.Provider, { value: { headerComponent } },
|
|
408
|
-
React.createElement(Popper, { trigger: children, triggerRef: triggerRef, popper: content, popperRef: popoverRef, minWidth: minWidth, appendTo: appendTo, isVisible: visible, onMouseEnter: triggerAction === 'hover' && onMouseEnter, onMouseLeave: triggerAction === 'hover' && onMouseLeave, onPopperMouseEnter: triggerAction === 'hover' && onMouseEnter, onPopperMouseLeave: triggerAction === 'hover' && onMouseLeave, onFocus: triggerAction === 'hover' && onFocus, onBlur: triggerAction === 'hover' && onBlur, positionModifiers: positionModifiers, distance: distance, placement: position, onTriggerClick: triggerAction === 'click' && onTriggerClick, onDocumentClick: onDocumentClick, onDocumentKeyDown: onDocumentKeyDown, enableFlip: enableFlip, zIndex: zIndex, flipBehavior: flipBehavior, animationDuration: animationDuration, onHidden: onHidden, onShown: onShown, onHide: () => setFocusTrapActive(false) })));
|
|
395
|
+
} }, rest, { children: [jsx(PopoverArrow, {}), jsxs(PopoverContent, { children: [showClose && triggerAction === 'click' && (jsx(PopoverCloseButton, { onClose: closePopover, "aria-label": closeBtnAriaLabel })), headerContent && (jsx(PopoverHeader, { id: `popover-${uniqueId}-header`, icon: headerIcon, alertSeverityVariant: alertSeverityVariant, alertSeverityScreenReaderText: alertSeverityScreenReaderText || `${alertSeverityVariant} alert:`, titleHeadingLevel: headerComponent, children: typeof headerContent === 'function' ? headerContent(hide) : headerContent })), jsx(PopoverBody, { id: `popover-${uniqueId}-body`, children: typeof bodyContent === 'function' ? bodyContent(hide) : bodyContent }), footerContent && (jsx(PopoverFooter, { id: `popover-${uniqueId}-footer`, children: typeof footerContent === 'function' ? footerContent(hide) : footerContent }))] })] })));
|
|
396
|
+
return (jsx(PopoverContext.Provider, { value: { headerComponent }, children: jsx(Popper, { trigger: children, triggerRef: triggerRef, popper: content, popperRef: popoverRef, minWidth: minWidth, appendTo: appendTo, isVisible: visible, onMouseEnter: triggerAction === 'hover' && onMouseEnter, onMouseLeave: triggerAction === 'hover' && onMouseLeave, onPopperMouseEnter: triggerAction === 'hover' && onMouseEnter, onPopperMouseLeave: triggerAction === 'hover' && onMouseLeave, onFocus: triggerAction === 'hover' && onFocus, onBlur: triggerAction === 'hover' && onBlur, positionModifiers: positionModifiers, distance: distance, placement: position, onTriggerClick: triggerAction === 'click' && onTriggerClick, onDocumentClick: onDocumentClick, onDocumentKeyDown: onDocumentKeyDown, enableFlip: enableFlip, zIndex: zIndex, flipBehavior: flipBehavior, animationDuration: animationDuration, onHidden: onHidden, onShown: onShown, onHide: () => setFocusTrapActive(false) }) }));
|
|
409
397
|
};
|
|
410
398
|
Popover.displayName = 'Popover';
|
|
411
399
|
|
|
@@ -441,7 +429,7 @@ const labelStyles = {
|
|
|
441
429
|
}
|
|
442
430
|
};
|
|
443
431
|
|
|
444
|
-
const styles$
|
|
432
|
+
const styles$2 = {
|
|
445
433
|
"modifiers": {
|
|
446
434
|
"editable": "pf-m-editable"}
|
|
447
435
|
};
|
|
@@ -461,21 +449,21 @@ const colorStyles = {
|
|
|
461
449
|
grey: ''
|
|
462
450
|
};
|
|
463
451
|
const statusIcons = {
|
|
464
|
-
success:
|
|
465
|
-
warning:
|
|
466
|
-
danger:
|
|
467
|
-
info:
|
|
468
|
-
custom:
|
|
452
|
+
success: jsx(CheckCircleIcon, {}),
|
|
453
|
+
warning: jsx(ExclamationTriangleIcon, {}),
|
|
454
|
+
danger: jsx(ExclamationCircleIcon, {}),
|
|
455
|
+
info: jsx(InfoCircleIcon, {}),
|
|
456
|
+
custom: jsx(BellIcon, {})
|
|
469
457
|
};
|
|
470
458
|
const Label = (_a) => {
|
|
471
|
-
var { children, className = '', color = 'grey', variant = 'filled', status, isCompact = false, isDisabled = false, isEditable = false, editableProps, textMaxWidth, tooltipPosition, icon, onClose, onClick: onLabelClick, onEditCancel, onEditComplete, closeBtn, closeBtnAriaLabel, closeBtnProps, href, render } = _a, props = __rest(_a, ["children", "className", "color", "variant", "status", "isCompact", "isDisabled", "isEditable", "editableProps", "textMaxWidth", "tooltipPosition", "icon", "onClose", "onClick", "onEditCancel", "onEditComplete", "closeBtn", "closeBtnAriaLabel", "closeBtnProps", "href", "render"]);
|
|
459
|
+
var { children, className = '', color = 'grey', variant = 'filled', status, isCompact = false, isDisabled = false, isEditable = false, isClickable: isClickableProp = false, editableProps, textMaxWidth, tooltipPosition, icon, onClose, onClick: onLabelClick, onEditCancel, onEditComplete, closeBtn, closeBtnAriaLabel, closeBtnProps, href, render } = _a, props = __rest(_a, ["children", "className", "color", "variant", "status", "isCompact", "isDisabled", "isEditable", "isClickable", "editableProps", "textMaxWidth", "tooltipPosition", "icon", "onClose", "onClick", "onEditCancel", "onEditComplete", "closeBtn", "closeBtnAriaLabel", "closeBtnProps", "href", "render"]);
|
|
472
460
|
const [isEditableActive, setIsEditableActive] = useState(false);
|
|
473
461
|
const [currValue, setCurrValue] = useState(children);
|
|
474
|
-
const editableButtonRef =
|
|
475
|
-
const editableInputRef =
|
|
462
|
+
const editableButtonRef = useRef(undefined);
|
|
463
|
+
const editableInputRef = useRef(undefined);
|
|
476
464
|
const isOverflowLabel = variant === 'overflow';
|
|
477
465
|
const isAddLabel = variant === 'add';
|
|
478
|
-
const isClickable = (onLabelClick && !isOverflowLabel && !isAddLabel) || href;
|
|
466
|
+
const isClickable = isClickableProp || (onLabelClick && !isOverflowLabel && !isAddLabel) || href;
|
|
479
467
|
let _icon;
|
|
480
468
|
if (status) {
|
|
481
469
|
_icon = statusIcons[status];
|
|
@@ -483,7 +471,7 @@ const Label = (_a) => {
|
|
|
483
471
|
if (icon) {
|
|
484
472
|
_icon = icon;
|
|
485
473
|
}
|
|
486
|
-
|
|
474
|
+
useEffect(() => {
|
|
487
475
|
document.addEventListener('mousedown', onDocMouseDown);
|
|
488
476
|
document.addEventListener('keydown', onKeyDown);
|
|
489
477
|
return () => {
|
|
@@ -491,7 +479,7 @@ const Label = (_a) => {
|
|
|
491
479
|
document.removeEventListener('keydown', onKeyDown);
|
|
492
480
|
};
|
|
493
481
|
});
|
|
494
|
-
|
|
482
|
+
useEffect(() => {
|
|
495
483
|
if (onLabelClick && href) {
|
|
496
484
|
// eslint-disable-next-line no-console
|
|
497
485
|
console.warn('Link labels cannot have onClick passed, this results in invalid HTML. Please remove either the href or onClick prop.');
|
|
@@ -558,26 +546,24 @@ const Label = (_a) => {
|
|
|
558
546
|
}
|
|
559
547
|
};
|
|
560
548
|
const isClickableDisabled = (href || onLabelClick) && isDisabled;
|
|
561
|
-
const defaultCloseButton = (
|
|
562
|
-
const closeButton =
|
|
563
|
-
const textRef =
|
|
549
|
+
const defaultCloseButton = (jsx(Button, Object.assign({ type: "button", variant: "plain", hasNoPadding: true, onClick: onClose, "aria-label": closeBtnAriaLabel || `Close ${children}` }, (isClickableDisabled && { isDisabled: true }), closeBtnProps, { icon: jsx(TimesIcon, {}) })));
|
|
550
|
+
const closeButton = jsx("span", { className: css(labelStyles.labelActions), children: closeBtn || defaultCloseButton });
|
|
551
|
+
const textRef = createRef();
|
|
564
552
|
// ref to apply tooltip when rendered is used
|
|
565
|
-
const componentRef =
|
|
566
|
-
const [isTooltipVisible, setIsTooltipVisible] =
|
|
553
|
+
const componentRef = useRef(undefined);
|
|
554
|
+
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
|
|
567
555
|
useIsomorphicLayoutEffect(() => {
|
|
568
556
|
const currTextRef = isEditable ? editableButtonRef : textRef;
|
|
569
557
|
if (!isEditableActive) {
|
|
570
558
|
setIsTooltipVisible(currTextRef.current && currTextRef.current.offsetWidth < currTextRef.current.scrollWidth);
|
|
571
559
|
}
|
|
572
560
|
}, [isEditableActive]);
|
|
573
|
-
const content = (
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
})), children)));
|
|
580
|
-
React.useEffect(() => {
|
|
561
|
+
const content = (jsxs(Fragment, { children: [_icon && jsx("span", { className: css(labelStyles.labelIcon), children: _icon }), jsx("span", Object.assign({ ref: textRef, className: css(labelStyles.labelText) }, (textMaxWidth && {
|
|
562
|
+
style: {
|
|
563
|
+
[c_label__text_MaxWidth.name]: textMaxWidth
|
|
564
|
+
}
|
|
565
|
+
}), { children: children }))] }));
|
|
566
|
+
useEffect(() => {
|
|
581
567
|
if (isEditableActive && editableInputRef) {
|
|
582
568
|
editableInputRef.current && editableInputRef.current.focus();
|
|
583
569
|
}
|
|
@@ -601,40 +587,22 @@ const Label = (_a) => {
|
|
|
601
587
|
setIsEditableActive(true);
|
|
602
588
|
e.stopPropagation();
|
|
603
589
|
} }, editableProps))), (isClickableDisabled && isButton && { disabled: true })), (isClickableDisabled && href && { tabIndex: -1, 'aria-disabled': true }));
|
|
604
|
-
let labelComponentChild = (
|
|
590
|
+
let labelComponentChild = (jsx(LabelComponentChildElement, Object.assign({}, labelComponentChildProps, { children: content })));
|
|
605
591
|
if (render) {
|
|
606
|
-
labelComponentChild = (
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
componentRef
|
|
612
|
-
})));
|
|
592
|
+
labelComponentChild = (jsxs(Fragment, { children: [isTooltipVisible && jsx(Tooltip, { triggerRef: componentRef, content: children, position: tooltipPosition }), render({
|
|
593
|
+
className: labelStyles.labelContent,
|
|
594
|
+
content,
|
|
595
|
+
componentRef
|
|
596
|
+
})] }));
|
|
613
597
|
}
|
|
614
598
|
else if (isTooltipVisible) {
|
|
615
|
-
labelComponentChild = (
|
|
599
|
+
labelComponentChild = (jsx(Tooltip, { content: children, position: tooltipPosition, children: labelComponentChild }));
|
|
616
600
|
}
|
|
617
601
|
const LabelComponent = (isOverflowLabel ? 'button' : 'span');
|
|
618
|
-
return (
|
|
619
|
-
!isEditableActive && labelComponentChild,
|
|
620
|
-
!isEditableActive && onClose && closeButton,
|
|
621
|
-
isEditableActive && (React.createElement("input", Object.assign({ className: css(labelStyles.labelContent), type: "text", id: "editable-input", ref: editableInputRef, value: currValue, onChange: updateVal }, editableProps)))));
|
|
602
|
+
return (jsxs(LabelComponent, Object.assign({}, props, { className: css(labelStyles.label, isClickableDisabled && labelStyles.modifiers.disabled, colorStyles[color], variant === 'filled' && labelStyles.modifiers.filled, variant === 'outline' && labelStyles.modifiers.outline, status && labelStyles.modifiers[status], isOverflowLabel && labelStyles.modifiers.overflow, isCompact && labelStyles.modifiers.compact, isEditable && styles$2.modifiers.editable, isEditableActive && labelStyles.modifiers.editableActive, isClickable && labelStyles.modifiers.clickable, isAddLabel && labelStyles.modifiers.add, className), onClick: isOverflowLabel || isAddLabel ? onLabelClick : undefined }, (LabelComponent === 'button' && { type: 'button' }), { children: [!isEditableActive && labelComponentChild, !isEditableActive && onClose && closeButton, isEditableActive && (jsx("input", Object.assign({ className: css(labelStyles.labelContent), type: "text", id: "editable-input", ref: editableInputRef, value: currValue, onChange: updateVal }, editableProps)))] })));
|
|
622
603
|
};
|
|
623
604
|
Label.displayName = 'Label';
|
|
624
605
|
|
|
625
|
-
const styles$2 = {
|
|
626
|
-
"modifiers": {
|
|
627
|
-
"gutter": "pf-m-gutter"
|
|
628
|
-
},
|
|
629
|
-
"stack": "pf-v6-l-stack"};
|
|
630
|
-
|
|
631
|
-
const Stack = (_a) => {
|
|
632
|
-
var { hasGutter = false, className = '', children = null, component = 'div' } = _a, props = __rest(_a, ["hasGutter", "className", "children", "component"]);
|
|
633
|
-
const Component = component;
|
|
634
|
-
return (React.createElement(Component, Object.assign({}, props, { className: css(styles$2.stack, hasGutter && styles$2.modifiers.gutter, className) }), children));
|
|
635
|
-
};
|
|
636
|
-
Stack.displayName = 'Stack';
|
|
637
|
-
|
|
638
606
|
const EllipsisVIconConfig = {
|
|
639
607
|
name: 'EllipsisVIcon',
|
|
640
608
|
height: 512,
|
|
@@ -651,7 +619,7 @@ const ActionsColumnBase = (_a) => {
|
|
|
651
619
|
position: 'end',
|
|
652
620
|
direction: 'down'
|
|
653
621
|
}, innerRef, firstActionItemRef, isOnOpenChangeDisabled = false } = _a, props = __rest(_a, ["items", "isDisabled", "rowData", "extraData", "actionsToggle", "popperProps", "innerRef", "firstActionItemRef", "isOnOpenChangeDisabled"]);
|
|
654
|
-
const [isOpen, setIsOpen] =
|
|
622
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
655
623
|
const onToggle = () => {
|
|
656
624
|
setIsOpen(!isOpen);
|
|
657
625
|
};
|
|
@@ -663,35 +631,32 @@ const ActionsColumnBase = (_a) => {
|
|
|
663
631
|
onClick(event, extraData && extraData.rowIndex, rowData, extraData);
|
|
664
632
|
}
|
|
665
633
|
};
|
|
666
|
-
return (
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
return item;
|
|
691
|
-
}
|
|
692
|
-
})))));
|
|
634
|
+
return (jsxs(Fragment, { children: [items
|
|
635
|
+
.filter((item) => item.isOutsideDropdown)
|
|
636
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
637
|
+
.map((_a, key) => {
|
|
638
|
+
var { title, itemKey, onClick, isOutsideDropdown } = _a, props = __rest(_a, ["title", "itemKey", "onClick", "isOutsideDropdown"]);
|
|
639
|
+
return typeof title === 'string' ? (createElement(Button, Object.assign({ onClick: (event) => onActionClick(event, onClick) }, props, { isDisabled: isDisabled, key: itemKey || `outside_dropdown_${key}`, "data-key": itemKey || `outside_dropdown_${key}` }), title)) : (cloneElement(title, Object.assign({ onClick, isDisabled }, props)));
|
|
640
|
+
}), jsx(Dropdown, Object.assign({ isOpen: isOpen, onOpenChange: !isOnOpenChangeDisabled ? (isOpen) => setIsOpen(isOpen) : undefined, toggle: (toggleRef) => actionsToggle ? (actionsToggle({ onToggle, isOpen, isDisabled, toggleRef })) : (jsx(MenuToggle, { "aria-label": "Kebab toggle", ref: toggleRef, onClick: onToggle, isExpanded: isOpen, isDisabled: isDisabled, variant: "plain", icon: jsx(EllipsisVIcon, {}) })) }, (rowData && rowData.actionProps), { ref: innerRef }, props, { popperProps: popperProps, children: jsx(DropdownList, { children: items
|
|
641
|
+
.filter((item) => !item.isOutsideDropdown)
|
|
642
|
+
.map((_a, index) => {
|
|
643
|
+
var { title, itemKey, onClick, tooltipProps, isSeparator, shouldCloseOnClick = true } = _a, props = __rest(_a, ["title", "itemKey", "onClick", "tooltipProps", "isSeparator", "shouldCloseOnClick"]);
|
|
644
|
+
if (isSeparator) {
|
|
645
|
+
return jsx(Divider, { "data-key": itemKey || index }, itemKey || index);
|
|
646
|
+
}
|
|
647
|
+
const item = (createElement(DropdownItem, Object.assign({ onClick: (event) => {
|
|
648
|
+
onActionClick(event, onClick);
|
|
649
|
+
shouldCloseOnClick && onToggle();
|
|
650
|
+
} }, props, { key: itemKey || index, "data-key": itemKey || index, ref: index === 0 ? firstActionItemRef : undefined }), title));
|
|
651
|
+
if (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content) {
|
|
652
|
+
return (jsx(Tooltip, Object.assign({}, tooltipProps, { children: item }), itemKey || index));
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
return item;
|
|
656
|
+
}
|
|
657
|
+
}) }) }))] }));
|
|
693
658
|
};
|
|
694
|
-
const ActionsColumn =
|
|
659
|
+
const ActionsColumn = forwardRef((props, ref) => (jsx(ActionsColumnBase, Object.assign({}, props, { innerRef: ref }))));
|
|
695
660
|
ActionsColumn.displayName = 'ActionsColumn';
|
|
696
661
|
|
|
697
662
|
const styles$1 = {
|
|
@@ -777,16 +742,13 @@ const styles$1 = {
|
|
|
777
742
|
|
|
778
743
|
const CollapseColumn = (_a) => {
|
|
779
744
|
var { className = '', children = null, isOpen, onToggle } = _a, props = __rest(_a, ["className", "children", "isOpen", "onToggle"]);
|
|
780
|
-
return (
|
|
781
|
-
isOpen !== undefined && (React.createElement(Button, Object.assign({ className: css(className, isOpen && styles$1.modifiers.expanded) }, props, { variant: "plain", "aria-label": props['aria-label'] || 'Details', onClick: onToggle, "aria-expanded": isOpen, icon: React.createElement("div", { className: css(styles$1.tableToggleIcon) },
|
|
782
|
-
React.createElement(AngleDownIcon, null)) }))),
|
|
783
|
-
children));
|
|
745
|
+
return (jsxs(Fragment, { children: [isOpen !== undefined && (jsx(Button, Object.assign({ className: css(className, isOpen && styles$1.modifiers.expanded) }, props, { variant: "plain", "aria-label": props['aria-label'] || 'Details', onClick: onToggle, "aria-expanded": isOpen, icon: jsx("div", { className: css(styles$1.tableToggleIcon), children: jsx(AngleDownIcon, {}) }) }))), children] }));
|
|
784
746
|
};
|
|
785
747
|
CollapseColumn.displayName = 'CollapseColumn';
|
|
786
748
|
|
|
787
749
|
const DraggableCell = (_a) => {
|
|
788
750
|
var { className, onClick, 'aria-label': ariaLabel, id } = _a, props = __rest(_a, ["className", "onClick", 'aria-label', "id"]);
|
|
789
|
-
return (
|
|
751
|
+
return (jsx(Button, Object.assign({ id: id, variant: "plain", className: className, type: "button", "aria-label": ariaLabel || `Draggable row draggable button`, onClick: onClick }, props, { icon: jsx(GripVerticalIcon, {}) })));
|
|
790
752
|
};
|
|
791
753
|
DraggableCell.displayName = 'DraggableCell';
|
|
792
754
|
|
|
@@ -822,8 +784,8 @@ var WrapModifier;
|
|
|
822
784
|
const TableText = (_a) => {
|
|
823
785
|
var { children = null, className = '', variant = 'span', wrapModifier = null, tooltip: tooltipProp = '', tooltipProps = {}, onMouseEnter: onMouseEnterProp = () => { }, focused = false, tooltipHasDefaultBehavior = false } = _a, props = __rest(_a, ["children", "className", "variant", "wrapModifier", "tooltip", "tooltipProps", "onMouseEnter", "focused", "tooltipHasDefaultBehavior"]);
|
|
824
786
|
const Component = variant;
|
|
825
|
-
const textRef =
|
|
826
|
-
const [tooltip, setTooltip] =
|
|
787
|
+
const textRef = createRef();
|
|
788
|
+
const [tooltip, setTooltip] = useState(tooltipProp);
|
|
827
789
|
const onMouseEnter = (event) => {
|
|
828
790
|
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
829
791
|
setTooltip(tooltipProp || event.target.innerText);
|
|
@@ -841,8 +803,8 @@ const TableText = (_a) => {
|
|
|
841
803
|
setTooltip('');
|
|
842
804
|
}
|
|
843
805
|
};
|
|
844
|
-
const text = (
|
|
845
|
-
|
|
806
|
+
const text = (jsx(Component, Object.assign({ ref: textRef, onMouseEnter: !tooltipHasDefaultBehavior ? onMouseEnter : undefined, className: css(className, wrapModifier && styles$1.modifiers[wrapModifier], styles$1.tableText) }, props, { children: children })));
|
|
807
|
+
useEffect(() => {
|
|
846
808
|
if (!tooltipHasDefaultBehavior) {
|
|
847
809
|
if (focused) {
|
|
848
810
|
onFocus(textRef.current);
|
|
@@ -852,15 +814,11 @@ const TableText = (_a) => {
|
|
|
852
814
|
}
|
|
853
815
|
}
|
|
854
816
|
}, [focused, tooltipHasDefaultBehavior]);
|
|
855
|
-
return tooltip !== '' ? (
|
|
817
|
+
return tooltip !== '' ? (jsx(Tooltip, Object.assign({ triggerRef: textRef, content: tooltip }, (!tooltipHasDefaultBehavior && { isVisible: true }), tooltipProps, { children: text }))) : (text);
|
|
856
818
|
};
|
|
857
819
|
TableText.displayName = 'TableText';
|
|
858
820
|
|
|
859
|
-
const HeaderCellInfoWrapper = ({ children, info, className, variant = 'tooltip', popoverProps, tooltipProps, ariaLabel }) => (
|
|
860
|
-
typeof children === 'string' ? React.createElement(TableText, null, children) : children,
|
|
861
|
-
React.createElement("span", { className: css(styles$1.tableColumnHelpAction) }, variant === 'tooltip' ? (React.createElement(Tooltip, Object.assign({ content: info }, tooltipProps),
|
|
862
|
-
React.createElement(Button, { variant: "plain", hasNoPadding: true, "aria-label": ariaLabel || (typeof info === 'string' && info) || 'More info', icon: React.createElement(HelpIcon, null) }))) : (React.createElement(Popover, Object.assign({ bodyContent: info }, popoverProps),
|
|
863
|
-
React.createElement(Button, { variant: "plain", hasNoPadding: true, "aria-label": ariaLabel || (typeof info === 'string' && info) || 'More info', icon: React.createElement(HelpIcon, null) }))))));
|
|
821
|
+
const HeaderCellInfoWrapper = ({ children, info, className, variant = 'tooltip', popoverProps, tooltipProps, ariaLabel }) => (jsxs("div", { className: css(styles$1.tableColumnHelp, className), children: [typeof children === 'string' ? jsx(TableText, { children: children }) : children, jsx("span", { className: css(styles$1.tableColumnHelpAction), children: variant === 'tooltip' ? (jsx(Tooltip, Object.assign({ content: info }, tooltipProps, { children: jsx(Button, { variant: "plain", hasNoPadding: true, "aria-label": ariaLabel || (typeof info === 'string' && info) || 'More info', icon: jsx(HelpIcon, {}) }) }))) : (jsx(Popover, Object.assign({ bodyContent: info }, popoverProps, { children: jsx(Button, { variant: "plain", hasNoPadding: true, "aria-label": ariaLabel || (typeof info === 'string' && info) || 'More info', icon: jsx(HelpIcon, {}) }) }))) })] }));
|
|
864
822
|
HeaderCellInfoWrapper.displayName = 'HeaderCellInfoWrapper';
|
|
865
823
|
|
|
866
824
|
const stylesGrid = {
|
|
@@ -912,12 +870,9 @@ const SelectColumn = (_a) => {
|
|
|
912
870
|
var { children = null,
|
|
913
871
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
914
872
|
className, onSelect = null, selectVariant, tooltip, tooltipProps } = _a, props = __rest(_a, ["children", "className", "onSelect", "selectVariant", "tooltip", "tooltipProps"]);
|
|
915
|
-
const inputRef =
|
|
916
|
-
const content = (
|
|
917
|
-
|
|
918
|
-
React.createElement("input", Object.assign({}, props, { ref: inputRef, type: selectVariant, onChange: onSelect }))),
|
|
919
|
-
children));
|
|
920
|
-
return tooltip ? (React.createElement(Tooltip, Object.assign({ triggerRef: inputRef, content: tooltip }, tooltipProps), content)) : (content);
|
|
873
|
+
const inputRef = createRef();
|
|
874
|
+
const content = (jsxs(Fragment, { children: [jsx("label", { children: jsx("input", Object.assign({}, props, { ref: inputRef, type: selectVariant, onChange: onSelect })) }), children] }));
|
|
875
|
+
return tooltip ? (jsx(Tooltip, Object.assign({ triggerRef: inputRef, content: tooltip }, tooltipProps, { children: content }))) : (content);
|
|
921
876
|
};
|
|
922
877
|
SelectColumn.displayName = 'SelectColumn';
|
|
923
878
|
|
|
@@ -968,7 +923,7 @@ const selectable = (label, { rowIndex, columnIndex, rowData, column, property, t
|
|
|
968
923
|
className: css(styles$1.tableCheck),
|
|
969
924
|
component: rowId !== -1 ? 'td' : 'th',
|
|
970
925
|
isVisible: !rowData || !rowData.fullWidth,
|
|
971
|
-
children: (
|
|
926
|
+
children: (jsx(SelectColumn, Object.assign({}, customProps, { selectVariant: selectVariant, onSelect: selectClick, name: selectName, tooltip: tooltip, children: label })))
|
|
972
927
|
};
|
|
973
928
|
};
|
|
974
929
|
|
|
@@ -1013,7 +968,7 @@ var SortByDirection;
|
|
|
1013
968
|
const SortColumn = (_a) => {
|
|
1014
969
|
var { children = null, className = '', isSortedBy = false, onSort = null, sortDirection = '', type = 'button', tooltip, tooltipProps, tooltipHasDefaultBehavior, favoriteButtonProps } = _a, props = __rest(_a, ["children", "className", "isSortedBy", "onSort", "sortDirection", "type", "tooltip", "tooltipProps", "tooltipHasDefaultBehavior", "favoriteButtonProps"]);
|
|
1015
970
|
let SortedByIcon;
|
|
1016
|
-
const [focused, setFocused] =
|
|
971
|
+
const [focused, setFocused] = useState(false);
|
|
1017
972
|
if (isSortedBy) {
|
|
1018
973
|
SortedByIcon = sortDirection === SortByDirection.asc ? LongArrowAltUpIcon : LongArrowAltDownIcon;
|
|
1019
974
|
}
|
|
@@ -1021,24 +976,15 @@ const SortColumn = (_a) => {
|
|
|
1021
976
|
SortedByIcon = ArrowsAltVIcon;
|
|
1022
977
|
}
|
|
1023
978
|
if (favoriteButtonProps) {
|
|
1024
|
-
return (
|
|
1025
|
-
React.createElement(ActionListItem, null,
|
|
1026
|
-
React.createElement(Button, Object.assign({ variant: "plain", icon: React.createElement(StarIcon, null) }, favoriteButtonProps))),
|
|
1027
|
-
React.createElement(ActionListItem, null,
|
|
1028
|
-
React.createElement(Button, Object.assign({ variant: "plain", icon: React.createElement("span", { className: css(styles$1.tableSortIndicator) },
|
|
1029
|
-
React.createElement(SortedByIcon, null)), onClick: (event) => onSort && onSort(event) }, props)))));
|
|
979
|
+
return (jsxs(ActionList, { isIconList: true, children: [jsx(ActionListItem, { children: jsx(Button, Object.assign({ variant: "plain", icon: jsx(StarIcon, {}) }, favoriteButtonProps)) }), jsx(ActionListItem, { children: jsx(Button, Object.assign({ variant: "plain", icon: jsx("span", { className: css(styles$1.tableSortIndicator), children: jsx(SortedByIcon, {}) }), onClick: (event) => onSort && onSort(event) }, props)) })] }));
|
|
1030
980
|
}
|
|
1031
|
-
return (
|
|
1032
|
-
React.createElement("div", { className: css(className, styles$1.tableButtonContent) },
|
|
1033
|
-
React.createElement(TableText, { tooltip: tooltip, tooltipProps: tooltipProps, tooltipHasDefaultBehavior: tooltipHasDefaultBehavior, focused: focused }, children),
|
|
1034
|
-
React.createElement("span", { className: css(styles$1.tableSortIndicator) },
|
|
1035
|
-
React.createElement(SortedByIcon, null)))));
|
|
981
|
+
return (jsx("button", Object.assign({}, props, { type: type, className: css(className, styles$1.tableButton), onClick: (event) => onSort && onSort(event), onFocus: () => setFocused(true), onBlur: () => setFocused(false), children: jsxs("div", { className: css(className, styles$1.tableButtonContent), children: [jsx(TableText, { tooltip: tooltip, tooltipProps: tooltipProps, tooltipHasDefaultBehavior: tooltipHasDefaultBehavior, focused: focused, children: children }), jsx("span", { className: css(styles$1.tableSortIndicator), children: jsx(SortedByIcon, {}) })] }) })));
|
|
1036
982
|
};
|
|
1037
983
|
SortColumn.displayName = 'SortColumn';
|
|
1038
984
|
|
|
1039
985
|
const sortableFavorites = (sort) => () => {
|
|
1040
986
|
var _a;
|
|
1041
|
-
return sortable(
|
|
987
|
+
return sortable(jsx(StarIcon, {}), {
|
|
1042
988
|
columnIndex: sort.columnIndex,
|
|
1043
989
|
className: styles$1.tableFavorite,
|
|
1044
990
|
ariaLabel: (_a = sort.ariaLabel) !== null && _a !== void 0 ? _a : 'Sort favorites',
|
|
@@ -1076,7 +1022,7 @@ const sortable = (label, { columnIndex, column, property, className, ariaLabel,
|
|
|
1076
1022
|
// tslint:disable-next-line:no-unused-expression
|
|
1077
1023
|
onSort && onSort(event, columnIndex, reversedDirection, extraData);
|
|
1078
1024
|
}
|
|
1079
|
-
return Object.assign(Object.assign({ className: css(styles$1.tableSort, isSortedBy && styles$1.modifiers.selected, className) }, (isSortedBy && { 'aria-sort': `${sortBy.direction}ending` })), { children: (
|
|
1025
|
+
return Object.assign(Object.assign({ className: css(styles$1.tableSort, isSortedBy && styles$1.modifiers.selected, className) }, (isSortedBy && { 'aria-sort': `${sortBy.direction}ending` })), { children: (jsx(SortColumn, { isSortedBy: isSortedBy, sortDirection: isSortedBy ? sortBy.direction : '', onSort: sortClicked, "aria-label": ariaLabel, tooltip: tooltip, tooltipProps: tooltipProps, tooltipHasDefaultBehavior: tooltipHasDefaultBehavior, favoriteButtonProps: favoriteButtonProps, children: label })) });
|
|
1080
1026
|
};
|
|
1081
1027
|
|
|
1082
1028
|
const resolveOrDefault = (resolver, defaultValue, rowData, extraData) => (defaultValue);
|
|
@@ -1091,7 +1037,7 @@ const cellActions = (actions, actionResolver, areActionsDisabled) => (label, { r
|
|
|
1091
1037
|
const resolvedIsDisabled = resolveOrDefault(areActionsDisabled, rowData && rowData.disableActions);
|
|
1092
1038
|
const renderProps = resolvedActions && resolvedActions.length > 0
|
|
1093
1039
|
? {
|
|
1094
|
-
children: (
|
|
1040
|
+
children: (jsx(ActionsColumn, { items: resolvedActions, isDisabled: resolvedIsDisabled, rowData: rowData, extraData: extraData, actionsToggle: actionsToggle, popperProps: actionsPopperProps, children: label }))
|
|
1095
1041
|
}
|
|
1096
1042
|
: {};
|
|
1097
1043
|
return Object.assign({ className: css(styles$1.tableAction), style: { paddingRight: 0 }, isVisible: true }, renderProps);
|
|
@@ -1139,7 +1085,7 @@ const collapsible = (value, { rowIndex, columnIndex, rowData, column, property }
|
|
|
1139
1085
|
return {
|
|
1140
1086
|
className: ((rowData === null || rowData === void 0 ? void 0 : rowData.isOpen) !== undefined || rowId === -1) && css(styles$1.tableToggle),
|
|
1141
1087
|
isVisible: !(rowData === null || rowData === void 0 ? void 0 : rowData.fullWidth),
|
|
1142
|
-
children: (
|
|
1088
|
+
children: (jsx(CollapseColumn, Object.assign({ "aria-labelledby": `${rowLabeledBy}${rowId} ${expandId}${rowId}`, onToggle: onToggle, id: expandId + rowId }, customProps, { children: value })))
|
|
1143
1089
|
};
|
|
1144
1090
|
};
|
|
1145
1091
|
|
|
@@ -1164,8 +1110,7 @@ const compoundExpand = (value, { rowIndex, columnIndex, rowData, column, propert
|
|
|
1164
1110
|
}
|
|
1165
1111
|
return {
|
|
1166
1112
|
className: css(styles$1.tableCompoundExpansionToggle, props.isOpen && styles$1.modifiers.expanded),
|
|
1167
|
-
children: props.isOpen !== undefined && (
|
|
1168
|
-
React.createElement(TableText, null, title)))
|
|
1113
|
+
children: props.isOpen !== undefined && (jsx("button", { type: "button", className: css(styles$1.tableButton), onClick: onToggle, "aria-expanded": props.isOpen, "aria-controls": props.ariaControls, id: `${expandId}-${rowIndex}-${columnIndex}`, children: jsx(TableText, { children: title }) }))
|
|
1169
1114
|
};
|
|
1170
1115
|
};
|
|
1171
1116
|
|
|
@@ -1196,7 +1141,7 @@ const classNames = (...classes) => () => ({
|
|
|
1196
1141
|
const info = ({ tooltip, tooltipProps, popover, popoverProps, className, ariaLabel }) => {
|
|
1197
1142
|
const infoObj = (value) => ({
|
|
1198
1143
|
className: styles$1.modifiers.help,
|
|
1199
|
-
children: tooltip ? (
|
|
1144
|
+
children: tooltip ? (jsx(HeaderCellInfoWrapper, { variant: "tooltip", info: tooltip, tooltipProps: tooltipProps, ariaLabel: ariaLabel, className: className, children: value })) : (jsx(HeaderCellInfoWrapper, { variant: "popover", info: popover, popoverProps: popoverProps, ariaLabel: ariaLabel, className: className, children: value }))
|
|
1200
1145
|
});
|
|
1201
1146
|
return infoObj;
|
|
1202
1147
|
};
|
|
@@ -1209,7 +1154,7 @@ const FavoritesCell = (_a) => {
|
|
|
1209
1154
|
id: `favorites-button-${rowIndex}`,
|
|
1210
1155
|
'aria-labelledby': `favorites-button-${rowIndex}`
|
|
1211
1156
|
};
|
|
1212
|
-
return (
|
|
1157
|
+
return (jsx(Button, Object.assign({ variant: "plain", className: className, type: "button", "aria-label": isFavorited ? 'Starred' : 'Not starred', onClick: onFavorite }, ariaProps, props, { icon: jsx(StarIcon, {}) })));
|
|
1213
1158
|
};
|
|
1214
1159
|
FavoritesCell.displayName = 'FavoritesCell';
|
|
1215
1160
|
|
|
@@ -1239,7 +1184,7 @@ const favoritable = (value, { rowIndex, columnIndex, rowData, column, property }
|
|
|
1239
1184
|
return {
|
|
1240
1185
|
className: css(styles$1.tableFavorite, rowData && rowData.favorited && styles$1.modifiers.favorited),
|
|
1241
1186
|
isVisible: !rowData || !rowData.fullWidth,
|
|
1242
|
-
children: (
|
|
1187
|
+
children: (jsx(FavoritesCell, Object.assign({ rowIndex: rowIndex, onFavorite: favoritesClick, isFavorited: rowData && rowData.favorited }, additionalProps)))
|
|
1243
1188
|
};
|
|
1244
1189
|
};
|
|
1245
1190
|
|
|
@@ -1257,26 +1202,14 @@ const EllipsisHIcon = createIcon(EllipsisHIconConfig);
|
|
|
1257
1202
|
const treeRow = (onCollapse, onCheckChange, onToggleRowDetails) => (value, { rowIndex, rowData }) => {
|
|
1258
1203
|
const { isExpanded, isDetailsExpanded, 'aria-level': level, 'aria-setsize': setsize, toggleAriaLabel, checkAriaLabel, showDetailsAriaLabel, isChecked, checkboxId, icon } = rowData.props;
|
|
1259
1204
|
const content = value.title || value;
|
|
1260
|
-
const text = (
|
|
1261
|
-
icon && (React.createElement("span", { className: css(treeViewStyles.tableTreeViewIcon), key: "tree-view-text-icon" }, icon)),
|
|
1262
|
-
React.createElement("span", { className: styles$1.tableText, key: "table-text" }, content)));
|
|
1205
|
+
const text = (jsxs("div", { className: css(treeViewStyles.tableTreeViewText), children: [icon && (jsx("span", { className: css(treeViewStyles.tableTreeViewIcon), children: icon }, "tree-view-text-icon")), jsx("span", { className: styles$1.tableText, children: content }, "table-text")] }, "tree-view-text"));
|
|
1263
1206
|
const onChange = (isChecked, event) => {
|
|
1264
1207
|
onCheckChange(event, isChecked, rowIndex, content, rowData);
|
|
1265
1208
|
};
|
|
1266
1209
|
return {
|
|
1267
1210
|
component: 'th',
|
|
1268
1211
|
className: treeViewStyles.tableTreeViewTitleCell,
|
|
1269
|
-
children: level !== undefined ? (
|
|
1270
|
-
setsize > 0 && (React.createElement("span", { className: css(treeViewStyles.tableToggle), key: "table-toggle" },
|
|
1271
|
-
React.createElement(Button, { variant: "plain", onClick: (event) => onCollapse && onCollapse(event, rowIndex, content, rowData), className: css(isExpanded && styles$1.modifiers.expanded), "aria-expanded": isExpanded, "aria-label": toggleAriaLabel || `${isExpanded ? 'Collapse' : 'Expand'} row ${rowIndex}`, icon: React.createElement("div", { className: css(treeViewStyles.tableToggleIcon) },
|
|
1272
|
-
React.createElement(AngleDownIcon, { "aria-hidden": "true" })) }))),
|
|
1273
|
-
!!onCheckChange && (React.createElement("span", { className: css(treeViewStyles.tableCheck), key: "table-check" },
|
|
1274
|
-
React.createElement("label", { htmlFor: checkboxId || `checkbox_${rowIndex}` },
|
|
1275
|
-
React.createElement(Checkbox, { id: checkboxId || `checkbox_${rowIndex}`, "aria-label": checkAriaLabel || `Row ${rowIndex} checkbox`, isChecked: isChecked, onChange: (event, checked) => onChange(checked, event) })))),
|
|
1276
|
-
text,
|
|
1277
|
-
!!onToggleRowDetails && (React.createElement("span", { className: css(treeViewStyles.tableTreeViewDetailsToggle), key: "view-details-toggle" },
|
|
1278
|
-
React.createElement(Button, { variant: "plain", "aria-expanded": isDetailsExpanded, "aria-label": showDetailsAriaLabel || 'Show row details', onClick: (event) => onToggleRowDetails && onToggleRowDetails(event, rowIndex, content, rowData), icon: React.createElement("span", { className: `${styles$1.table}__details-toggle-icon` },
|
|
1279
|
-
React.createElement(EllipsisHIcon, { "aria-hidden": true })) }))))) : (text)
|
|
1212
|
+
children: level !== undefined ? (jsxs("div", { className: css(treeViewStyles.tableTreeViewMain), children: [setsize > 0 && (jsx("span", { className: css(treeViewStyles.tableToggle), children: jsx(Button, { variant: "plain", onClick: (event) => onCollapse && onCollapse(event, rowIndex, content, rowData), className: css(isExpanded && styles$1.modifiers.expanded), "aria-expanded": isExpanded, "aria-label": toggleAriaLabel || `${isExpanded ? 'Collapse' : 'Expand'} row ${rowIndex}`, icon: jsx("div", { className: css(treeViewStyles.tableToggleIcon), children: jsx(AngleDownIcon, {}) }) }) }, "table-toggle")), !!onCheckChange && (jsx("span", { className: css(treeViewStyles.tableCheck), children: jsx("label", { htmlFor: checkboxId || `checkbox_${rowIndex}`, children: jsx(Checkbox, { id: checkboxId || `checkbox_${rowIndex}`, "aria-label": checkAriaLabel || `Row ${rowIndex} checkbox`, isChecked: isChecked, onChange: (event, checked) => onChange(checked, event) }) }) }, "table-check")), text, !!onToggleRowDetails && (jsx("span", { className: css(treeViewStyles.tableTreeViewDetailsToggle), children: jsx(Button, { variant: "plain", "aria-expanded": isDetailsExpanded, "aria-label": showDetailsAriaLabel || 'Show row details', onClick: (event) => onToggleRowDetails && onToggleRowDetails(event, rowIndex, content, rowData), icon: jsx("span", { className: `${styles$1.table}__details-toggle-icon`, children: jsx(EllipsisHIcon, {}) }) }) }, "view-details-toggle"))] })) : (text)
|
|
1280
1213
|
};
|
|
1281
1214
|
};
|
|
1282
1215
|
|
|
@@ -1294,7 +1227,7 @@ var TableVariant;
|
|
|
1294
1227
|
TableVariant["compact"] = "compact";
|
|
1295
1228
|
})(TableVariant || (TableVariant = {}));
|
|
1296
1229
|
|
|
1297
|
-
const TableContext =
|
|
1230
|
+
const TableContext = createContext({
|
|
1298
1231
|
registerSelectableRow: () => { }
|
|
1299
1232
|
});
|
|
1300
1233
|
const TableBase = (_a) => {
|
|
@@ -1302,11 +1235,11 @@ const TableBase = (_a) => {
|
|
|
1302
1235
|
var { children, className, variant, borders = true, isStickyHeader = false, gridBreakPoint = TableGridBreakpoint.gridMd, 'aria-label': ariaLabel, role = 'grid', innerRef, ouiaId, ouiaSafe = true, isTreeTable = false, isNested = false, isStriped = false, isExpandable = false, hasNoInset = false,
|
|
1303
1236
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1304
1237
|
nestedHeaderColumnSpans, selectableRowCaptionText } = _a, props = __rest(_a, ["children", "className", "variant", "borders", "isStickyHeader", "gridBreakPoint", 'aria-label', "role", "innerRef", "ouiaId", "ouiaSafe", "isTreeTable", "isNested", "isStriped", "isExpandable", "hasNoInset", "nestedHeaderColumnSpans", "selectableRowCaptionText"]);
|
|
1305
|
-
const ref =
|
|
1238
|
+
const ref = useRef(null);
|
|
1306
1239
|
const tableRef = innerRef || ref;
|
|
1307
|
-
const [hasSelectableRows, setHasSelectableRows] =
|
|
1308
|
-
const [tableCaption, setTableCaption] =
|
|
1309
|
-
|
|
1240
|
+
const [hasSelectableRows, setHasSelectableRows] = useState(false);
|
|
1241
|
+
const [tableCaption, setTableCaption] = useState();
|
|
1242
|
+
useEffect(() => {
|
|
1310
1243
|
document.addEventListener('keydown', handleKeys);
|
|
1311
1244
|
// sets up roving tab-index to tree tables only
|
|
1312
1245
|
if (tableRef && tableRef.current && tableRef.current.classList.contains('pf-m-tree-view')) {
|
|
@@ -1317,14 +1250,12 @@ const TableBase = (_a) => {
|
|
|
1317
1250
|
document.removeEventListener('keydown', handleKeys);
|
|
1318
1251
|
};
|
|
1319
1252
|
}, [tableRef, tableRef.current]);
|
|
1320
|
-
|
|
1253
|
+
useEffect(() => {
|
|
1321
1254
|
if (selectableRowCaptionText) {
|
|
1322
|
-
setTableCaption(
|
|
1323
|
-
selectableRowCaptionText,
|
|
1324
|
-
React.createElement("div", { className: "pf-v6-screen-reader" }, "This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space or enter.")));
|
|
1255
|
+
setTableCaption(jsxs("caption", { children: [selectableRowCaptionText, jsx("div", { className: "pf-v6-screen-reader", children: "This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space or enter." })] }));
|
|
1325
1256
|
}
|
|
1326
1257
|
else {
|
|
1327
|
-
setTableCaption(
|
|
1258
|
+
setTableCaption(jsx("caption", { className: "pf-v6-screen-reader", children: "This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space or enter." }));
|
|
1328
1259
|
}
|
|
1329
1260
|
}, [selectableRowCaptionText]);
|
|
1330
1261
|
const ouiaProps = useOUIAProps('Table', ouiaId, ouiaSafe);
|
|
@@ -1350,18 +1281,15 @@ const TableBase = (_a) => {
|
|
|
1350
1281
|
const registerSelectableRow = () => {
|
|
1351
1282
|
!hasSelectableRows && setHasSelectableRows(true);
|
|
1352
1283
|
};
|
|
1353
|
-
return (
|
|
1354
|
-
React.createElement("table", Object.assign({ "aria-label": ariaLabel, role: role, className: css(className, styles$1.table, isTreeTable ? treeGrid : grid, styles$1.modifiers[variant], !borders && styles$1.modifiers.noBorderRows, isStickyHeader && styles$1.modifiers.stickyHeader, isTreeTable && treeViewStyles.modifiers.treeView, isStriped && styles$1.modifiers.striped, isExpandable && styles$1.modifiers.expandable, hasNoInset && treeViewStyles.modifiers.noInset, isNested && 'pf-m-nested'), ref: tableRef }, (isTreeTable && { role: 'treegrid' }), ouiaProps, props),
|
|
1355
|
-
hasSelectableRows && tableCaption,
|
|
1356
|
-
children)));
|
|
1284
|
+
return (jsx(TableContext.Provider, { value: { registerSelectableRow }, children: jsxs("table", Object.assign({ "aria-label": ariaLabel, role: role, className: css(className, styles$1.table, isTreeTable ? treeGrid : grid, styles$1.modifiers[variant], !borders && styles$1.modifiers.noBorderRows, isStickyHeader && styles$1.modifiers.stickyHeader, isTreeTable && treeViewStyles.modifiers.treeView, isStriped && styles$1.modifiers.striped, isExpandable && styles$1.modifiers.expandable, hasNoInset && treeViewStyles.modifiers.noInset, isNested && 'pf-m-nested'), ref: tableRef }, (isTreeTable && { role: 'treegrid' }), ouiaProps, props, { children: [hasSelectableRows && tableCaption, children] })) }));
|
|
1357
1285
|
};
|
|
1358
|
-
const Table =
|
|
1286
|
+
const Table = forwardRef((props, ref) => (jsx(TableBase, Object.assign({}, props, { innerRef: ref }))));
|
|
1359
1287
|
Table.displayName = 'Table';
|
|
1360
1288
|
|
|
1361
1289
|
const TrBase = (_a) => {
|
|
1362
1290
|
var { children, className, isExpanded, isEditable, isHidden = false, isClickable = false, isRowSelected = false, isStriped = false, isBorderRow = false, isControlRow = false, innerRef, ouiaId, ouiaSafe = true, resetOffset = false, onRowClick, isSelectable, 'aria-label': passedAriaLabel } = _a, props = __rest(_a, ["children", "className", "isExpanded", "isEditable", "isHidden", "isClickable", "isRowSelected", "isStriped", "isBorderRow", "isControlRow", "innerRef", "ouiaId", "ouiaSafe", "resetOffset", "onRowClick", "isSelectable", 'aria-label']);
|
|
1363
1291
|
const ouiaProps = useOUIAProps('TableRow', ouiaId, ouiaSafe);
|
|
1364
|
-
const [computedAriaLabel, setComputedAriaLabel] =
|
|
1292
|
+
const [computedAriaLabel, setComputedAriaLabel] = useState('');
|
|
1365
1293
|
let onKeyDown = null;
|
|
1366
1294
|
if (onRowClick) {
|
|
1367
1295
|
onKeyDown = (e) => {
|
|
@@ -1372,8 +1300,8 @@ const TrBase = (_a) => {
|
|
|
1372
1300
|
};
|
|
1373
1301
|
}
|
|
1374
1302
|
const rowIsHidden = isHidden || (isExpanded !== undefined && !isExpanded);
|
|
1375
|
-
const { registerSelectableRow } =
|
|
1376
|
-
|
|
1303
|
+
const { registerSelectableRow } = useContext(TableContext);
|
|
1304
|
+
useEffect(() => {
|
|
1377
1305
|
if (isSelectable && !rowIsHidden) {
|
|
1378
1306
|
setComputedAriaLabel(`${isRowSelected ? 'Row selected' : ''}`);
|
|
1379
1307
|
registerSelectableRow();
|
|
@@ -1383,24 +1311,23 @@ const TrBase = (_a) => {
|
|
|
1383
1311
|
}
|
|
1384
1312
|
}, [isRowSelected, isSelectable, registerSelectableRow, rowIsHidden]);
|
|
1385
1313
|
const ariaLabel = passedAriaLabel || computedAriaLabel;
|
|
1386
|
-
return (
|
|
1387
|
-
React.createElement("tr", Object.assign({ className: css(styles$1.tableTr, className, isExpanded !== undefined && styles$1.tableExpandableRow, isExpanded && styles$1.modifiers.expanded, isEditable && inlineStyles.modifiers.inlineEditable, isClickable && styles$1.modifiers.clickable, isRowSelected && styles$1.modifiers.selected, isStriped && styles$1.modifiers.striped, isBorderRow && styles$1.modifiers.borderRow, isControlRow && styles$1.tableControlRow, resetOffset && styles$1.modifiers.firstCellOffsetReset), hidden: rowIsHidden }, (isClickable && { tabIndex: 0 }), { "aria-label": ariaLabel, ref: innerRef }, (onRowClick && { onClick: onRowClick, onKeyDown }), ouiaProps, props), children)));
|
|
1314
|
+
return (jsx(Fragment$1, { children: jsx("tr", Object.assign({ className: css(styles$1.tableTr, className, isExpanded !== undefined && styles$1.tableExpandableRow, isExpanded && styles$1.modifiers.expanded, isEditable && inlineStyles.modifiers.inlineEditable, isClickable && styles$1.modifiers.clickable, isRowSelected && styles$1.modifiers.selected, isStriped && styles$1.modifiers.striped, isBorderRow && styles$1.modifiers.borderRow, isControlRow && styles$1.tableControlRow, resetOffset && styles$1.modifiers.firstCellOffsetReset), hidden: rowIsHidden }, (isClickable && { tabIndex: 0 }), { "aria-label": ariaLabel, ref: innerRef }, (onRowClick && { onClick: onRowClick, onKeyDown }), ouiaProps, props, { children: children })) }));
|
|
1388
1315
|
};
|
|
1389
|
-
const Tr =
|
|
1316
|
+
const Tr = forwardRef((props, ref) => (jsx(TrBase, Object.assign({}, props, { innerRef: ref }))));
|
|
1390
1317
|
Tr.displayName = 'Tr';
|
|
1391
1318
|
|
|
1392
1319
|
const TheadBase = (_a) => {
|
|
1393
1320
|
var { children, className, noWrap = false, innerRef, hasNestedHeader } = _a, props = __rest(_a, ["children", "className", "noWrap", "innerRef", "hasNestedHeader"]);
|
|
1394
|
-
return (
|
|
1321
|
+
return (jsx("thead", Object.assign({ className: css(styles$1.tableThead, className, noWrap && styles$1.modifiers.nowrap, hasNestedHeader && styles$1.modifiers.nestedColumnHeader), ref: innerRef }, props, { children: children })));
|
|
1395
1322
|
};
|
|
1396
|
-
const Thead =
|
|
1323
|
+
const Thead = forwardRef((props, ref) => (jsx(TheadBase, Object.assign({}, props, { innerRef: ref }))));
|
|
1397
1324
|
Thead.displayName = 'Thead';
|
|
1398
1325
|
|
|
1399
1326
|
const TbodyBase = (_a) => {
|
|
1400
1327
|
var { children, className, isExpanded, innerRef, isEvenStriped = false, isOddStriped = false } = _a, props = __rest(_a, ["children", "className", "isExpanded", "innerRef", "isEvenStriped", "isOddStriped"]);
|
|
1401
|
-
return (
|
|
1328
|
+
return (jsx("tbody", Object.assign({ role: "rowgroup", className: css(styles$1.tableTbody, className, isExpanded && styles$1.modifiers.expanded, isOddStriped && styles$1.modifiers.striped, isEvenStriped && styles$1.modifiers.stripedEven), ref: innerRef }, props, { children: children })));
|
|
1402
1329
|
};
|
|
1403
|
-
const Tbody =
|
|
1330
|
+
const Tbody = forwardRef((props, ref) => (jsx(TbodyBase, Object.assign({}, props, { innerRef: ref }))));
|
|
1404
1331
|
Tbody.displayName = 'Tbody';
|
|
1405
1332
|
|
|
1406
1333
|
const styles = {
|
|
@@ -1433,7 +1360,7 @@ function mergeProps(...props) {
|
|
|
1433
1360
|
if (key === 'children') {
|
|
1434
1361
|
if (a && b) {
|
|
1435
1362
|
// compose the two
|
|
1436
|
-
return
|
|
1363
|
+
return cloneElement(a, {
|
|
1437
1364
|
children: b
|
|
1438
1365
|
});
|
|
1439
1366
|
}
|
|
@@ -1466,9 +1393,9 @@ const ThBase = (_a) => {
|
|
|
1466
1393
|
// eslint-disable-next-line no-console
|
|
1467
1394
|
console.warn('Th: Table headers must have an accessible name. If the Th is intended to be visually empty, pass in screenReaderText. If the Th contains only non-text, interactive content such as a checkbox or expand toggle, pass in an aria-label.');
|
|
1468
1395
|
}
|
|
1469
|
-
const [showTooltip, setShowTooltip] =
|
|
1470
|
-
const [truncated, setTruncated] =
|
|
1471
|
-
const cellRef = innerRef ? innerRef :
|
|
1396
|
+
const [showTooltip, setShowTooltip] = useState(false);
|
|
1397
|
+
const [truncated, setTruncated] = useState(false);
|
|
1398
|
+
const cellRef = innerRef ? innerRef : createRef();
|
|
1472
1399
|
const onMouseEnter = (event) => {
|
|
1473
1400
|
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
1474
1401
|
!showTooltip && setShowTooltip(true);
|
|
@@ -1552,36 +1479,34 @@ const ThBase = (_a) => {
|
|
|
1552
1479
|
// selectable adds this but we don't want it
|
|
1553
1480
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1554
1481
|
isVisible = null, className: mergedClassName = '', component: MergedComponent = component } = merged, mergedProps = __rest(merged, ["children", "isVisible", "className", "component"]);
|
|
1555
|
-
|
|
1482
|
+
useEffect(() => {
|
|
1556
1483
|
setTruncated(cellRef.current.offsetWidth <
|
|
1557
1484
|
cellRef.current.scrollWidth);
|
|
1558
1485
|
}, [cellRef]);
|
|
1559
|
-
const cell = (
|
|
1486
|
+
const cell = (jsx(MergedComponent, Object.assign({ tabIndex: sort || select || !truncated ? -1 : 0, onFocus: tooltip !== null ? onMouseEnter : onMouseEnterProp, onBlur: () => setShowTooltip(false), "data-label": dataLabel, onMouseEnter: tooltip !== null ? onMouseEnter : onMouseEnterProp, scope: component === 'th' ? scope : null, ref: cellRef, "aria-label": ariaLabel, className: css(styles$1.tableTh, className, textCenter && styles$1.modifiers.center, isSubheader && styles$1.tableSubhead, isStickyColumn && styles.tableStickyCell, hasRightBorder && styles.modifiers.borderRight, hasLeftBorder && styles.modifiers.borderLeft, modifier && styles$1.modifiers[modifier], ((_b = sort === null || sort === void 0 ? void 0 : sort.favoriteButtonProps) === null || _b === void 0 ? void 0 : _b.favorited) && styles$1.modifiers.favorited, mergedClassName) }, mergedProps, props, (isStickyColumn && {
|
|
1560
1487
|
style: Object.assign({ [c_table__sticky_cell_MinWidth.name]: stickyMinWidth ? stickyMinWidth : undefined, [c_table__sticky_cell_InsetInlineStart.name]: stickyLeftOffset ? stickyLeftOffset : 0, [c_table__sticky_cell_InsetInlineEnd.name]: stickyRightOffset ? stickyRightOffset : 0 }, props.style)
|
|
1561
|
-
})
|
|
1562
|
-
|
|
1488
|
+
}), { children: transformedChildren ||
|
|
1489
|
+
(screenReaderText && jsx("span", { className: accessibleStyles.screenReader, children: screenReaderText })) })));
|
|
1563
1490
|
const canMakeDefaultTooltip = tooltip === '' ? typeof transformedChildren === 'string' : true;
|
|
1564
1491
|
const childControlsTooltip = sortParams || selectParams;
|
|
1565
|
-
return tooltip !== null && canMakeDefaultTooltip && !childControlsTooltip && showTooltip ? (
|
|
1566
|
-
cell,
|
|
1567
|
-
React.createElement(Tooltip, Object.assign({ triggerRef: cellRef, content: tooltip || (tooltip === '' && children), isVisible: true }, tooltipProps)))) : (cell);
|
|
1492
|
+
return tooltip !== null && canMakeDefaultTooltip && !childControlsTooltip && showTooltip ? (jsxs(Fragment$1, { children: [cell, jsx(Tooltip, Object.assign({ triggerRef: cellRef, content: tooltip || (tooltip === '' && children), isVisible: true }, tooltipProps))] })) : (cell);
|
|
1568
1493
|
};
|
|
1569
|
-
const Th =
|
|
1494
|
+
const Th = forwardRef((props, ref) => (jsx(ThBase, Object.assign({}, props, { innerRef: ref }))));
|
|
1570
1495
|
Th.displayName = 'Th';
|
|
1571
1496
|
|
|
1572
1497
|
const draggable = (value, { rowData }) => {
|
|
1573
1498
|
const { id } = rowData;
|
|
1574
1499
|
return {
|
|
1575
1500
|
className: '',
|
|
1576
|
-
children:
|
|
1501
|
+
children: jsx(DraggableCell, { id: id })
|
|
1577
1502
|
};
|
|
1578
1503
|
};
|
|
1579
1504
|
|
|
1580
1505
|
const TdBase = (_a) => {
|
|
1581
1506
|
var { children, className, isActionCell = false, component = 'td', dataLabel, textCenter = false, modifier, select = null, actions = null, expand = null, treeRow: treeRowProp = null, compoundExpand: compoundExpandProp = null, noPadding, width, visibility, innerRef, favorites = null, draggableRow: draggableRowProp = null, tooltip = '', onMouseEnter: onMouseEnterProp = () => { }, isStickyColumn = false, hasRightBorder = false, hasLeftBorder = false, stickyMinWidth = '120px', stickyLeftOffset, stickyRightOffset } = _a, props = __rest(_a, ["children", "className", "isActionCell", "component", "dataLabel", "textCenter", "modifier", "select", "actions", "expand", "treeRow", "compoundExpand", "noPadding", "width", "visibility", "innerRef", "favorites", "draggableRow", "tooltip", "onMouseEnter", "isStickyColumn", "hasRightBorder", "hasLeftBorder", "stickyMinWidth", "stickyLeftOffset", "stickyRightOffset"]);
|
|
1582
|
-
const [showTooltip, setShowTooltip] =
|
|
1583
|
-
const [truncated, setTruncated] =
|
|
1584
|
-
const cellRef = innerRef ? innerRef :
|
|
1507
|
+
const [showTooltip, setShowTooltip] = useState(false);
|
|
1508
|
+
const [truncated, setTruncated] = useState(false);
|
|
1509
|
+
const cellRef = innerRef ? innerRef : createRef();
|
|
1585
1510
|
const onMouseEnter = (event) => {
|
|
1586
1511
|
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
1587
1512
|
!showTooltip && setShowTooltip(true);
|
|
@@ -1698,19 +1623,17 @@ const TdBase = (_a) => {
|
|
|
1698
1623
|
isVisible = null, children: mergedChildren = null, className: mergedClassName = '', component: MergedComponent = component } = merged, mergedProps = __rest(merged, ["isVisible", "children", "className", "component"]);
|
|
1699
1624
|
const treeTableTitleCell = (className && className.includes(treeViewStyles.tableTreeViewTitleCell)) ||
|
|
1700
1625
|
(mergedClassName && mergedClassName.includes(treeViewStyles.tableTreeViewTitleCell));
|
|
1701
|
-
|
|
1626
|
+
useEffect(() => {
|
|
1702
1627
|
setTruncated(cellRef.current.offsetWidth <
|
|
1703
1628
|
cellRef.current.scrollWidth);
|
|
1704
1629
|
}, [cellRef]);
|
|
1705
|
-
const cell = (
|
|
1630
|
+
const cell = (jsx(MergedComponent, Object.assign({ tabIndex: (select || !truncated) && modifier !== 'truncate' ? -1 : 0 }, (!treeTableTitleCell && { 'data-label': dataLabel }), { onFocus: tooltip !== null ? onMouseEnter : onMouseEnterProp, onBlur: () => setShowTooltip(false), onMouseEnter: tooltip !== null ? onMouseEnter : onMouseEnterProp, className: css(styles$1.tableTd, className, isActionCell && styles$1.tableAction, textCenter && styles$1.modifiers.center, noPadding && styles$1.modifiers.noPadding, isStickyColumn && styles.tableStickyCell, hasRightBorder && styles.modifiers.borderRight, hasLeftBorder && styles.modifiers.borderLeft, styles$1.modifiers[modifier], draggableParams && styles$1.tableDraggable, mergedClassName), ref: cellRef }, mergedProps, props, (isStickyColumn && {
|
|
1706
1631
|
style: Object.assign({ [c_table__sticky_cell_MinWidth.name]: stickyMinWidth ? stickyMinWidth : undefined, [c_table__sticky_cell_InsetInlineStart.name]: stickyLeftOffset ? stickyLeftOffset : 0, [c_table__sticky_cell_InsetInlineEnd.name]: stickyRightOffset ? stickyRightOffset : 0 }, props.style)
|
|
1707
|
-
})
|
|
1632
|
+
}), { children: mergedChildren || children })));
|
|
1708
1633
|
const canMakeDefaultTooltip = tooltip === '' ? typeof children === 'string' : true;
|
|
1709
|
-
return tooltip !== null && canMakeDefaultTooltip && showTooltip ? (
|
|
1710
|
-
cell,
|
|
1711
|
-
React.createElement(Tooltip, { triggerRef: cellRef, content: tooltip || (tooltip === '' && children), isVisible: true }))) : (cell);
|
|
1634
|
+
return tooltip !== null && canMakeDefaultTooltip && showTooltip ? (jsxs(Fragment$1, { children: [cell, jsx(Tooltip, { triggerRef: cellRef, content: tooltip || (tooltip === '' && children), isVisible: true })] })) : (cell);
|
|
1712
1635
|
};
|
|
1713
|
-
const Td =
|
|
1636
|
+
const Td = forwardRef((props, ref) => (jsx(TdBase, Object.assign({}, props, { innerRef: ref }))));
|
|
1714
1637
|
Td.displayName = 'Td';
|
|
1715
1638
|
|
|
1716
1639
|
const textStyles = {
|
|
@@ -1742,7 +1665,7 @@ const PropsTable = ({
|
|
|
1742
1665
|
if (!isRequired) {
|
|
1743
1666
|
return null;
|
|
1744
1667
|
}
|
|
1745
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1668
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1746
1669
|
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: css(textStyles.textColorRequired), children: "*" }),
|
|
1747
1670
|
/* @__PURE__ */ jsx("span", { className: css(accessibleStyles.screenReader), children: "required" })
|
|
1748
1671
|
] });
|
|
@@ -1758,7 +1681,7 @@ const PropsTable = ({
|
|
|
1758
1681
|
children: componentDescription
|
|
1759
1682
|
}
|
|
1760
1683
|
),
|
|
1761
|
-
hasPropsToRender && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1684
|
+
hasPropsToRender && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1762
1685
|
/* @__PURE__ */ jsxs("div", { id: `${componentName}-required-description`, children: [
|
|
1763
1686
|
/* @__PURE__ */ jsx("span", { className: css(textStyles.textColorRequired), children: "*" }),
|
|
1764
1687
|
" ",
|