@redsift/table 11.6.0-muiv5-alpha.5 → 11.6.0-muiv5-alpha.7

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.
@@ -1,3 +1,2 @@
1
1
  export { T as TextCell } from './TextCell2.js';
2
- import '@redsift/design-system';
3
- import 'react';
2
+ //# sourceMappingURL=TextCell.js.map
@@ -1,30 +1,66 @@
1
- import { IconProps, NotificationsColorPalette, ProductColorPalette, ShieldVariant, Comp } from '@redsift/design-system';
2
- import { ComponentProps, ReactNode } from 'react';
1
+ import { b as _objectWithoutProperties, a as _extends } from './_rollupPluginBabelHelpers.js';
2
+ import React__default, { forwardRef, useRef } from 'react';
3
+ import classNames from 'classnames';
4
+ import { Shield, Icon } from '@redsift/design-system';
5
+ import styled from 'styled-components';
3
6
 
4
- interface TextCellProps extends ComponentProps<'div'> {
5
- /** Including Badge Component. */
6
- badge?: ReactNode;
7
- /**
8
- * Can be a string or an array of strings containing `d` property of the `path` SVG element.<br />
9
- * Can also be a ReactElement.
10
- */
11
- leftIcon?: IconProps['icon'];
12
- /** Left Icon Color variant. */
13
- leftIconColor?: NotificationsColorPalette | ProductColorPalette | (string & {});
14
- /**
15
- * Can be a string or an array of strings containing `d` property of the `path` SVG element.<br />
16
- * Can also be a ReactElement.
17
- */
18
- rightIcon?: IconProps['icon'];
19
- /** Right Icon Color variant. */
20
- rightIconColor?: NotificationsColorPalette | ProductColorPalette | (string & {});
21
- /** Shield variant. */
22
- shieldVariant?: ShieldVariant;
23
- }
7
+ const StyledTextCell = styled.div`
8
+ align-items: center;
9
+ box-sizing: border-box;
10
+ display: flex;
11
+ gap: 8px;
12
+ justify-content: flex-start;
13
+ overflow: hidden;
14
+ text-overflow: ellipsis;
15
+ white-space: nowrap;
16
+ `;
17
+ const StyledTextCellText = styled.div`
18
+ box-sizing: border-box;
19
+ line-height: normal;
20
+ overflow: hidden;
21
+ text-overflow: ellipsis;
22
+ white-space: nowrap;
23
+ `;
24
+
25
+ const _excluded = ["badge", "children", "className", "leftIcon", "leftIconColor", "rightIcon", "rightIconColor", "shieldVariant"];
26
+ const COMPONENT_NAME = 'DataGridCell';
27
+ const CLASSNAME = 'redsift-datagrid-cell';
24
28
 
25
29
  /**
26
30
  * The Cell component.
27
31
  */
28
- declare const TextCell: Comp<TextCellProps, HTMLDivElement>;
32
+ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
33
+ const textCellRef = ref || useRef();
34
+ const {
35
+ badge,
36
+ children,
37
+ className,
38
+ leftIcon,
39
+ leftIconColor,
40
+ rightIcon,
41
+ rightIconColor,
42
+ shieldVariant
43
+ } = props,
44
+ forwardedProps = _objectWithoutProperties(props, _excluded);
45
+ return /*#__PURE__*/React__default.createElement(StyledTextCell, _extends({}, forwardedProps, {
46
+ className: classNames(TextCell.className, className),
47
+ ref: textCellRef
48
+ }), /*#__PURE__*/React__default.createElement(React__default.Fragment, null, shieldVariant ? /*#__PURE__*/React__default.createElement(Shield, {
49
+ variant: shieldVariant
50
+ }) : null, leftIcon ? /*#__PURE__*/React__default.createElement(Icon, {
51
+ icon: leftIcon,
52
+ "aria-hidden": "true",
53
+ size: "small",
54
+ color: leftIconColor
55
+ }) : null, /*#__PURE__*/React__default.createElement(StyledTextCellText, null, children), badge ? badge : null, rightIcon ? /*#__PURE__*/React__default.createElement(Icon, {
56
+ icon: rightIcon,
57
+ "aria-hidden": "true",
58
+ size: "small",
59
+ color: rightIconColor
60
+ }) : null));
61
+ });
62
+ TextCell.className = CLASSNAME;
63
+ TextCell.displayName = COMPONENT_NAME;
29
64
 
