@patternfly/react-data-view 6.4.0-prerelease.11 → 6.4.0-prerelease.12

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.
@@ -5,13 +5,13 @@ export interface DataViewThResizableProps {
5
5
  isResizable?: boolean;
6
6
  /** Callback after the column is resized. Returns the triggering event, the column id passed in via cell props, and the new width of the column. */
7
7
  onResize?: (event: ReactMouseEvent | MouseEvent | ReactKeyboardEvent | KeyboardEvent | TouchEvent, id: string | number | undefined, width: number) => void;
8
- /** Width of the column */
8
+ /** Starting width in pixels of the column */
9
9
  width?: number;
10
- /** Minimum width of the column */
10
+ /** Minimum resize width in pixels of the column */
11
11
  minWidth?: number;
12
- /** Increment for keyboard navigation */
12
+ /** Increment in pixels for keyboard navigation */
13
13
  increment?: number;
14
- /** Increment for keyboard navigation while shift is held */
14
+ /** Increment in pixels for keyboard navigation while shift is held */
15
15
  shiftIncrement?: number;
16
16
  /** Provides an accessible name for the resizable column via a human readable string. */
17
17
  resizeButtonAriaLabel?: string;
@@ -216,7 +216,14 @@ const DataViewTh = (_a) => {
216
216
  onResize && onResize(e, thProps === null || thProps === void 0 ? void 0 : thProps.id, newSize);
217
217
  };
218
218
  const resizableContent = ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { "aria-live": "polite", className: "pf-v6-screen-reader", children: screenReaderText }), (0, jsx_runtime_1.jsx)(react_core_1.Button, { ref: resizeButtonRef, variant: "plain", hasNoPadding: true, icon: (0, jsx_runtime_1.jsx)(ResizeIcon, {}), onMouseDown: handleMousedown, onKeyDown: handleKeys, onTouchStart: handleTouchStart, "aria-label": resizeButtonAriaLabel, className: classes.dataViewResizableButton })] }));
219
- return ((0, jsx_runtime_1.jsx)(react_table_1.Th, Object.assign({}, thProps, props, { style: width > 0 ? { minWidth: width } : undefined, ref: thRef, modifier: "truncate", className: dataViewThClassName }, (isResizable && { additionalContent: resizableContent }), { children: content })));
219
+ const classNames = [];
220
+ if (thProps === null || thProps === void 0 ? void 0 : thProps.className) {
221
+ classNames.push(thProps.className);
222
+ }
223
+ if (dataViewThClassName) {
224
+ classNames.push(dataViewThClassName);
225
+ }
226
+ return ((0, jsx_runtime_1.jsx)(react_table_1.Th, Object.assign({ modifier: "truncate" }, thProps, props, { ref: thRef, style: width > 0 ? Object.assign(Object.assign({}, thProps === null || thProps === void 0 ? void 0 : thProps.style), { minWidth: width }) : thProps === null || thProps === void 0 ? void 0 : thProps.style, className: classNames.length > 0 ? classNames.join(' ') : undefined }, (isResizable && { additionalContent: resizableContent }), { children: content })));
220
227
  };
221
228
  exports.DataViewTh = DataViewTh;
222
229
  exports.default = exports.DataViewTh;
