@patternfly/patternfly-doc-core 1.4.0 → 1.6.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 +40 -0
- package/.astro/content-modules.mjs +4 -1
- package/.astro/content.d.ts +20 -1
- package/.vscode/launch.json +31 -10
- package/astro.config.mjs +2 -2
- package/declarations.d.ts +2 -0
- package/dist/client/_astro/LiveExample.B7IM_dLQ.css +1 -0
- package/dist/client/_astro/LiveExample.Df-EUsee.js +40 -0
- package/dist/client/_astro/Navigation.CabjIYg4.js +1 -0
- package/dist/client/_astro/PageContext.D1pNBMhh.js +9 -0
- package/dist/client/_astro/PageSidebarBody.Y-7d6zQM.js +1 -0
- package/dist/client/_astro/PageToggle.CbfM9bJB.js +1 -0
- package/dist/client/_astro/PageToggleButton.CZ3xPbcc.js +1 -0
- package/dist/client/_astro/Toolbar.9-YSFh3P.js +1 -0
- package/dist/client/_astro/ToolbarContent.BXdFKbs9.js +1 -0
- package/dist/client/_astro/_page_.B8cBYNKa.css +1 -0
- package/dist/client/_astro/_page_.CtheD08_.css +1 -0
- package/dist/client/_astro/_tab_.DxJDkZPc.css +1 -0
- package/dist/client/_astro/_tab_.YrfmckTJ.css +1 -0
- package/dist/client/_astro/client.CTJTt880.js +1 -0
- package/dist/client/_astro/divider.DjbDHO_6.js +1 -0
- package/dist/client/_astro/index.Dhi-S4Ah.js +24 -0
- package/dist/client/_astro/index.Dkaqzkgy.js +9 -0
- package/dist/client/_astro/page.CDtWFZb5.js +1 -0
- package/dist/client/components/accordion/index.html +85 -0
- package/dist/client/design-foundations/typography/index.html +24 -22
- package/dist/client/design-foundations/usage-and-behavior/index.html +24 -22
- package/dist/client/get-started/contribute/index.html +24 -22
- package/dist/client/index.html +19 -17
- package/dist/server/_@astrojs-ssr-adapter.mjs +1 -1
- package/dist/server/chunks/{PropsTables_D_v4KAMn.mjs → PropsTables_IgCNCQTX.mjs} +147 -213
- package/dist/server/chunks/{_@astrojs-ssr-adapter_ByVMUK8O.mjs → _@astrojs-ssr-adapter_CbICuCdt.mjs} +2 -2
- package/dist/server/chunks/{_astro_assets_CLOMnm-3.mjs → _astro_assets_DaYumpRZ.mjs} +2 -2
- package/dist/server/chunks/_astro_data-layer-content_Ni7IDnLe.mjs +1 -0
- package/dist/server/chunks/{angle-down-icon_BNJvzYv-.mjs → angle-down-icon_C5YQ7k8s.mjs} +163 -213
- package/dist/server/chunks/astro/{server_D4f31GMD.mjs → server_Cl9jPh4p.mjs} +179 -89
- package/dist/server/chunks/{astro-designed-error-pages_CpHpbfhr.mjs → astro-designed-error-pages_BFveJFnQ.mjs} +1 -1
- package/dist/server/chunks/content-modules_BzUEG69n.mjs +1 -0
- package/dist/server/chunks/{sharp_BYpUyJGL.mjs → sharp_CbOL3WDk.mjs} +2 -2
- package/dist/server/entry.mjs +3 -3
- package/dist/server/{manifest_CBenwYiZ.mjs → manifest_DoNTQyvZ.mjs} +3 -3
- package/dist/server/pages/_image.astro.mjs +1 -1
- package/dist/server/renderers.mjs +63 -14
- package/package.json +5 -2
- 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/components/Masthead.astro +1 -1
- package/src/components/NavEntry.tsx +0 -2
- package/src/components/NavSection.tsx +3 -23
- package/src/components/Navigation.astro +52 -7
- package/src/components/Navigation.tsx +13 -43
- package/src/content.ts +2 -1
- package/src/pages/[section]/[page]/[...tab].astro +97 -39
- 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.75VF_8AW.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,12 +1,11 @@
|
|
|
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, T as TimesIcon, F as getUniqueId, P as Popper, K as KeyTypes, H as useIsomorphicLayoutEffect, I as Tooltip, J as BellIcon, L as InfoCircleIcon, d as ExclamationCircleIcon, E as ExclamationTriangleIcon, C as CheckCircleIcon, x as Dropdown, M as MenuToggle, y as DropdownList, D as Divider, z as DropdownItem, k as AngleDownIcon, N as checkStyles, O as StarIcon, Q as Checkbox, R as setTabIndex, u as useOUIAProps, U as handleArrows } from './angle-down-
|
|
3
|
+
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
4
|
+
import { c as css, b as createIcon, B as Button, T as TimesIcon, F as getUniqueId, P as Popper, K as KeyTypes, H as useIsomorphicLayoutEffect, I as Tooltip, J as BellIcon, L as InfoCircleIcon, d as ExclamationCircleIcon, E as ExclamationTriangleIcon, C as CheckCircleIcon, x as Dropdown, M as MenuToggle, y as DropdownList, D as Divider, z as DropdownItem, k as AngleDownIcon, N as checkStyles, O as StarIcon, Q as Checkbox, R as setTabIndex, u as useOUIAProps, U as handleArrows } from './angle-down-icon_C5YQ7k8s.mjs';
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { __rest } from 'tslib';
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
/* empty css */
|
|
7
|
+
/* empty css */
|
|
8
|
+
import { useRef, useEffect, forwardRef, useImperativeHandle, createContext, useState, createRef, Fragment, createElement, cloneElement, useContext } from 'react';
|
|
10
9
|
import mergeWith from 'lodash/mergeWith.js';
|
|
11
10
|
import { createFocusTrap } from 'focus-trap';
|
|
12
11
|
|
|
@@ -58,7 +57,7 @@ const FocusTrap = forwardRef(function FocusTrap(_a, forwardedRef) {
|
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
});
|
|
61
|
-
return
|
|
60
|
+
return jsx("div", Object.assign({ ref: ref }, props));
|
|
62
61
|
});
|
|
63
62
|
FocusTrap.displayName = 'FocusTrap';
|
|
64
63
|
|
|
@@ -71,13 +70,13 @@ const styles$5 = {
|
|
|
71
70
|
|
|
72
71
|
const ActionList = (_a) => {
|
|
73
72
|
var { children, isIconList, className } = _a, props = __rest(_a, ["children", "isIconList", "className"]);
|
|
74
|
-
return (
|
|
73
|
+
return (jsx("div", Object.assign({ className: css(styles$5.actionList, isIconList && styles$5.modifiers.icons, className) }, props, { children: children })));
|
|
75
74
|
};
|
|
76
75
|
ActionList.displayName = 'ActionList';
|
|
77
76
|
|
|
78
77
|
const ActionListItem = (_a) => {
|
|
79
78
|
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
|
|
80
|
-
return (
|
|
79
|
+
return (jsx("div", Object.assign({ className: css(`${styles$5.actionList}__item`, className) }, props, { children: children })));
|
|
81
80
|
};
|
|
82
81
|
ActionListItem.displayName = 'ActionListItem';
|
|
83
82
|
|
|
@@ -126,60 +125,54 @@ const styles$4 = {
|
|
|
126
125
|
"popoverTitleText": "pf-v6-c-popover__title-text"
|
|
127
126
|
};
|
|
128
127
|
|
|
129
|
-
const PopoverContext =
|
|
128
|
+
const PopoverContext = createContext({});
|
|
130
129
|
|
|
131
130
|
const PopoverContent = (_a) => {
|
|
132
131
|
var { className = null, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
133
|
-
return (
|
|
132
|
+
return (jsx("div", Object.assign({ className: css(styles$4.popoverContent, className) }, props, { children: children })));
|
|
134
133
|
};
|
|
135
134
|
PopoverContent.displayName = 'PopoverContent';
|
|
136
135
|
|
|
137
136
|
const PopoverBody = (_a) => {
|
|
138
137
|
var { children, id, className } = _a, props = __rest(_a, ["children", "id", "className"]);
|
|
139
|
-
return (
|
|
138
|
+
return (jsx("div", Object.assign({ className: css(styles$4.popoverBody, className), id: id }, props, { children: children })));
|
|
140
139
|
};
|
|
141
140
|
PopoverBody.displayName = 'PopoverBody';
|
|
142
141
|
|
|
143
142
|
const PopoverHeaderIcon = (_a) => {
|
|
144
143
|
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
|
|
145
|
-
return (
|
|
144
|
+
return (jsx("span", Object.assign({ className: css(styles$4.popoverTitleIcon, className) }, props, { children: children })));
|
|
146
145
|
};
|
|
147
146
|
PopoverHeaderIcon.displayName = 'PopoverHeaderIcon';
|
|
148
147
|
|
|
149
148
|
const PopoverHeaderText = (_a) => {
|
|
150
149
|
var { children, className, headingLevel } = _a, props = __rest(_a, ["children", "className", "headingLevel"]);
|
|
151
150
|
const HeadingLevel = headingLevel;
|
|
152
|
-
return (
|
|
151
|
+
return (jsx(HeadingLevel, Object.assign({ className: css(styles$4.popoverTitleText, className) }, props, { children: children })));
|
|
153
152
|
};
|
|
154
153
|
PopoverHeaderText.displayName = 'PopoverHeaderText';
|
|
155
154
|
|
|
156
155
|
const PopoverHeader = (_a) => {
|
|
157
156
|
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))));
|
|
157
|
+
return (jsx("header", Object.assign({ className: css(styles$4.popoverHeader, className) }, props, { children: jsxs("div", { className: css(styles$4.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
158
|
};
|
|
165
159
|
PopoverHeader.displayName = 'PopoverHeader';
|
|
166
160
|
|
|
167
161
|
const PopoverFooter = (_a) => {
|
|
168
162
|
var { children, className = '' } = _a, props = __rest(_a, ["children", "className"]);
|
|
169
|
-
return (
|
|
163
|
+
return (jsx("footer", Object.assign({ className: css(styles$4.popoverFooter, className) }, props, { children: children })));
|
|
170
164
|
};
|
|
171
165
|
PopoverFooter.displayName = 'PopoverFooter';
|
|
172
166
|
|
|
173
167
|
const PopoverCloseButton = (_a) => {
|
|
174
168
|
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) }))));
|
|
169
|
+
return (jsx("div", { className: css(styles$4.popoverClose), children: jsx(Button, Object.assign({ onClick: onClose, variant: "plain", "aria-label": true }, props, { style: { pointerEvents: 'auto' }, icon: jsx(TimesIcon, {}) })) }));
|
|
177
170
|
};
|
|
178
171
|
PopoverCloseButton.displayName = 'PopoverCloseButton';
|
|
179
172
|
|
|
180
173
|
const PopoverArrow = (_a) => {
|
|
181
174
|
var { className = '' } = _a, props = __rest(_a, ["className"]);
|
|
182
|
-
return
|
|
175
|
+
return jsx("div", Object.assign({ className: css(styles$4.popoverArrow, className) }, props));
|
|
183
176
|
};
|
|
184
177
|
PopoverArrow.displayName = 'PopoverArrow';
|
|
185
178
|
|
|
@@ -237,13 +230,13 @@ const Popover = (_a) => {
|
|
|
237
230
|
// const hideOnClick = true;
|
|
238
231
|
const uniqueId = id || getUniqueId();
|
|
239
232
|
const triggerManually = isVisible !== null;
|
|
240
|
-
const [visible, setVisible] =
|
|
241
|
-
const [focusTrapActive, setFocusTrapActive] =
|
|
242
|
-
const popoverRef =
|
|
243
|
-
|
|
233
|
+
const [visible, setVisible] = useState(false);
|
|
234
|
+
const [focusTrapActive, setFocusTrapActive] = useState(Boolean(propWithFocusTrap));
|
|
235
|
+
const popoverRef = useRef(null);
|
|
236
|
+
useEffect(() => {
|
|
244
237
|
onMount();
|
|
245
238
|
}, []);
|
|
246
|
-
|
|
239
|
+
useEffect(() => {
|
|
247
240
|
if (triggerManually) {
|
|
248
241
|
if (isVisible) {
|
|
249
242
|
show(undefined, true);
|
|
@@ -368,7 +361,7 @@ const Popover = (_a) => {
|
|
|
368
361
|
hide(event);
|
|
369
362
|
}
|
|
370
363
|
};
|
|
371
|
-
const content = (
|
|
364
|
+
const content = (jsxs(FocusTrap, Object.assign({ ref: popoverRef, active: focusTrapActive, focusTrapOptions: {
|
|
372
365
|
returnFocusOnDeactivate: propWithFocusTrap !== false,
|
|
373
366
|
clickOutsideDeactivates: true,
|
|
374
367
|
// FocusTrap's initialFocus can accept false as a value to prevent initial focus.
|
|
@@ -397,15 +390,8 @@ const Popover = (_a) => {
|
|
|
397
390
|
}, preventScrollOnDeactivate: true, className: css(styles$4.popover, alertSeverityVariant && alertStyle[alertSeverityVariant], hasNoPadding && styles$4.modifiers.noPadding, hasAutoWidth && styles$4.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
391
|
minWidth: hasCustomMinWidth ? minWidth : null,
|
|
399
392
|
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) })));
|
|
393
|
+
} }, 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 }))] })] })));
|
|
394
|
+
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
395
|
};
|
|
410
396
|
Popover.displayName = 'Popover';
|
|
411
397
|
|
|
@@ -461,21 +447,21 @@ const colorStyles = {
|
|
|
461
447
|
grey: ''
|
|
462
448
|
};
|
|
463
449
|
const statusIcons = {
|
|
464
|
-
success:
|
|
465
|
-
warning:
|
|
466
|
-
danger:
|
|
467
|
-
info:
|
|
468
|
-
custom:
|
|
450
|
+
success: jsx(CheckCircleIcon, {}),
|
|
451
|
+
warning: jsx(ExclamationTriangleIcon, {}),
|
|
452
|
+
danger: jsx(ExclamationCircleIcon, {}),
|
|
453
|
+
info: jsx(InfoCircleIcon, {}),
|
|
454
|
+
custom: jsx(BellIcon, {})
|
|
469
455
|
};
|
|
470
456
|
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"]);
|
|
457
|
+
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
458
|
const [isEditableActive, setIsEditableActive] = useState(false);
|
|
473
459
|
const [currValue, setCurrValue] = useState(children);
|
|
474
|
-
const editableButtonRef =
|
|
475
|
-
const editableInputRef =
|
|
460
|
+
const editableButtonRef = useRef(undefined);
|
|
461
|
+
const editableInputRef = useRef(undefined);
|
|
476
462
|
const isOverflowLabel = variant === 'overflow';
|
|
477
463
|
const isAddLabel = variant === 'add';
|
|
478
|
-
const isClickable = (onLabelClick && !isOverflowLabel && !isAddLabel) || href;
|
|
464
|
+
const isClickable = isClickableProp || (onLabelClick && !isOverflowLabel && !isAddLabel) || href;
|
|
479
465
|
let _icon;
|
|
480
466
|
if (status) {
|
|
481
467
|
_icon = statusIcons[status];
|
|
@@ -483,7 +469,7 @@ const Label = (_a) => {
|
|
|
483
469
|
if (icon) {
|
|
484
470
|
_icon = icon;
|
|
485
471
|
}
|
|
486
|
-
|
|
472
|
+
useEffect(() => {
|
|
487
473
|
document.addEventListener('mousedown', onDocMouseDown);
|
|
488
474
|
document.addEventListener('keydown', onKeyDown);
|
|
489
475
|
return () => {
|
|
@@ -491,7 +477,7 @@ const Label = (_a) => {
|
|
|
491
477
|
document.removeEventListener('keydown', onKeyDown);
|
|
492
478
|
};
|
|
493
479
|
});
|
|
494
|
-
|
|
480
|
+
useEffect(() => {
|
|
495
481
|
if (onLabelClick && href) {
|
|
496
482
|
// eslint-disable-next-line no-console
|
|
497
483
|
console.warn('Link labels cannot have onClick passed, this results in invalid HTML. Please remove either the href or onClick prop.');
|
|
@@ -558,26 +544,24 @@ const Label = (_a) => {
|
|
|
558
544
|
}
|
|
559
545
|
};
|
|
560
546
|
const isClickableDisabled = (href || onLabelClick) && isDisabled;
|
|
561
|
-
const defaultCloseButton = (
|
|
562
|
-
const closeButton =
|
|
563
|
-
const textRef =
|
|
547
|
+
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, {}) })));
|
|
548
|
+
const closeButton = jsx("span", { className: css(labelStyles.labelActions), children: closeBtn || defaultCloseButton });
|
|
549
|
+
const textRef = createRef();
|
|
564
550
|
// ref to apply tooltip when rendered is used
|
|
565
|
-
const componentRef =
|
|
566
|
-
const [isTooltipVisible, setIsTooltipVisible] =
|
|
551
|
+
const componentRef = useRef(undefined);
|
|
552
|
+
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
|
|
567
553
|
useIsomorphicLayoutEffect(() => {
|
|
568
554
|
const currTextRef = isEditable ? editableButtonRef : textRef;
|
|
569
555
|
if (!isEditableActive) {
|
|
570
556
|
setIsTooltipVisible(currTextRef.current && currTextRef.current.offsetWidth < currTextRef.current.scrollWidth);
|
|
571
557
|
}
|
|
572
558
|
}, [isEditableActive]);
|
|
573
|
-
const content = (
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
})), children)));
|
|
580
|
-
React.useEffect(() => {
|
|
559
|
+
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 && {
|
|
560
|
+
style: {
|
|
561
|
+
[c_label__text_MaxWidth.name]: textMaxWidth
|
|
562
|
+
}
|
|
563
|
+
}), { children: children }))] }));
|
|
564
|
+
useEffect(() => {
|
|
581
565
|
if (isEditableActive && editableInputRef) {
|
|
582
566
|
editableInputRef.current && editableInputRef.current.focus();
|
|
583
567
|
}
|
|
@@ -601,24 +585,19 @@ const Label = (_a) => {
|
|
|
601
585
|
setIsEditableActive(true);
|
|
602
586
|
e.stopPropagation();
|
|
603
587
|
} }, editableProps))), (isClickableDisabled && isButton && { disabled: true })), (isClickableDisabled && href && { tabIndex: -1, 'aria-disabled': true }));
|
|
604
|
-
let labelComponentChild = (
|
|
588
|
+
let labelComponentChild = (jsx(LabelComponentChildElement, Object.assign({}, labelComponentChildProps, { children: content })));
|
|
605
589
|
if (render) {
|
|
606
|
-
labelComponentChild = (
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
componentRef
|
|
612
|
-
})));
|
|
590
|
+
labelComponentChild = (jsxs(Fragment, { children: [isTooltipVisible && jsx(Tooltip, { triggerRef: componentRef, content: children, position: tooltipPosition }), render({
|
|
591
|
+
className: labelStyles.labelContent,
|
|
592
|
+
content,
|
|
593
|
+
componentRef
|
|
594
|
+
})] }));
|
|
613
595
|
}
|
|
614
596
|
else if (isTooltipVisible) {
|
|
615
|
-
labelComponentChild = (
|
|
597
|
+
labelComponentChild = (jsx(Tooltip, { content: children, position: tooltipPosition, children: labelComponentChild }));
|
|
616
598
|
}
|
|
617
599
|
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)))));
|
|
600
|
+
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$3.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
601
|
};
|
|
623
602
|
Label.displayName = 'Label';
|
|
624
603
|
|
|
@@ -631,7 +610,7 @@ const styles$2 = {
|
|
|
631
610
|
const Stack = (_a) => {
|
|
632
611
|
var { hasGutter = false, className = '', children = null, component = 'div' } = _a, props = __rest(_a, ["hasGutter", "className", "children", "component"]);
|
|
633
612
|
const Component = component;
|
|
634
|
-
return (
|
|
613
|
+
return (jsx(Component, Object.assign({}, props, { className: css(styles$2.stack, hasGutter && styles$2.modifiers.gutter, className), children: children })));
|
|
635
614
|
};
|
|
636
615
|
Stack.displayName = 'Stack';
|
|
637
616
|
|
|
@@ -651,7 +630,7 @@ const ActionsColumnBase = (_a) => {
|
|
|
651
630
|
position: 'end',
|
|
652
631
|
direction: 'down'
|
|
653
632
|
}, innerRef, firstActionItemRef, isOnOpenChangeDisabled = false } = _a, props = __rest(_a, ["items", "isDisabled", "rowData", "extraData", "actionsToggle", "popperProps", "innerRef", "firstActionItemRef", "isOnOpenChangeDisabled"]);
|
|
654
|
-
const [isOpen, setIsOpen] =
|
|
633
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
655
634
|
const onToggle = () => {
|
|
656
635
|
setIsOpen(!isOpen);
|
|
657
636
|
};
|
|
@@ -663,35 +642,32 @@ const ActionsColumnBase = (_a) => {
|
|
|
663
642
|
onClick(event, extraData && extraData.rowIndex, rowData, extraData);
|
|
664
643
|
}
|
|
665
644
|
};
|
|
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
|
-
})))));
|
|
645
|
+
return (jsxs(Fragment, { children: [items
|
|
646
|
+
.filter((item) => item.isOutsideDropdown)
|
|
647
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
648
|
+
.map((_a, key) => {
|
|
649
|
+
var { title, itemKey, onClick, isOutsideDropdown } = _a, props = __rest(_a, ["title", "itemKey", "onClick", "isOutsideDropdown"]);
|
|
650
|
+
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)));
|
|
651
|
+
}), 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
|
|
652
|
+
.filter((item) => !item.isOutsideDropdown)
|
|
653
|
+
.map((_a, index) => {
|
|
654
|
+
var { title, itemKey, onClick, tooltipProps, isSeparator, shouldCloseOnClick = true } = _a, props = __rest(_a, ["title", "itemKey", "onClick", "tooltipProps", "isSeparator", "shouldCloseOnClick"]);
|
|
655
|
+
if (isSeparator) {
|
|
656
|
+
return jsx(Divider, { "data-key": itemKey || index }, itemKey || index);
|
|
657
|
+
}
|
|
658
|
+
const item = (createElement(DropdownItem, Object.assign({ onClick: (event) => {
|
|
659
|
+
onActionClick(event, onClick);
|
|
660
|
+
shouldCloseOnClick && onToggle();
|
|
661
|
+
} }, props, { key: itemKey || index, "data-key": itemKey || index, ref: index === 0 ? firstActionItemRef : undefined }), title));
|
|
662
|
+
if (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content) {
|
|
663
|
+
return (jsx(Tooltip, Object.assign({}, tooltipProps, { children: item }), itemKey || index));
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
return item;
|
|
667
|
+
}
|
|
668
|
+
}) }) }))] }));
|
|
693
669
|
};
|
|
694
|
-
const ActionsColumn =
|
|
670
|
+
const ActionsColumn = forwardRef((props, ref) => (jsx(ActionsColumnBase, Object.assign({}, props, { innerRef: ref }))));
|
|
695
671
|
ActionsColumn.displayName = 'ActionsColumn';
|
|
696
672
|
|
|
697
673
|
const styles$1 = {
|
|
@@ -777,16 +753,13 @@ const styles$1 = {
|
|
|
777
753
|
|
|
778
754
|
const CollapseColumn = (_a) => {
|
|
779
755
|
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));
|
|
756
|
+
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
757
|
};
|
|
785
758
|
CollapseColumn.displayName = 'CollapseColumn';
|
|
786
759
|
|
|
787
760
|
const DraggableCell = (_a) => {
|
|
788
761
|
var { className, onClick, 'aria-label': ariaLabel, id } = _a, props = __rest(_a, ["className", "onClick", 'aria-label', "id"]);
|
|
789
|
-
return (
|
|
762
|
+
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
763
|
};
|
|
791
764
|
DraggableCell.displayName = 'DraggableCell';
|
|
792
765
|
|
|
@@ -822,8 +795,8 @@ var WrapModifier;
|
|
|
822
795
|
const TableText = (_a) => {
|
|
823
796
|
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
797
|
const Component = variant;
|
|
825
|
-
const textRef =
|
|
826
|
-
const [tooltip, setTooltip] =
|
|
798
|
+
const textRef = createRef();
|
|
799
|
+
const [tooltip, setTooltip] = useState(tooltipProp);
|
|
827
800
|
const onMouseEnter = (event) => {
|
|
828
801
|
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
829
802
|
setTooltip(tooltipProp || event.target.innerText);
|
|
@@ -841,8 +814,8 @@ const TableText = (_a) => {
|
|
|
841
814
|
setTooltip('');
|
|
842
815
|
}
|
|
843
816
|
};
|
|
844
|
-
const text = (
|
|
845
|
-
|
|
817
|
+
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 })));
|
|
818
|
+
useEffect(() => {
|
|
846
819
|
if (!tooltipHasDefaultBehavior) {
|
|
847
820
|
if (focused) {
|
|
848
821
|
onFocus(textRef.current);
|
|
@@ -852,15 +825,11 @@ const TableText = (_a) => {
|
|
|
852
825
|
}
|
|
853
826
|
}
|
|
854
827
|
}, [focused, tooltipHasDefaultBehavior]);
|
|
855
|
-
return tooltip !== '' ? (
|
|
828
|
+
return tooltip !== '' ? (jsx(Tooltip, Object.assign({ triggerRef: textRef, content: tooltip }, (!tooltipHasDefaultBehavior && { isVisible: true }), tooltipProps, { children: text }))) : (text);
|
|
856
829
|
};
|
|
857
830
|
TableText.displayName = 'TableText';
|
|
858
831
|
|
|
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) }))))));
|
|
832
|
+
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
833
|
HeaderCellInfoWrapper.displayName = 'HeaderCellInfoWrapper';
|
|
865
834
|
|
|
866
835
|
const stylesGrid = {
|
|
@@ -912,12 +881,9 @@ const SelectColumn = (_a) => {
|
|
|
912
881
|
var { children = null,
|
|
913
882
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
914
883
|
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);
|
|
884
|
+
const inputRef = createRef();
|
|
885
|
+
const content = (jsxs(Fragment, { children: [jsx("label", { children: jsx("input", Object.assign({}, props, { ref: inputRef, type: selectVariant, onChange: onSelect })) }), children] }));
|
|
886
|
+
return tooltip ? (jsx(Tooltip, Object.assign({ triggerRef: inputRef, content: tooltip }, tooltipProps, { children: content }))) : (content);
|
|
921
887
|
};
|
|
922
888
|
SelectColumn.displayName = 'SelectColumn';
|
|
923
889
|
|
|
@@ -968,7 +934,7 @@ const selectable = (label, { rowIndex, columnIndex, rowData, column, property, t
|
|
|
968
934
|
className: css(styles$1.tableCheck),
|
|
969
935
|
component: rowId !== -1 ? 'td' : 'th',
|
|
970
936
|
isVisible: !rowData || !rowData.fullWidth,
|
|
971
|
-
children: (
|
|
937
|
+
children: (jsx(SelectColumn, Object.assign({}, customProps, { selectVariant: selectVariant, onSelect: selectClick, name: selectName, tooltip: tooltip, children: label })))
|
|
972
938
|
};
|
|
973
939
|
};
|
|
974
940
|
|
|
@@ -1013,7 +979,7 @@ var SortByDirection;
|
|
|
1013
979
|
const SortColumn = (_a) => {
|
|
1014
980
|
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
981
|
let SortedByIcon;
|
|
1016
|
-
const [focused, setFocused] =
|
|
982
|
+
const [focused, setFocused] = useState(false);
|
|
1017
983
|
if (isSortedBy) {
|
|
1018
984
|
SortedByIcon = sortDirection === SortByDirection.asc ? LongArrowAltUpIcon : LongArrowAltDownIcon;
|
|
1019
985
|
}
|
|
@@ -1021,24 +987,15 @@ const SortColumn = (_a) => {
|
|
|
1021
987
|
SortedByIcon = ArrowsAltVIcon;
|
|
1022
988
|
}
|
|
1023
989
|
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)))));
|
|
990
|
+
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
991
|
}
|
|
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)))));
|
|
992
|
+
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
993
|
};
|
|
1037
994
|
SortColumn.displayName = 'SortColumn';
|
|
1038
995
|
|
|
1039
996
|
const sortableFavorites = (sort) => () => {
|
|
1040
997
|
var _a;
|
|
1041
|
-
return sortable(
|
|
998
|
+
return sortable(jsx(StarIcon, {}), {
|
|
1042
999
|
columnIndex: sort.columnIndex,
|
|
1043
1000
|
className: styles$1.tableFavorite,
|
|
1044
1001
|
ariaLabel: (_a = sort.ariaLabel) !== null && _a !== void 0 ? _a : 'Sort favorites',
|
|
@@ -1076,7 +1033,7 @@ const sortable = (label, { columnIndex, column, property, className, ariaLabel,
|
|
|
1076
1033
|
// tslint:disable-next-line:no-unused-expression
|
|
1077
1034
|
onSort && onSort(event, columnIndex, reversedDirection, extraData);
|
|
1078
1035
|
}
|
|
1079
|
-
return Object.assign(Object.assign({ className: css(styles$1.tableSort, isSortedBy && styles$1.modifiers.selected, className) }, (isSortedBy && { 'aria-sort': `${sortBy.direction}ending` })), { children: (
|
|
1036
|
+
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
1037
|
};
|
|
1081
1038
|
|
|
1082
1039
|
const resolveOrDefault = (resolver, defaultValue, rowData, extraData) => (defaultValue);
|
|
@@ -1091,7 +1048,7 @@ const cellActions = (actions, actionResolver, areActionsDisabled) => (label, { r
|
|
|
1091
1048
|
const resolvedIsDisabled = resolveOrDefault(areActionsDisabled, rowData && rowData.disableActions);
|
|
1092
1049
|
const renderProps = resolvedActions && resolvedActions.length > 0
|
|
1093
1050
|
? {
|
|
1094
|
-
children: (
|
|
1051
|
+
children: (jsx(ActionsColumn, { items: resolvedActions, isDisabled: resolvedIsDisabled, rowData: rowData, extraData: extraData, actionsToggle: actionsToggle, popperProps: actionsPopperProps, children: label }))
|
|
1095
1052
|
}
|
|
1096
1053
|
: {};
|
|
1097
1054
|
return Object.assign({ className: css(styles$1.tableAction), style: { paddingRight: 0 }, isVisible: true }, renderProps);
|
|
@@ -1139,7 +1096,7 @@ const collapsible = (value, { rowIndex, columnIndex, rowData, column, property }
|
|
|
1139
1096
|
return {
|
|
1140
1097
|
className: ((rowData === null || rowData === void 0 ? void 0 : rowData.isOpen) !== undefined || rowId === -1) && css(styles$1.tableToggle),
|
|
1141
1098
|
isVisible: !(rowData === null || rowData === void 0 ? void 0 : rowData.fullWidth),
|
|
1142
|
-
children: (
|
|
1099
|
+
children: (jsx(CollapseColumn, Object.assign({ "aria-labelledby": `${rowLabeledBy}${rowId} ${expandId}${rowId}`, onToggle: onToggle, id: expandId + rowId }, customProps, { children: value })))
|
|
1143
1100
|
};
|
|
1144
1101
|
};
|
|
1145
1102
|
|
|
@@ -1164,8 +1121,7 @@ const compoundExpand = (value, { rowIndex, columnIndex, rowData, column, propert
|
|
|
1164
1121
|
}
|
|
1165
1122
|
return {
|
|
1166
1123
|
className: css(styles$1.tableCompoundExpansionToggle, props.isOpen && styles$1.modifiers.expanded),
|
|
1167
|
-
children: props.isOpen !== undefined && (
|
|
1168
|
-
React.createElement(TableText, null, title)))
|
|
1124
|
+
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
1125
|
};
|
|
1170
1126
|
};
|
|
1171
1127
|
|
|
@@ -1196,7 +1152,7 @@ const classNames = (...classes) => () => ({
|
|
|
1196
1152
|
const info = ({ tooltip, tooltipProps, popover, popoverProps, className, ariaLabel }) => {
|
|
1197
1153
|
const infoObj = (value) => ({
|
|
1198
1154
|
className: styles$1.modifiers.help,
|
|
1199
|
-
children: tooltip ? (
|
|
1155
|
+
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
1156
|
});
|
|
1201
1157
|
return infoObj;
|
|
1202
1158
|
};
|
|
@@ -1209,7 +1165,7 @@ const FavoritesCell = (_a) => {
|
|
|
1209
1165
|
id: `favorites-button-${rowIndex}`,
|
|
1210
1166
|
'aria-labelledby': `favorites-button-${rowIndex}`
|
|
1211
1167
|
};
|
|
1212
|
-
return (
|
|
1168
|
+
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
1169
|
};
|
|
1214
1170
|
FavoritesCell.displayName = 'FavoritesCell';
|
|
1215
1171
|
|
|
@@ -1239,7 +1195,7 @@ const favoritable = (value, { rowIndex, columnIndex, rowData, column, property }
|
|
|
1239
1195
|
return {
|
|
1240
1196
|
className: css(styles$1.tableFavorite, rowData && rowData.favorited && styles$1.modifiers.favorited),
|
|
1241
1197
|
isVisible: !rowData || !rowData.fullWidth,
|
|
1242
|
-
children: (
|
|
1198
|
+
children: (jsx(FavoritesCell, Object.assign({ rowIndex: rowIndex, onFavorite: favoritesClick, isFavorited: rowData && rowData.favorited }, additionalProps)))
|
|
1243
1199
|
};
|
|
1244
1200
|
};
|
|
1245
1201
|
|
|
@@ -1257,26 +1213,14 @@ const EllipsisHIcon = createIcon(EllipsisHIconConfig);
|
|
|
1257
1213
|
const treeRow = (onCollapse, onCheckChange, onToggleRowDetails) => (value, { rowIndex, rowData }) => {
|
|
1258
1214
|
const { isExpanded, isDetailsExpanded, 'aria-level': level, 'aria-setsize': setsize, toggleAriaLabel, checkAriaLabel, showDetailsAriaLabel, isChecked, checkboxId, icon } = rowData.props;
|
|
1259
1215
|
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)));
|
|
1216
|
+
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
1217
|
const onChange = (isChecked, event) => {
|
|
1264
1218
|
onCheckChange(event, isChecked, rowIndex, content, rowData);
|
|
1265
1219
|
};
|
|
1266
1220
|
return {
|
|
1267
1221
|
component: 'th',
|
|
1268
1222
|
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)
|
|
1223
|
+
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
1224
|
};
|
|
1281
1225
|
};
|
|
1282
1226
|
|
|
@@ -1294,7 +1238,7 @@ var TableVariant;
|
|
|
1294
1238
|
TableVariant["compact"] = "compact";
|
|
1295
1239
|
})(TableVariant || (TableVariant = {}));
|
|
1296
1240
|
|
|
1297
|
-
const TableContext =
|
|
1241
|
+
const TableContext = createContext({
|
|
1298
1242
|
registerSelectableRow: () => { }
|
|
1299
1243
|
});
|
|
1300
1244
|
const TableBase = (_a) => {
|
|
@@ -1302,11 +1246,11 @@ const TableBase = (_a) => {
|
|
|
1302
1246
|
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
1247
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1304
1248
|
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 =
|
|
1249
|
+
const ref = useRef(null);
|
|
1306
1250
|
const tableRef = innerRef || ref;
|
|
1307
|
-
const [hasSelectableRows, setHasSelectableRows] =
|
|
1308
|
-
const [tableCaption, setTableCaption] =
|
|
1309
|
-
|
|
1251
|
+
const [hasSelectableRows, setHasSelectableRows] = useState(false);
|
|
1252
|
+
const [tableCaption, setTableCaption] = useState();
|
|
1253
|
+
useEffect(() => {
|
|
1310
1254
|
document.addEventListener('keydown', handleKeys);
|
|
1311
1255
|
// sets up roving tab-index to tree tables only
|
|
1312
1256
|
if (tableRef && tableRef.current && tableRef.current.classList.contains('pf-m-tree-view')) {
|
|
@@ -1317,14 +1261,12 @@ const TableBase = (_a) => {
|
|
|
1317
1261
|
document.removeEventListener('keydown', handleKeys);
|
|
1318
1262
|
};
|
|
1319
1263
|
}, [tableRef, tableRef.current]);
|
|
1320
|
-
|
|
1264
|
+
useEffect(() => {
|
|
1321
1265
|
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.")));
|
|
1266
|
+
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
1267
|
}
|
|
1326
1268
|
else {
|
|
1327
|
-
setTableCaption(
|
|
1269
|
+
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
1270
|
}
|
|
1329
1271
|
}, [selectableRowCaptionText]);
|
|
1330
1272
|
const ouiaProps = useOUIAProps('Table', ouiaId, ouiaSafe);
|
|
@@ -1350,18 +1292,15 @@ const TableBase = (_a) => {
|
|
|
1350
1292
|
const registerSelectableRow = () => {
|
|
1351
1293
|
!hasSelectableRows && setHasSelectableRows(true);
|
|
1352
1294
|
};
|
|
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)));
|
|
1295
|
+
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
1296
|
};
|
|
1358
|
-
const Table =
|
|
1297
|
+
const Table = forwardRef((props, ref) => (jsx(TableBase, Object.assign({}, props, { innerRef: ref }))));
|
|
1359
1298
|
Table.displayName = 'Table';
|
|
1360
1299
|
|
|
1361
1300
|
const TrBase = (_a) => {
|
|
1362
1301
|
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
1302
|
const ouiaProps = useOUIAProps('TableRow', ouiaId, ouiaSafe);
|
|
1364
|
-
const [computedAriaLabel, setComputedAriaLabel] =
|
|
1303
|
+
const [computedAriaLabel, setComputedAriaLabel] = useState('');
|
|
1365
1304
|
let onKeyDown = null;
|
|
1366
1305
|
if (onRowClick) {
|
|
1367
1306
|
onKeyDown = (e) => {
|
|
@@ -1372,8 +1311,8 @@ const TrBase = (_a) => {
|
|
|
1372
1311
|
};
|
|
1373
1312
|
}
|
|
1374
1313
|
const rowIsHidden = isHidden || (isExpanded !== undefined && !isExpanded);
|
|
1375
|
-
const { registerSelectableRow } =
|
|
1376
|
-
|
|
1314
|
+
const { registerSelectableRow } = useContext(TableContext);
|
|
1315
|
+
useEffect(() => {
|
|
1377
1316
|
if (isSelectable && !rowIsHidden) {
|
|
1378
1317
|
setComputedAriaLabel(`${isRowSelected ? 'Row selected' : ''}`);
|
|
1379
1318
|
registerSelectableRow();
|
|
@@ -1383,24 +1322,23 @@ const TrBase = (_a) => {
|
|
|
1383
1322
|
}
|
|
1384
1323
|
}, [isRowSelected, isSelectable, registerSelectableRow, rowIsHidden]);
|
|
1385
1324
|
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)));
|
|
1325
|
+
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
1326
|
};
|
|
1389
|
-
const Tr =
|
|
1327
|
+
const Tr = forwardRef((props, ref) => (jsx(TrBase, Object.assign({}, props, { innerRef: ref }))));
|
|
1390
1328
|
Tr.displayName = 'Tr';
|
|
1391
1329
|
|
|
1392
1330
|
const TheadBase = (_a) => {
|
|
1393
1331
|
var { children, className, noWrap = false, innerRef, hasNestedHeader } = _a, props = __rest(_a, ["children", "className", "noWrap", "innerRef", "hasNestedHeader"]);
|
|
1394
|
-
return (
|
|
1332
|
+
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
1333
|
};
|
|
1396
|
-
const Thead =
|
|
1334
|
+
const Thead = forwardRef((props, ref) => (jsx(TheadBase, Object.assign({}, props, { innerRef: ref }))));
|
|
1397
1335
|
Thead.displayName = 'Thead';
|
|
1398
1336
|
|
|
1399
1337
|
const TbodyBase = (_a) => {
|
|
1400
1338
|
var { children, className, isExpanded, innerRef, isEvenStriped = false, isOddStriped = false } = _a, props = __rest(_a, ["children", "className", "isExpanded", "innerRef", "isEvenStriped", "isOddStriped"]);
|
|
1401
|
-
return (
|
|
1339
|
+
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
1340
|
};
|
|
1403
|
-
const Tbody =
|
|
1341
|
+
const Tbody = forwardRef((props, ref) => (jsx(TbodyBase, Object.assign({}, props, { innerRef: ref }))));
|
|
1404
1342
|
Tbody.displayName = 'Tbody';
|
|
1405
1343
|
|
|
1406
1344
|
const styles = {
|
|
@@ -1433,7 +1371,7 @@ function mergeProps(...props) {
|
|
|
1433
1371
|
if (key === 'children') {
|
|
1434
1372
|
if (a && b) {
|
|
1435
1373
|
// compose the two
|
|
1436
|
-
return
|
|
1374
|
+
return cloneElement(a, {
|
|
1437
1375
|
children: b
|
|
1438
1376
|
});
|
|
1439
1377
|
}
|
|
@@ -1466,9 +1404,9 @@ const ThBase = (_a) => {
|
|
|
1466
1404
|
// eslint-disable-next-line no-console
|
|
1467
1405
|
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
1406
|
}
|
|
1469
|
-
const [showTooltip, setShowTooltip] =
|
|
1470
|
-
const [truncated, setTruncated] =
|
|
1471
|
-
const cellRef = innerRef ? innerRef :
|
|
1407
|
+
const [showTooltip, setShowTooltip] = useState(false);
|
|
1408
|
+
const [truncated, setTruncated] = useState(false);
|
|
1409
|
+
const cellRef = innerRef ? innerRef : createRef();
|
|
1472
1410
|
const onMouseEnter = (event) => {
|
|
1473
1411
|
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
1474
1412
|
!showTooltip && setShowTooltip(true);
|
|
@@ -1552,36 +1490,34 @@ const ThBase = (_a) => {
|
|
|
1552
1490
|
// selectable adds this but we don't want it
|
|
1553
1491
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1554
1492
|
isVisible = null, className: mergedClassName = '', component: MergedComponent = component } = merged, mergedProps = __rest(merged, ["children", "isVisible", "className", "component"]);
|
|
1555
|
-
|
|
1493
|
+
useEffect(() => {
|
|
1556
1494
|
setTruncated(cellRef.current.offsetWidth <
|
|
1557
1495
|
cellRef.current.scrollWidth);
|
|
1558
1496
|
}, [cellRef]);
|
|
1559
|
-
const cell = (
|
|
1497
|
+
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
1498
|
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
|
-
|
|
1499
|
+
}), { children: transformedChildren ||
|
|
1500
|
+
(screenReaderText && jsx("span", { className: accessibleStyles.screenReader, children: screenReaderText })) })));
|
|
1563
1501
|
const canMakeDefaultTooltip = tooltip === '' ? typeof transformedChildren === 'string' : true;
|
|
1564
1502
|
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);
|
|
1503
|
+
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
1504
|
};
|
|
1569
|
-
const Th =
|
|
1505
|
+
const Th = forwardRef((props, ref) => (jsx(ThBase, Object.assign({}, props, { innerRef: ref }))));
|
|
1570
1506
|
Th.displayName = 'Th';
|
|
1571
1507
|
|
|
1572
1508
|
const draggable = (value, { rowData }) => {
|
|
1573
1509
|
const { id } = rowData;
|
|
1574
1510
|
return {
|
|
1575
1511
|
className: '',
|
|
1576
|
-
children:
|
|
1512
|
+
children: jsx(DraggableCell, { id: id })
|
|
1577
1513
|
};
|
|
1578
1514
|
};
|
|
1579
1515
|
|
|
1580
1516
|
const TdBase = (_a) => {
|
|
1581
1517
|
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 :
|
|
1518
|
+
const [showTooltip, setShowTooltip] = useState(false);
|
|
1519
|
+
const [truncated, setTruncated] = useState(false);
|
|
1520
|
+
const cellRef = innerRef ? innerRef : createRef();
|
|
1585
1521
|
const onMouseEnter = (event) => {
|
|
1586
1522
|
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
1587
1523
|
!showTooltip && setShowTooltip(true);
|
|
@@ -1698,19 +1634,17 @@ const TdBase = (_a) => {
|
|
|
1698
1634
|
isVisible = null, children: mergedChildren = null, className: mergedClassName = '', component: MergedComponent = component } = merged, mergedProps = __rest(merged, ["isVisible", "children", "className", "component"]);
|
|
1699
1635
|
const treeTableTitleCell = (className && className.includes(treeViewStyles.tableTreeViewTitleCell)) ||
|
|
1700
1636
|
(mergedClassName && mergedClassName.includes(treeViewStyles.tableTreeViewTitleCell));
|
|
1701
|
-
|
|
1637
|
+
useEffect(() => {
|
|
1702
1638
|
setTruncated(cellRef.current.offsetWidth <
|
|
1703
1639
|
cellRef.current.scrollWidth);
|
|
1704
1640
|
}, [cellRef]);
|
|
1705
|
-
const cell = (
|
|
1641
|
+
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
1642
|
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
|
-
})
|
|
1643
|
+
}), { children: mergedChildren || children })));
|
|
1708
1644
|
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);
|
|
1645
|
+
return tooltip !== null && canMakeDefaultTooltip && showTooltip ? (jsxs(Fragment$1, { children: [cell, jsx(Tooltip, { triggerRef: cellRef, content: tooltip || (tooltip === '' && children), isVisible: true })] })) : (cell);
|
|
1712
1646
|
};
|
|
1713
|
-
const Td =
|
|
1647
|
+
const Td = forwardRef((props, ref) => (jsx(TdBase, Object.assign({}, props, { innerRef: ref }))));
|
|
1714
1648
|
Td.displayName = 'Td';
|
|
1715
1649
|
|
|
1716
1650
|
const textStyles = {
|
|
@@ -1742,7 +1676,7 @@ const PropsTable = ({
|
|
|
1742
1676
|
if (!isRequired) {
|
|
1743
1677
|
return null;
|
|
1744
1678
|
}
|
|
1745
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1679
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1746
1680
|
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: css(textStyles.textColorRequired), children: "*" }),
|
|
1747
1681
|
/* @__PURE__ */ jsx("span", { className: css(accessibleStyles.screenReader), children: "required" })
|
|
1748
1682
|
] });
|
|
@@ -1758,7 +1692,7 @@ const PropsTable = ({
|
|
|
1758
1692
|
children: componentDescription
|
|
1759
1693
|
}
|
|
1760
1694
|
),
|
|
1761
|
-
hasPropsToRender && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1695
|
+
hasPropsToRender && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1762
1696
|
/* @__PURE__ */ jsxs("div", { id: `${componentName}-required-description`, children: [
|
|
1763
1697
|
/* @__PURE__ */ jsx("span", { className: css(textStyles.textColorRequired), children: "*" }),
|
|
1764
1698
|
" ",
|