30
65
  export { TextCell as T };
66
+ //# sourceMappingURL=TextCell2.js.map
@@ -1,4 +1,2 @@
1
1
  export { T as Toolbar } from './Toolbar2.js';
2
- import 'react';
3
- import '@mui/x-data-grid-pro';
4
- import './types2.js';
2
+ //# sourceMappingURL=Toolbar.js.map
@@ -1,56 +1,85 @@
1
- import React, { RefObject } from 'react';
2
- import { GridToolbarExportProps, GridToolbarFilterButtonProps, GridFilterModel, GridToolbarColumnsButton, GridToolbarDensitySelector } from '@mui/x-data-grid-pro';
3
- import { G as GridToolbarFilterSemanticFieldProps } from './types2.js';
1
+ import { a as _extends } from './_rollupPluginBabelHelpers.js';
2
+ import React__default from 'react';
3
+ import { GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, GridToolbarQuickFilter } from '@mui/x-data-grid-pro';
4
+ import styled from 'styled-components';
5
+ import { Flexbox } from '@redsift/design-system';
6
+ import { G as GridToolbarFilterSemanticField } from './GridToolbarFilterSemanticField2.js';
4
7
 
5
- type GridToolbarColumnsProps = Omit<typeof GridToolbarColumnsButton, 'ref'>;
6
- type GridToolbarDensityProps = Omit<typeof GridToolbarDensitySelector, 'ref'>;
7
- type GridToolbarFilterSemanticProps = Omit<GridToolbarFilterSemanticFieldProps, 'ref'>;
8
- interface ToolbarProps {
9
- /** Props to forward to the column button. */
10
- columnsButtonProps?: GridToolbarColumnsProps;
11
- /** Column button ref. */
12
- columnsButtonRef?: RefObject<HTMLButtonElement>;
13
- /** Props to forward to the density button. */
14
- densityButtonProps?: GridToolbarDensityProps;
15
- /** Density button ref. */
16
- densityButtonRef?: RefObject<HTMLButtonElement>;
17
- /** Props to forward to the export button. */
18
- exportButtonProps?: GridToolbarExportProps;
19
- /** Export button ref. */
20
- exportButtonRef?: RefObject<HTMLButtonElement>;
21
- /** Props to forward to the filter button. */
22
- filterButtonProps?: GridToolbarFilterButtonProps;
23
- /** Filter button ref. */
24
- filterButtonRef?: RefObject<HTMLButtonElement>;
25
- /** Whether the columns button is displayed or not. */
26
- hasColumnsButton?: boolean;
27
- /** Whether the density button is displayed or not. */
28
- hasDensityButton?: boolean;
29
- /** Whether the export button is displayed or not. */
30
- hasExportButton?: boolean;
31
- /** Whether the filter button is displayed or not. */
32
- hasFilterButton?: boolean;
33
- /** Configuration object for NLP filter. undefined if disabled. */
34
- onFilterModelChange?: (filterModel: GridFilterModel) => void;
35
- semanticFilterProps?: GridToolbarFilterSemanticProps;
36
- /** Whether you want to show the quick filter or not. */
37
- showQuickFilter?: boolean;
38
- }
8
+ /**
9
+ * Component style.
10
+ */
11
+ const GridToolbarWrapper = styled.div`
12
+ .MuiButtonBase-root-JobBs.MuiButton-root {
13
+ svg {
14
+ path {
15
+ fill: var(--redsift-color-primary-n);
16
+ }
17
+ }
18
+ }
19
+ `;
39
20
 
40
21
  /**
41
22
  * Temporary workaround for a type mismatch between react 17 and 18
42
23
  * https://github.com/mui/material-ui/issues/35287#issuecomment-1337250566
43
24
  */
44
- declare global {
45
- namespace React {
46
- interface DOMAttributes<T> {
47
- onResize?: React.ReactEventHandler<T> | undefined;
48
- onResizeCapture?: React.ReactEventHandler<T> | undefined;
49
- nonce?: string | undefined;
50
- }
51
- }
52
- }
25
+
53
26
  /** ------ */
