flipper-ui 0.37.3 → 0.37.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import type { ReactNode } from 'react';
2
3
  export interface IActionsProps {
3
4
  padding?: number | string;
4
5
  margin?: number | string;
@@ -11,8 +12,8 @@ export interface IActionsProps {
11
12
  confirm: string;
12
13
  };
13
14
  labels?: {
14
- cancel: string;
15
- confirm: string;
15
+ cancel: ReactNode;
16
+ confirm: ReactNode;
16
17
  };
17
18
  readonly?: boolean;
18
19
  disabled?: boolean;
@@ -3,10 +3,11 @@ import type { DefaultProps } from '../../types';
3
3
  import type { TableCellProps } from '@mui/material/TableCell';
4
4
  export interface ITableCellProps extends DefaultProps, Omit<TableCellProps, 'padding'> {
5
5
  numeric?: boolean;
6
+ sortable?: boolean;
7
+ padding?: number | string;
6
8
  variant?: 'head' | 'body' | 'footer';
7
9
  spacing?: 'normal' | 'checkbox' | 'none';
8
- padding?: number | string;
9
10
  align?: 'inherit' | 'left' | 'center' | 'right' | 'justify';
10
11
  }
11
- declare const TableCell: ({ style, margin, padding, children, spacing, ...otherProps }: ITableCellProps) => React.JSX.Element;
12
+ declare const TableCell: ({ style, margin, padding, children, spacing, sortable, ...otherProps }: ITableCellProps) => React.JSX.Element;
12
13
  export default TableCell;
@@ -13,7 +13,7 @@ var _react = _interopRequireWildcard(require("react"));
13
13
  var _TableCell = _interopRequireDefault(require("@mui/material/TableCell"));
14
14
  var _TableSortLabel = _interopRequireDefault(require("@mui/material/TableSortLabel"));
15
15
  var _tableHead = require("./table-head");
16
- var _excluded = ["style", "margin", "padding", "children", "spacing"];
16
+ var _excluded = ["style", "margin", "padding", "children", "spacing", "sortable"];
17
17
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
18
18
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
19
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -23,6 +23,7 @@ var TableCell = function TableCell(_ref) {
23
23
  padding = _ref.padding,
24
24
  children = _ref.children,
25
25
  spacing = _ref.spacing,
26
+ sortable = _ref.sortable,
26
27
  otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
27
28
  var _useContext = (0, _react.useContext)(_tableHead.SortContext),
28
29
  onSort = _useContext.onSort,
@@ -32,14 +33,14 @@ var TableCell = function TableCell(_ref) {
32
33
  onSort === null || onSort === void 0 || onSort(otherProps.name || '');
33
34
  };
34
35
  return /*#__PURE__*/_react["default"].createElement(_TableCell["default"], (0, _extends2["default"])({}, otherProps, {
36
+ padding: spacing,
35
37
  style: _objectSpread({
36
38
  padding: padding,
37
39
  margin: margin
38
- }, style),
39
- padding: spacing
40
- }), onSort ? /*#__PURE__*/_react["default"].createElement(_TableSortLabel["default"], {
41
- active: otherProps.name === active,
40
+ }, style)
41
+ }), (sortable !== null && sortable !== void 0 ? sortable : onSort) ? /*#__PURE__*/_react["default"].createElement(_TableSortLabel["default"], {
42
42
  direction: direction,
43
+ active: otherProps.name === active,
43
44
  onClick: handleSort
44
45
  }, children) : children);
45
46
  };