@@ -5,13 +5,13 @@ export interface DataViewThResizableProps {
5
5
  isResizable?: boolean;
6
6
  /** Callback after the column is resized. Returns the triggering event, the column id passed in via cell props, and the new width of the column. */
7
7
  onResize?: (event: ReactMouseEvent | MouseEvent | ReactKeyboardEvent | KeyboardEvent | TouchEvent, id: string | number | undefined, width: number) => void;
8
- /** Width of the column */
8
+ /** Starting width in pixels of the column */
9
9
  width?: number;
10
- /** Minimum width of the column */
10
+ /** Minimum resize width in pixels of the column */
11
11
  minWidth?: number;
12
- /** Increment for keyboard navigation */
12
+ /** Increment in pixels for keyboard navigation */
13
13
  increment?: number;
14
- /** Increment for keyboard navigation while shift is held */
14
+ /** Increment in pixels for keyboard navigation while shift is held */
15
15
  shiftIncrement?: number;
16
16
  /** Provides an accessible name for the resizable column via a human readable string. */
17
17
  resizeButtonAriaLabel?: string;
@@ -210,6 +210,13 @@ export const DataViewTh = (_a) => {
210
210
  onResize && onResize(e, thProps === null || thProps === void 0 ? void 0 : thProps.id, newSize);
211
211
  };
212
212
  const resizableContent = (_jsxs(Fragment, { children: [_jsx("div", { "aria-live": "polite", className: "pf-v6-screen-reader", children: screenReaderText }), _jsx(Button, { ref: resizeButtonRef, variant: "plain", hasNoPadding: true, icon: _jsx(ResizeIcon, {}), onMouseDown: handleMousedown, onKeyDown: handleKeys, onTouchStart: handleTouchStart, "aria-label": resizeButtonAriaLabel, className: classes.dataViewResizableButton })] }));
213
- return (_jsx(Th, Object.assign({}, thProps, props, { style: width > 0 ? { minWidth: width } : undefined, ref: thRef, modifier: "truncate", className: dataViewThClassName }, (isResizable && { additionalContent: resizableContent }), { children: content })));
213
+ const classNames = [];
214
+ if (thProps === null || thProps === void 0 ? void 0 : thProps.className) {
215
+ classNames.push(thProps.className);
216
+ }
217
+ if (dataViewThClassName) {
218
+ classNames.push(dataViewThClassName);
219
+ }
220
+ return (_jsx(Th, Object.assign({ modifier: "truncate" }, thProps, props, { ref: thRef, style: width > 0 ? Object.assign(Object.assign({}, thProps === null || thProps === void 0 ? void 0 : thProps.style), { minWidth: width }) : thProps === null || thProps === void 0 ? void 0 : thProps.style, className: classNames.length > 0 ? classNames.join(' ') : undefined }, (isResizable && { additionalContent: resizableContent }), { children: content })));
214
221
  };
215
222
  export default DataViewTh;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-data-view",
3
- "version": "6.4.0-prerelease.11",
3
+ "version": "6.4.0-prerelease.12",
4
4
  "description": "Data view used for Red Hat projects.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -58,13 +58,13 @@ export interface DataViewThResizableProps {
58
58
  id: string | number | undefined,
59
59
  width: number
60
60
  ) => void;
61
- /** Width of the column */
61
+ /** Starting width in pixels of the column */
62
62
  width?: number;
63
- /** Minimum width of the column */
63
+ /** Minimum resize width in pixels of the column */
64
64
  minWidth?: number;
65
- /** Increment for keyboard navigation */
65
+ /** Increment in pixels for keyboard navigation */
66
66
  increment?: number;
67
- /** Increment for keyboard navigation while shift is held */
67
+ /** Increment in pixels for keyboard navigation while shift is held */
68
68
  shiftIncrement?: number;
69
69
  /** Provides an accessible name for the resizable column via a human readable string. */
70
70
  resizeButtonAriaLabel?: string;
@@ -324,14 +324,22 @@ export const DataViewTh: FC<DataViewThProps> = ({
324
324
  </Fragment>
325
325
  );
326
326
 
327
+ const classNames: string[] = [];
328
+ if (thProps?.className) {
329
+ classNames.push(thProps.className);
330
+ }
331
+ if (dataViewThClassName) {
332
+ classNames.push(dataViewThClassName);
333
+ }
334
+
327
335
  return (
328
336
  <Th
337
+ modifier="truncate"
329
338
  {...thProps}
330
339
  {...props}
331
- style={width > 0 ? { minWidth: width } : undefined}
332
340
  ref={thRef}
333
- modifier="truncate"
334
- className={dataViewThClassName}
341
+ style={width > 0 ? { ...thProps?.style, minWidth: width } : thProps?.style}
342
+ className={classNames.length > 0 ? classNames.join(' ') : undefined}
335
343
  {...(isResizable && { additionalContent: resizableContent })}
336
344
  >
337
345
  {content}