54
- declare const Toolbar: React.FC<ToolbarProps>;
27
+
28
+ const Toolbar = props => {
29
+ const {
30
+ hasExportButton = true,
31
+ exportButtonProps,
32
+ exportButtonRef,
33
+ hasFilterButton = true,
34
+ filterButtonProps,
35
+ filterButtonRef,
36
+ hasColumnsButton = true,
37
+ columnsButtonProps,
38
+ columnsButtonRef,
39
+ hasDensityButton = true,
40
+ densityButtonProps,
41
+ densityButtonRef,
42
+ onFilterModelChange,
43
+ semanticFilterProps = undefined,
44
+ showQuickFilter
45
+ } = props;
46
+ if (semanticFilterProps && onFilterModelChange) {
47
+ semanticFilterProps.onFilterModelChange = onFilterModelChange;
48
+ }
49
+ return /*#__PURE__*/React__default.createElement(GridToolbarWrapper, null, /*#__PURE__*/React__default.createElement(GridToolbarContainer, null, /*#__PURE__*/React__default.createElement(Flexbox, {
50
+ gap: "0"
51
+ }, hasFilterButton ? /*#__PURE__*/React__default.createElement(GridToolbarFilterButton, _extends({}, filterButtonProps, {
52
+ ref: filterButtonRef,
53
+ className: filterButtonProps !== null && filterButtonProps !== void 0 && filterButtonProps.className ? `${filterButtonProps === null || filterButtonProps === void 0 ? void 0 : filterButtonProps.className} redsift-condensed` : 'redsift-condensed'
54
+ })) : null, hasColumnsButton ? /*#__PURE__*/React__default.createElement(GridToolbarColumnsButton, _extends({}, columnsButtonProps, {
55
+ ref: columnsButtonRef,
56
+ className: filterButtonProps !== null && filterButtonProps !== void 0 && filterButtonProps.className ? `${filterButtonProps === null || filterButtonProps === void 0 ? void 0 : filterButtonProps.className} redsift-condensed` : 'redsift-condensed'
57
+ })) : null, hasDensityButton ? /*#__PURE__*/React__default.createElement(GridToolbarDensitySelector, _extends({}, densityButtonProps, {
58
+ ref: densityButtonRef,
59
+ className: filterButtonProps !== null && filterButtonProps !== void 0 && filterButtonProps.className ? `${filterButtonProps === null || filterButtonProps === void 0 ? void 0 : filterButtonProps.className} redsift-condensed` : 'redsift-condensed'
60
+ })) : null, hasExportButton ? /*#__PURE__*/React__default.createElement(GridToolbarExport, _extends({
61
+ csvOptions: {
62
+ allColumns: true,
63
+ fileName: 'csv',
64
+ getRowsToExport: _ref => {
65
+ let {
66
+ apiRef
67
+ } = _ref;
68
+ return gridVisibleSortedRowIdsSelector(apiRef);
69
+ }
70
+ },
71
+ printOptions: {
72
+ disableToolbarButton: true
73
+ }
74
+ }, exportButtonProps, {
75
+ ref: exportButtonRef,
76
+ className: filterButtonProps !== null && filterButtonProps !== void 0 && filterButtonProps.className ? `${filterButtonProps === null || filterButtonProps === void 0 ? void 0 : filterButtonProps.className} redsift-condensed` : 'redsift-condensed'
77
+ })) : null, /*#__PURE__*/React__default.createElement(Flexbox, {
78
+ marginLeft: "8px"
79
+ }, showQuickFilter ? /*#__PURE__*/React__default.createElement(GridToolbarQuickFilter, null) : null)), /*#__PURE__*/React__default.createElement(Flexbox, {
80
+ flexGrow: 3
81
+ }, semanticFilterProps ? /*#__PURE__*/React__default.createElement(GridToolbarFilterSemanticField, semanticFilterProps) : null)));
82
+ };
55
83
 
56
84
  export { Toolbar as T };