@@ -10,12 +10,14 @@ export interface ITableInteractive extends Omit<TableProps, 'children'> {
10
10
  page?: number;
11
11
  open?: boolean;
12
12
  total?: number;
13
+ fixed?: boolean;
13
14
  active?: string;
14
15
  headers: {
15
16
  name: string;
16
17
  label: string;
17
18
  show: boolean;
18
19
  width?: string;
20
+ sortable?: boolean;
19
21
  }[];
20
22
  className?: string;
21
23
  paginated?: boolean;
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.TableInteractive = exports.Direction = void 0;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
9
  var _react = _interopRequireDefault(require("react"));
11
10
  var _Box = _interopRequireDefault(require("@mui/material/Box"));
@@ -52,7 +51,7 @@ var TableInteractive = exports.TableInteractive = function TableInteractive(prop
52
51
  display: 'table',
53
52
  tableLayout: 'fixed'
54
53
  }
55
- }, /*#__PURE__*/_react["default"].createElement(_table["default"], (0, _extends2["default"])({}, props, {
54
+ }, /*#__PURE__*/_react["default"].createElement(_table["default"], {
56
55
  name: props.name,
57
56
  id: 'list-' + props.name,
58
57
  className: props.className,
@@ -60,7 +59,8 @@ var TableInteractive = exports.TableInteractive = function TableInteractive(prop
60
59
  border: props.isInteractive ? 'none !important' : "1px solid ".concat(gray[300])
61
60
  },
62
61
  sx: _objectSpread({}, props.sx)
63
- }), /*#__PURE__*/_react["default"].createElement(_TableInteractiveHead.TableInteractiveHead, {
62
+ }, /*#__PURE__*/_react["default"].createElement(_TableInteractiveHead.TableInteractiveHead, {
63
+ fixed: props.fixed,
64
64
  active: props.active,
65
65
  headers: props.headers,
66
66
  children: props.children,
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { type ITableInteractive } from './TableInteractive';
3
- export type ITableInteractiveHead = Pick<ITableInteractive, 'headers' | 'visibleColumns' | 'onSort' | 'active' | 'direction' | 'children' | 'isCollapsible'>;
3
+ export type ITableInteractiveHead = Pick<ITableInteractive, 'fixed' | 'headers' | 'visibleColumns' | 'onSort' | 'active' | 'direction' | 'children' | 'isCollapsible'>;
4
4
  export declare const TableInteractiveHead: (props: ITableInteractiveHead) => React.JSX.Element;
@@ -21,6 +21,11 @@ var TableInteractiveHead = exports.TableInteractiveHead = function TableInteract
21
21
  direction: props.direction,
22
22
  onSort: props.onSort && handleSort
23
23
  }, /*#__PURE__*/_react["default"].createElement(_tableRow["default"], null, props.headers.map(function (header) {
24
- return (0, _utils.generateHeader)(header, visibleColumns);
25
- }), (props.children || props.isCollapsible) && /*#__PURE__*/_react["default"].createElement(_tableCell["default"], null)));
24
+ return (0, _utils.generateHeader)(header, visibleColumns, header.sortable, props.fixed);
25
+ }), (props.children || props.isCollapsible) && /*#__PURE__*/_react["default"].createElement(_tableCell["default"], {
26
+ sortable: false,
27
+ sx: {
28
+ width: '50px'
29
+ }
30
+ })));
26
31
  };
@@ -14,4 +14,5 @@ export declare const TableCellInteractive: import("@emotion/styled").StyledCompo
14
14
  theme?: import("@emotion/react").Theme;
15
15
  } & {
16
16
  width?: string;
17
+ fixed?: boolean;
17
18
  }, {}, {}>;
@@ -14,4 +14,8 @@ var gray = _theme.theme.colors.gray;
14
14
  var ContentWrapper = exports.ContentWrapper = _styled["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-bottom: 2px solid ", ";\n"])), gray[300]);
15
15
  var TableHeaderContent = exports.TableHeaderContent = _styled["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n margin: 0 0 8px 0;\n\n & > div {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n }\n"])));
16
16
  var ActionsWrapper = exports.ActionsWrapper = _styled["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n"])));
17
- var TableCellInteractive = exports.TableCellInteractive = (0, _styled["default"])(_tableCell["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n && {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n @media (max-width: 1440px) {\n padding: 16px 8px;\n }\n }\n"])));
17
+ var TableCellInteractive = exports.TableCellInteractive = (0, _styled["default"])(_tableCell["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n && {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 60px;\n max-width: ", ";\n\n @media (max-width: 1440px) {\n padding: 16px 8px;\n }\n }\n"])), function (props) {
18
+ return props.fixed ? function (props) {
19
+ return props.width;
20
+ } : 'none';
21
+ });
@@ -7,7 +7,7 @@ export declare const getInitialColumns: (columns: {
7
7
  show: boolean;
8
8
  }[], key: string) => string[];
9
9
  export declare const setVisibleColumns: (columns: string[], key: string) => void;
10
- export declare const generateHeader: (header: ITableInteractive["headers"][number], visibleColumns?: string[] | undefined) => React.JSX.Element | null;
10
+ export declare const generateHeader: (header: ITableInteractive["headers"][number], visibleColumns?: string[] | undefined, sortable?: boolean, fixed?: boolean) => React.JSX.Element | null;
11
11
  export declare const getVisibleColumns: (headers: {
12
12
  name: string;
13
13
  label: string;
@@ -29,11 +29,14 @@ var setVisibleColumns = exports.setVisibleColumns = function setVisibleColumns(c
29
29
  parsed[key] = columns;
30
30
  localStorage.setItem(STORAGE_KEY, JSON.stringify(parsed));
31
31
  };
32
- var generateHeader = exports.generateHeader = function generateHeader(header, visibleColumns) {
32
+ var generateHeader = exports.generateHeader = function generateHeader(header, visibleColumns, sortable, fixed) {
33
33
  if (!(visibleColumns !== null && visibleColumns !== void 0 && visibleColumns.includes(header.name))) return null;
34
34
  return /*#__PURE__*/_react["default"].createElement(_styles.TableCellInteractive, {
35
- key: header.name + '-header',
36
- name: header.name
35
+ fixed: fixed,
36
+ name: header.name,
37
+ sortable: sortable,
38
+ width: header.width,
39
+ key: header.name + '-header'
37
40
  }, header.label);
38
41
  };
39
42
  var getVisibleColumns = exports.getVisibleColumns = function getVisibleColumns(headers, visibleColumns) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flipper-ui",
3
- "version": "0.37.3",
3
+ "version": "0.37.5",
4
4
  "description": "React UI based on the @mui/material toolkit for the web",
5
5
  "main": "dist/index.js",
6
6
  "author": "NG",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/cli": "7.28.3",
44
- "@babel/core": "7.28.3",
44
+ "@babel/core": "7.28.4",
45
45
  "@babel/plugin-transform-runtime": "7.28.3",
46
46
  "@babel/preset-env": "7.28.3",
47
47
  "@babel/preset-react": "7.27.1",
@@ -52,49 +52,50 @@
52
52
  "@storybook/blocks": "8.6.12",
53
53
  "@storybook/react": "8.6.12",
54
54
  "@storybook/react-webpack5": "8.6.12",
55
- "@stylistic/eslint-plugin": "5.2.3",
55
+ "@stylistic/eslint-plugin": "5.4.0",
56
56
  "@testing-library/dom": "10.4.1",
57
57
  "@testing-library/jest-dom": "6.8.0",
58
58
  "@testing-library/react": "16.3.0",
59
59
  "@testing-library/user-event": "14.6.1",
60
60
  "@types/jest": "30.0.0",
61
- "@types/node": "24.3.0",
61
+ "@types/node": "24.5.2",
62
62
  "@types/ramda": "0.30.2",
63
63
  "@types/react": "18.3.12",
64
- "@typescript-eslint/eslint-plugin": "8.40.0",
65
- "@typescript-eslint/parser": "8.40.0",
64
+ "@typescript-eslint/eslint-plugin": "8.44.1",
65
+ "@typescript-eslint/parser": "8.44.1",
66
66
  "babel-loader": "10.0.0",
67
67
  "babel-plugin-import": "1.13.8",
68
68
  "babel-plugin-module-resolver": "5.0.2",
69
69
  "date-fns": "4.1.0",
70
- "eslint": "9.34.0",
70
+ "eslint": "9.36.0",
71
71
  "eslint-config-prettier": "10.1.8",
72
72
  "eslint-import-resolver-typescript": "4.4.4",
73
73
  "eslint-plugin-import": "2.32.0",
74
74
  "eslint-plugin-prettier": "5.5.4",
75
75
  "eslint-plugin-react": "7.37.5",
76
76
  "eslint-plugin-react-hooks": "5.2.0",
77
- "fs-extra": "11.3.1",
77
+ "fs-extra": "11.3.2",
78
78
  "identity-obj-proxy": "3.0.0",
79
- "jest": "30.0.5",
80
- "jest-environment-jsdom": "30.0.5",
79
+ "jest": "30.1.3",
80
+ "jest-environment-jsdom": "30.1.2",
81
81
  "prettier": "3.6.2",
82
82
  "ramda": "0.30.1",
83
83
  "react": "18.3.1",
84
84
  "react-dom": "18.3.1",
85
85
  "storybook": "8.6.12",
86
- "ts-jest": "29.4.1",
86
+ "ts-jest": "29.4.4",
87
87
  "ts-loader": "9.5.4",
88
88
  "typescript": "5.9.2",
89
- "typescript-eslint": "8.40.0",
89
+ "typescript-eslint": "8.44.1",
90
90
  "uuid": "11.1.0",
91
91
  "webpack": "5.101.3"
92
92
  },
93
93
  "peerDependencies": {
94
94
  "date-fns": "^4.0.0",
95
95
  "ramda": "^0.30.1",
96
- "react": "^17.0.0 || ^18.0.0",
97
- "react-dom": "^17.0.0 || ^18.0.0"
96
+ "react": "^18.0.0",
97
+ "react-dom": "^18.0.0",
98
+ "@types/ramda": "^0.30.2"
98
99
  },
99
100
  "publishConfig": {
100
101
  "ignore": [
@@ -8,11 +8,17 @@ interface TableInteractiveWrapperProps extends Partial<ITableInteractive> {
8
8
  setRowsPerPageMock?: jest.Mock;
9
9
  setVisibleColumnsMock?: jest.Mock;
10
10
  }
11
- export declare const HEADERS: {
11
+ export declare const HEADERS: ({
12
12
  name: string;
13
13
  label: string;
14
14
  show: boolean;
15
- }[];
15
+ width: string;
16
+ } | {
17
+ name: string;
18
+ label: string;
19
+ show: boolean;
20
+ width?: undefined;
21
+ })[];
16
22
  export declare const TABLE_DATA: {
17
23
  name: string;
18
24
  email: string;