85
+ //# sourceMappingURL=Toolbar2.js.map
@@ -1,6 +1,2 @@
1
- export { a as ToolbarWrapper, T as ToolbarWrapperProps } from './ToolbarWrapper2.js';
2
- import 'react';
3
- import './types.js';
4
- import '@mui/x-data-grid-pro';
5
- import '@mui/material';
6
- import '@redsift/design-system';
1
+ export { T as ToolbarWrapper } from './ToolbarWrapper2.js';
2
+ //# sourceMappingURL=ToolbarWrapper.js.map
@@ -1,25 +1,59 @@
1
- import React from 'react';
2
- import { D as DataGridProps, S as SelectionStatus } from './types.js';
1
+ import { b as _objectWithoutProperties, a as _extends } from './_rollupPluginBabelHelpers.js';
2
+ import React__default from 'react';
3
+ import { S as ServerSideControlledPagination, C as ControlledPagination } from './ControlledPagination.js';
3
4
 
4
- type ToolbarWrapperProps = {
5
- hideToolbar: DataGridProps['hideToolbar'];
6
- RenderedToolbar: React.JSXElementConstructor<any>;
7
- filterModel: DataGridProps['filterModel'];
8
- onFilterModelChange: DataGridProps['onFilterModelChange'];
9
- pagination: DataGridProps['pagination'];
10
- paginationPlacement: DataGridProps['paginationPlacement'];
11
- selectionStatus: React.MutableRefObject<SelectionStatus>;
12
- apiRef: DataGridProps['apiRef'];
13
- isRowSelectable: DataGridProps['isRowSelectable'];
14
- page: DataGridProps['page'];
15
- onPageChange: DataGridProps['onPageChange'];
16
- pageSize: DataGridProps['pageSize'];
17
- onPageSizeChange: DataGridProps['onPageSizeChange'];
18
- rowsPerPageOptions: DataGridProps['rowsPerPageOptions'];
19
- paginationProps: DataGridProps['paginationProps'];
20
- paginationMode?: DataGridProps['paginationMode'];
21
- rowCount?: DataGridProps['rowCount'];
5
+ const _excluded = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"];
6
+ const ToolbarWrapper = _ref => {
7
+ let {
8
+ hideToolbar,
9
+ RenderedToolbar,
10
+ filterModel,
11
+ onFilterModelChange,
12
+ pagination,
13
+ paginationPlacement,
14
+ selectionStatus,
15
+ apiRef,
16
+ isRowSelectable,
17
+ page,
18
+ onPageChange,
19
+ pageSize,
20
+ onPageSizeChange,
21
+ rowsPerPageOptions,
22
+ paginationProps,
23
+ paginationMode = 'client',
24
+ rowCount
25
+ } = _ref,
26
+ forwardedProps = _objectWithoutProperties(_ref, _excluded);
27
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !hideToolbar ? /*#__PURE__*/React__default.createElement(RenderedToolbar, _extends({}, forwardedProps, {
28
+ filterModel: filterModel,
29
+ onFilterModelChange: onFilterModelChange
30
+ })) : null, pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, {
31
+ displaySelection: true,
32
+ displayRowsPerPage: false,
33
+ displayPagination: ['top', 'both'].includes(paginationPlacement),
34
+ selectionStatus: selectionStatus.current,
35
+ page: page,
36
+ onPageChange: onPageChange,
37
+ pageSize: pageSize,
38
+ onPageSizeChange: onPageSizeChange,
39
+ rowsPerPageOptions: rowsPerPageOptions,
40
+ paginationProps: paginationProps,
41
+ rowCount: rowCount
42
+ }) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
43
+ displaySelection: true,
44
+ displayRowsPerPage: false,
45
+ displayPagination: ['top', 'both'].includes(paginationPlacement),
46
+ selectionStatus: selectionStatus.current,
47
+ apiRef: apiRef,
48
+ isRowSelectable: isRowSelectable,
49
+ page: page,
50
+ onPageChange: onPageChange,
51
+ pageSize: pageSize,
52
+ onPageSizeChange: onPageSizeChange,
53
+ rowsPerPageOptions: rowsPerPageOptions,
54
+ paginationProps: paginationProps
55
+ }) : null);
22
56
  };
23
- declare const ToolbarWrapper: React.FC<ToolbarWrapperProps>;
24
57
 
25
- export { ToolbarWrapperProps as T, ToolbarWrapper as a };
58
+ export { ToolbarWrapper as T };
59
+ //# sourceMappingURL=ToolbarWrapper2.js.map