flipper-ui 0.40.3 → 0.41.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.
Files changed (80) hide show
  1. package/core/data-display/actions/actions.spec.d.ts +1 -1
  2. package/core/data-display/actions/actions.stories.d.ts +2 -1
  3. package/core/data-display/actions/index.d.ts +83 -3
  4. package/core/data-display/actions/index.js +46 -8
  5. package/core/data-display/actions/styles.d.ts +1 -1
  6. package/core/data-display/actions/styles.js +3 -3
  7. package/core/data-display/advertise/styles.d.ts +1 -1
  8. package/core/data-display/data-table/data-table.d.ts +5 -0
  9. package/core/data-display/data-table/data-table.js +18 -6
  10. package/core/data-display/data-table/data-table.stories.d.ts +110 -8
  11. package/core/data-display/data-table/rows.d.ts +7 -2
  12. package/core/data-display/data-table/rows.js +18 -6
  13. package/core/data-display/data-table/styles.d.ts +1 -1
  14. package/core/data-display/data-table/types.d.ts +2 -0
  15. package/core/data-display/list-item-dark/index.js +3 -4
  16. package/core/data-display/list-item-dark/styles.d.ts +1 -1
  17. package/core/data-display/table/index.js +34 -0
  18. package/core/data-display/table/styles.d.ts +42 -0
  19. package/core/data-display/table/styles.js +68 -0
  20. package/core/data-display/table/table-pagination.js +1 -1
  21. package/core/data-display/table-interactive/TableInteractive.d.ts +4 -0
  22. package/core/data-display/table-interactive/TableInteractive.js +18 -3
  23. package/core/data-display/table-interactive/TableInteractiveHead.d.ts +1 -1
  24. package/core/data-display/table-interactive/TableInteractiveHead.js +1 -1
  25. package/core/data-display/table-interactive/TableInteractiveHeader.js +1 -0
  26. package/core/data-display/table-interactive/index.d.ts +2 -0
  27. package/core/data-display/table-interactive/index.js +8 -1
  28. package/core/data-display/table-interactive/styles.js +1 -1
  29. package/core/data-display/table-interactive/table-interactive.stories.d.ts +2 -0
  30. package/core/data-display/table-interactive/utils.d.ts +1 -1
  31. package/core/data-display/table-interactive/utils.js +2 -1
  32. package/core/data-display/typography/index.d.ts +2 -1
  33. package/core/data-display/typography/index.js +18 -2
  34. package/core/data-display/view-mode/styles.d.ts +1 -1
  35. package/core/feedback/dialog-v2/dialog.js +6 -5
  36. package/core/feedback/nothing-found/index.d.ts +8 -1
  37. package/core/feedback/nothing-found/index.js +11 -2
  38. package/core/feedback/nothing-found/nothing-found.spec.d.ts +1 -1
  39. package/core/feedback/progress/index.d.ts +42 -2
  40. package/core/feedback/progress/index.js +79 -20
  41. package/core/feedback/progress/progress.spec.d.ts +1 -1
  42. package/core/feedback/progress/progress.stories.d.ts +4 -2
  43. package/core/feedback/progress/styles.d.ts +18 -0
  44. package/core/feedback/progress/styles.js +14 -0
  45. package/core/feedback/snackbar/index.js +1 -1
  46. package/core/inputs/checkbox/checkbox.spec.d.ts +1 -1
  47. package/core/inputs/checkbox/index.js +3 -1
  48. package/core/inputs/icon-button/icon-button.spec.d.ts +1 -1
  49. package/core/inputs/icon-button/index.d.ts +7 -0
  50. package/core/inputs/icon-button/index.js +11 -1
  51. package/core/inputs/select/index.js +2 -1
  52. package/core/inputs/text-field/index.d.ts +2 -2
  53. package/core/inputs/text-field/index.js +14 -4
  54. package/core/inputs/text-field/styles.js +1 -1
  55. package/core/inputs/text-field/text-field.spec.d.ts +1 -1
  56. package/core/navigation/menu/index.js +1 -1
  57. package/core/navigation/stepper/index.d.ts +38 -2
  58. package/core/navigation/stepper/index.js +36 -9
  59. package/core/navigation/stepper/stepper.stories.d.ts +2 -0
  60. package/core/surfaces/card/index.d.ts +13 -6
  61. package/core/surfaces/card/index.js +19 -12
  62. package/core/surfaces/card/styles.d.ts +3 -2
  63. package/core/surfaces/card/styles.js +2 -3
  64. package/core/surfaces/expansion-panel/index.d.ts +1 -0
  65. package/core/surfaces/expansion-panel/index.js +5 -3
  66. package/core/surfaces/step-card/index.d.ts +19 -9
  67. package/core/surfaces/step-card/index.js +2 -0
  68. package/core/surfaces/step-card/step-card-details.js +1 -0
  69. package/core/surfaces/step-card/step-card-panel.d.ts +1 -0
  70. package/core/surfaces/step-card/step-card-panel.js +2 -1
  71. package/core/surfaces/step-card/step-card.spec.d.ts +1 -1
  72. package/icons/mui/index.d.ts +1 -0
  73. package/icons/mui/index.js +7 -0
  74. package/package.json +1 -1
  75. package/theme/index.d.ts +1 -0
  76. package/theme/index.js +1 -0
  77. package/theme/theme.d.ts +43 -0
  78. package/theme/theme.js +11 -1
  79. package/theme/typography.d.ts +96 -0
  80. package/theme/typography.js +59 -0
@@ -1 +1 @@
1
- export {};
1
+ import '@testing-library/jest-dom';
@@ -3,4 +3,5 @@ import Actions from '.';
3
3
  declare const meta: Meta<typeof Actions>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Actions>;
6
- export declare const actions: Story;
6
+ export declare const defaultComponent: Story;
7
+ export declare const customComponent: Story;
@@ -1,25 +1,105 @@
1
1
  import React from 'react';
2
2
  import type { ReactNode } from 'react';
3
- export interface IActionsProps {
3
+ import type { IButtonProps } from '@/core/inputs/button';
4
+ type TSize = 'small' | 'medium' | 'large';
5
+ interface ICustomActionBase {
6
+ /** `name` attribute of the button, and the fallback for `data-testid`. */
7
+ name?: string;
8
+ /**
9
+ * Default: `'medium'` on a label action, `'small'` on an icon action.
10
+ * The icon default is deliberate — a medium IconButton is 40px tall
11
+ * against the 36.5px of a text Button, so it would drive the bar height.
12
+ */
13
+ size?: TSize;
14
+ /** Disables this button alone; `IActionsProps.disabled` disables all. */
15
+ disabled?: boolean;
16
+ /** Overrides the `data-testid`, which otherwise mirrors `name`. */
17
+ 'data-testid'?: string;
18
+ /**
19
+ * Overrides the button padding. Does not affect the gap between buttons.
20
+ */
4
21
  padding?: number | string;
22
+ onClick(): void;
23
+ }
24
+ /** A custom action rendered as a `Button`. Cannot carry an `icon`. */
25
+ export interface ILabelAction extends ICustomActionBase {
26
+ icon?: never;
27
+ label: ReactNode;
28
+ 'aria-label'?: string;
29
+ color?: IButtonProps['color'];
30
+ /** Default: `'text'`. Use `'contained'` to mark the primary action. */
31
+ variant?: IButtonProps['variant'];
32
+ }
33
+ /** A custom action rendered as an `IconButton`. Cannot carry a `label`. */
34
+ export interface IIconAction extends ICustomActionBase {
35
+ label?: never;
36
+ /** Rendered as the only content, so the button has no text of its own. */
37
+ icon: ReactNode;
38
+ /** Unavailable: `IconButton` has no variant. */
39
+ variant?: never;
40
+ /** Required: an icon leaves the button with no accessible name (WCAG 4.1.2). */
41
+ 'aria-label': string;
42
+ color?: IButtonProps['color'];
43
+ }
44
+ export type ICustomAction = ILabelAction | IIconAction;
45
+ export interface IActionsProps {
46
+ /** Margin of the action bar, not of the buttons. */
5
47
  margin?: number | string;
6
- align?: 'flex-end' | 'flex-start' | 'center';
7
- prefix?: string;
48
+ /** Padding of the action bar, not of the buttons. */
49
+ padding?: number | string;
50
+ /**
51
+ * Which of the default buttons to render; both when omitted.
52
+ * Has no effect while `customActions` is informed, since the pair is
53
+ * not rendered at all in that case.
54
+ */
8
55
  buttons?: Array<'confirm' | 'cancel'>;
56
+ /** Horizontal position of the whole bar. Default: `'flex-end'`. */
57
+ align?: 'flex-end' | 'flex-start' | 'center';
58
+ /**
59
+ * Color of the confirm button only — cancel stays neutral.
60
+ * Default: `'secondary'`.
61
+ */
9
62
  actionButtonColor?: 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
63
+ /**
64
+ * `name` attribute of the default buttons. Their `data-testid` stays
65
+ * `cancel-action` / `confirm-action` regardless, so target tests by it.
66
+ */
10
67
  names?: {
11
68
  cancel: string;
12
69
  confirm: string;
13
70
  };
71
+ /**
72
+ * Visible text of the default buttons.
73
+ * Default: `'Cancelar'` / `'Confirmar'`.
74
+ */
14
75
  labels?: {
15
76
  cancel: ReactNode;
16
77
  confirm: ReactNode;
17
78
  };
79
+ /**
80
+ * Extra buttons that **replace** the cancel/confirm pair — informing them
81
+ * makes the bar be only these, in any quantity, mixing label and icon
82
+ * actions freely. An empty array behaves as if not informed.
83
+ */
84
+ customActions?: ICustomAction[];
85
+ /**
86
+ * Size of the default buttons; custom actions carry their own.
87
+ * Default: `'medium'`.
88
+ */
89
+ size?: TSize;
90
+ /** Accessible name of the `role="group"` around the bar. Default: `'Ações'`. */
91
+ ariaLabel?: string;
92
+ /** Hides the confirm button and the custom actions — cancel still renders. */
18
93
  readonly?: boolean;
94
+ /** Disables every rendered button, custom actions included. */
19
95
  disabled?: boolean;
96
+ /** Disables the cancel button alone, on top of `disabled`. */
20
97
  disabledCancel?: boolean;
98
+ /** Disables the confirm button alone, on top of `disabled`. */
21
99
  disabledConfirm?: boolean;
100
+ /** Omitting it still renders the cancel button — with no handler attached. */
22
101
  onCancel?(): void | boolean;
102
+ /** Required even when `customActions` keeps the confirm button off the bar. */
23
103
  onConfirm(): void;
24
104
  }
25
105
  declare const Actions: (props: IActionsProps) => React.JSX.Element;
@@ -7,25 +7,63 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports["default"] = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _button = _interopRequireDefault(require("../../inputs/button"));
10
+ var _iconButton = _interopRequireDefault(require("../../inputs/icon-button"));
10
11
  var _styles = require("./styles");
12
+ /** A custom action rendered as a `Button`. Cannot carry an `icon`. */
13
+
14
+ /** A custom action rendered as an `IconButton`. Cannot carry a `label`. */
15
+
11
16
  var Actions = function Actions(props) {
12
- var showButton = !props.readonly && (!props.buttons || props.buttons.includes('confirm'));
17
+ var _props$customActions;
18
+ var hasCustomActions = !!((_props$customActions = props.customActions) !== null && _props$customActions !== void 0 && _props$customActions.length);
19
+ var showButton = !hasCustomActions && !props.readonly && (!props.buttons || props.buttons.includes('confirm'));
20
+ var showCancel = !hasCustomActions && (!props.buttons || props.buttons.includes('cancel'));
21
+ var renderCustomActions = function renderCustomActions() {
22
+ var _props$customActions2;
23
+ return props.readonly ? null : (_props$customActions2 = props.customActions) === null || _props$customActions2 === void 0 ? void 0 : _props$customActions2.map(function (action, index) {
24
+ return action.icon ? /*#__PURE__*/_react["default"].createElement(_iconButton["default"], {
25
+ name: action.name,
26
+ color: action.color,
27
+ key: action.name || index,
28
+ size: action.size || 'small',
29
+ padding: action.padding || '4px',
30
+ "aria-label": action['aria-label'],
31
+ disabled: props.disabled || action.disabled,
32
+ "data-testid": action['data-testid'] || action.name,
33
+ onClick: action.onClick
34
+ }, action.icon) : /*#__PURE__*/_react["default"].createElement(_button["default"], {
35
+ name: action.name,
36
+ color: action.color,
37
+ padding: action.padding,
38
+ variant: action.variant,
39
+ key: action.name || index,
40
+ size: action.size || 'medium',
41
+ "aria-label": action['aria-label'],
42
+ disabled: props.disabled || action.disabled,
43
+ "data-testid": action['data-testid'] || action.name,
44
+ onClick: action.onClick
45
+ }, action.label);
46
+ });
47
+ };
13
48
  return /*#__PURE__*/_react["default"].createElement(_styles.Wrapper, {
14
- align: props.align || 'flex-end',
49
+ role: "group",
50
+ margin: props.margin,
15
51
  padding: props.padding,
16
- margin: props.margin
17
- }, (!props.buttons || props.buttons.includes('cancel')) && /*#__PURE__*/_react["default"].createElement(_button["default"], {
18
- margin: "0 16px",
52
+ align: props.align || 'flex-end',
53
+ "aria-label": props.ariaLabel || 'Ações'
54
+ }, renderCustomActions(), showCancel && /*#__PURE__*/_react["default"].createElement(_button["default"], {
55
+ "data-testid": "cancel-action",
56
+ size: props.size || 'medium',
19
57
  disabled: props.disabled || props.disabledCancel,
20
58
  name: props.names ? props.names.cancel : 'cancel-action',
21
- "data-testid": "cancel-action",
22
59
  onClick: props.onCancel
23
60
  }, props.labels ? props.labels.cancel : 'Cancelar'), showButton && /*#__PURE__*/_react["default"].createElement(_button["default"], {
24
- color: props.actionButtonColor || 'secondary',
25
61
  variant: "contained",
62
+ "data-testid": "confirm-action",
63
+ size: props.size || 'medium',
64
+ color: props.actionButtonColor || 'secondary',
26
65
  disabled: props.disabled || props.disabledConfirm,
27
66
  name: props.names ? props.names.confirm : 'confirm-action',
28
- "data-testid": "confirm-action",
29
67
  onClick: props.onConfirm
30
68
  }, props.labels ? props.labels.confirm : 'Confirmar'));
31
69
  };
@@ -1,6 +1,6 @@
1
1
  interface IWrapper {
2
- padding?: number | string;
3
2
  margin?: number | string;
3
+ padding?: number | string;
4
4
  align?: 'flex-end' | 'flex-start' | 'center';
5
5
  }
6
6
  export declare const Wrapper: import("@emotion/styled").StyledComponent<{
@@ -8,10 +8,10 @@ exports.Wrapper = void 0;
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _styled = _interopRequireDefault(require("@emotion/styled"));
10
10
  var _templateObject;
11
- var Wrapper = exports.Wrapper = _styled["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n grid-area: actions;\n display: flex;\n flex: 1;\n justify-content: ", ";\n padding: ", ";\n margin: ", ";\n"])), function (props) {
12
- return props.align;
11
+ var Wrapper = exports.Wrapper = _styled["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n grid-area: actions;\n display: flex;\n flex: 1;\n gap: 8px;\n align-items: center;\n margin: ", ";\n padding: ", ";\n justify-content: ", ";\n"])), function (props) {
12
+ return props.margin;
13
13
  }, function (props) {
14
14
  return props.padding;
15
15
  }, function (props) {
16
- return props.margin;
16
+ return props.align;
17
17
  });
@@ -1,6 +1,6 @@
1
1
  export declare const AdvertiseTypography: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
2
2
  ref?: ((instance: HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSpanElement> | null | undefined;
3
- }, "color" | "children" | "padding" | "margin" | "style" | "className" | "classes" | "sx" | "p" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "marginBlock" | "marginInline" | "overflow" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & {
3
+ }, "p" | "zIndex" | "typography" | "children" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxShadow" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "className" | "style" | "classes" | "sx" | "variant" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & {
4
4
  component?: React.ElementType;
5
5
  } & import("../../types").DefaultProps & {
6
6
  theme?: import("@emotion/react").Theme;
@@ -17,6 +17,11 @@ export type DataTableProps<D extends Data, V extends StackView = Record<string,
17
17
  hidden?: boolean;
18
18
  rowViews?: Record<keyof V, RowViewComponent<D>>;
19
19
  size?: 'small' | 'medium';
20
+ maxHeight?: number | string;
21
+ stickyHeader?: boolean;
22
+ cellPadding?: CSSProperties['padding'];
23
+ framed?: boolean;
24
+ borderRadius?: number | string;
20
25
  renderEmptyRows?: boolean;
21
26
  hideSelect?: boolean;
22
27
  checkbox?: boolean;
@@ -21,6 +21,7 @@ var _TableFooter = _interopRequireDefault(require("@mui/material/TableFooter"));
21
21
  var _TableHead = _interopRequireDefault(require("@mui/material/TableHead"));
22
22
  var _TablePagination = _interopRequireDefault(require("@mui/material/TablePagination"));
23
23
  var _TableRow = _interopRequireDefault(require("@mui/material/TableRow"));
24
+ var _styles = require("../table/styles");
24
25
  var _dataTablePaginationActions = require("./data-table-pagination-actions");
25
26
  var _rows = require("./rows");
26
27
  var _types = require("./types");
@@ -61,6 +62,11 @@ var DataTable = exports.DataTable = function DataTable(props) {
61
62
  errors = props.errors,
62
63
  componentForEmpty = props.componentForEmpty,
63
64
  size = props.size,
65
+ maxHeight = props.maxHeight,
66
+ stickyHeader = props.stickyHeader,
67
+ cellPadding = props.cellPadding,
68
+ framed = props.framed,
69
+ borderRadius = props.borderRadius,
64
70
  renderEmptyRows = props.renderEmptyRows,
65
71
  hideSelect = props.hideSelect,
66
72
  bodyStyle = props.bodyStyle,
@@ -203,20 +209,21 @@ var DataTable = exports.DataTable = function DataTable(props) {
203
209
  errors: errors,
204
210
  mode: mode,
205
211
  isHidden: hidden,
212
+ cellPadding: cellPadding,
206
213
  onUpdate: setEditableRowState(row.id)
207
214
  }));
208
215
  });
209
- }, [rows, getRowState, rowViews, hidden, bodyRowStyle, checkbox, columns, errors, setEditableRowState, onRowClick, checkboxProps]);
216
+ }, [rows, getRowState, rowViews, hidden, bodyRowStyle, checkbox, columns, errors, cellPadding, setEditableRowState, onRowClick, checkboxProps]);
210
217
  var columnsList = (0, _react.useMemo)(function () {
211
218
  return columns.map(function (column) {
212
219
  return /*#__PURE__*/_react["default"].createElement(_TableCell["default"], {
213
220
  key: column.title,
214
221
  variant: "head",
215
- style: column.headerStyle,
222
+ style: (0, _rows.withCellStyle)(column.headerStyle, cellPadding, column.truncate),
216
223
  align: column.align
217
224
  }, column.title);
218
225
  });
219
- }, [columns]);
226
+ }, [columns, cellPadding]);
220
227
  var currentRowsNumber = rows.length + (newRow ? 1 : 0);
221
228
  var hiddenRowsNumber = pagination.disabled ? 0 : rowsPerPage - currentRowsNumber;
222
229
  var hiddenRowFiller = hiddenRowsNumber !== 0 && /*#__PURE__*/_react["default"].createElement(_TableRow["default"], {
@@ -232,6 +239,7 @@ var DataTable = exports.DataTable = function DataTable(props) {
232
239
  data: newRow,
233
240
  errors: errors,
234
241
  columns: columns,
242
+ cellPadding: cellPadding,
235
243
  onUpdate: setEditableRowState(newRow.id)
236
244
  }), rowsList);
237
245
  var paginationActionsComponent = (0, _react.useMemo)(function () {
@@ -242,10 +250,14 @@ var DataTable = exports.DataTable = function DataTable(props) {
242
250
  }, [pagination.showFirstButton, pagination.showLastButton]);
243
251
  var emptyRows = rowsPerPage - Math.min(rowsPerPage, data.length - page * rowsPerPage);
244
252
  return /*#__PURE__*/_react["default"].createElement(_TableContainer["default"], {
245
- role: "data-table-container",
246
- component: _Paper["default"]
253
+ "data-testid": "data-table-container",
254
+ component: _Paper["default"],
255
+ sx: _objectSpread(_objectSpread({}, maxHeight ? _objectSpread({
256
+ maxHeight: maxHeight
257
+ }, _styles.SCROLLBAR) : undefined), (0, _styles.tableFrame)(framed, borderRadius))
247
258
  }, /*#__PURE__*/_react["default"].createElement(_Table["default"], {
248
- size: size
259
+ size: size,
260
+ stickyHeader: stickyHeader
249
261
  }, !noHeader && /*#__PURE__*/_react["default"].createElement(_TableHead["default"], {
250
262
  style: headStyle
251
263
  }, /*#__PURE__*/_react["default"].createElement(_TableRow["default"], {
@@ -3,11 +3,113 @@ import type { Meta } from '@storybook/react';
3
3
  import { default as DataTable } from './data-table';
4
4
  declare const meta: Meta<typeof DataTable>;
5
5
  export default meta;
6
- export declare const Default: () => React.JSX.Element;
7
- export declare const Custom: () => React.JSX.Element;
8
- export declare const Empty: () => React.JSX.Element;
9
- export declare const NoHeader: () => React.JSX.Element;
10
- export declare const NoPagination: () => React.JSX.Element;
11
- export declare const Crud: () => React.JSX.Element;
12
- export declare const CrudWithoutPagination: () => React.JSX.Element;
13
- export declare const WithField: () => React.JSX.Element;
6
+ export declare const Default: {
7
+ (): React.JSX.Element;
8
+ parameters: {
9
+ docs: {
10
+ description: {
11
+ story: string;
12
+ };
13
+ };
14
+ };
15
+ };
16
+ export declare const Truncated: {
17
+ (): React.JSX.Element;
18
+ parameters: {
19
+ docs: {
20
+ description: {
21
+ story: string;
22
+ };
23
+ };
24
+ };
25
+ };
26
+ export declare const Framed: {
27
+ (): React.JSX.Element;
28
+ parameters: {
29
+ docs: {
30
+ description: {
31
+ story: string;
32
+ };
33
+ };
34
+ };
35
+ };
36
+ export declare const StickyHeader: {
37
+ (): React.JSX.Element;
38
+ parameters: {
39
+ docs: {
40
+ description: {
41
+ story: string;
42
+ };
43
+ };
44
+ };
45
+ };
46
+ export declare const Custom: {
47
+ (): React.JSX.Element;
48
+ parameters: {
49
+ docs: {
50
+ description: {
51
+ story: string;
52
+ };
53
+ };
54
+ };
55
+ };
56
+ export declare const Empty: {
57
+ (): React.JSX.Element;
58
+ parameters: {
59
+ docs: {
60
+ description: {
61
+ story: string;
62
+ };
63
+ };
64
+ };
65
+ };
66
+ export declare const NoHeader: {
67
+ (): React.JSX.Element;
68
+ parameters: {
69
+ docs: {
70
+ description: {
71
+ story: string;
72
+ };
73
+ };
74
+ };
75
+ };
76
+ export declare const NoPagination: {
77
+ (): React.JSX.Element;
78
+ parameters: {
79
+ docs: {
80
+ description: {
81
+ story: string;
82
+ };
83
+ };
84
+ };
85
+ };
86
+ export declare const Crud: {
87
+ (): React.JSX.Element;
88
+ parameters: {
89
+ docs: {
90
+ description: {
91
+ story: string;
92
+ };
93
+ };
94
+ };
95
+ };
96
+ export declare const CrudWithoutPagination: {
97
+ (): React.JSX.Element;
98
+ parameters: {
99
+ docs: {
100
+ description: {
101
+ story: string;
102
+ };
103
+ };
104
+ };
105
+ };
106
+ export declare const WithField: {
107
+ (): React.JSX.Element;
108
+ parameters: {
109
+ docs: {
110
+ description: {
111
+ story: string;
112
+ };
113
+ };
114
+ };
115
+ };
@@ -1,10 +1,14 @@
1
1
  import React from 'react';
2
+ import type { CSSProperties } from 'react';
2
3
  import type { ColumnSpec, Data, Errors, PartialData } from './types';
4
+ import type { Truncate } from '../table/styles';
3
5
  import { RowMode } from './types';
6
+ export declare const withCellStyle: (style?: CSSProperties, padding?: CSSProperties["padding"], truncate?: Truncate) => React.CSSProperties | undefined;
4
7
  type NewRowProps<D extends Data> = {
5
8
  data: PartialData<D>;
6
9
  errors?: Errors<D>;
7
10
  columns: ColumnSpec<D>[];
11
+ cellPadding?: CSSProperties['padding'];
8
12
  onUpdate?(partial: Partial<Data>): void;
9
13
  };
10
14
  type StatefulRowProps<D extends Data> = {
@@ -13,8 +17,9 @@ type StatefulRowProps<D extends Data> = {
13
17
  errors?: Errors<D>;
14
18
  columns: ColumnSpec<D>[];
15
19
  isHidden?: boolean;
20
+ cellPadding?: CSSProperties['padding'];
16
21
  onUpdate?(partial: Partial<Data>): void;
17
22
  };
18
- export declare const StatefulRow: <D extends Data>({ data, mode, errors, columns, onUpdate, isHidden }: StatefulRowProps<D>) => React.JSX.Element;
19
- export declare const NewRow: <D extends Data>({ data, columns, errors, onUpdate }: NewRowProps<D>) => React.JSX.Element;
23
+ export declare const StatefulRow: <D extends Data>({ data, mode, errors, columns, onUpdate, isHidden, cellPadding }: StatefulRowProps<D>) => React.JSX.Element;
24
+ export declare const NewRow: <D extends Data>({ data, columns, errors, onUpdate, cellPadding }: NewRowProps<D>) => React.JSX.Element;
20
25
  export {};
@@ -5,19 +5,29 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.StatefulRow = exports.NewRow = void 0;
9
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
+ exports.withCellStyle = exports.StatefulRow = exports.NewRow = void 0;
10
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _TableCell = _interopRequireDefault(require("@mui/material/TableCell"));
13
13
  var _TableRow = _interopRequireDefault(require("@mui/material/TableRow"));
14
14
  var _dateTime = _interopRequireDefault(require("../../inputs/date-time"));
15
15
  var _maskField = _interopRequireDefault(require("../../inputs/mask-field"));
16
16
  var _textField = _interopRequireDefault(require("../../inputs/text-field"));
17
+ var _styles = require("../table/styles");
17
18
  var _types = require("./types");
18
19
  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); }
19
20
  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; }
20
21
  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; }
22
+ var withCellStyle = exports.withCellStyle = function withCellStyle(style, padding, truncate) {
23
+ var clip = (0, _styles.truncateStyle)(truncate);
24
+ if (!clip && padding === undefined) {
25
+ return style;
26
+ }
27
+ return _objectSpread(_objectSpread({}, clip), {}, {
28
+ padding: padding
29
+ }, style);
30
+ };
21
31
  var isEditable = function isEditable(column) {
22
32
  return column.type === 'actions' || column.editable;
23
33
  };
@@ -130,7 +140,8 @@ var StatefulRow = exports.StatefulRow = function StatefulRow(_ref) {
130
140
  errors = _ref.errors,
131
141
  columns = _ref.columns,
132
142
  onUpdate = _ref.onUpdate,
133
- isHidden = _ref.isHidden;
143
+ isHidden = _ref.isHidden,
144
+ cellPadding = _ref.cellPadding;
134
145
  var _useState = (0, _react.useState)(function () {
135
146
  return data;
136
147
  }),
@@ -158,7 +169,7 @@ var StatefulRow = exports.StatefulRow = function StatefulRow(_ref) {
158
169
  return /*#__PURE__*/_react["default"].createElement(_TableCell["default"], {
159
170
  align: column.align,
160
171
  key: "".concat(column.title, "-").concat(i),
161
- style: column.cellStyle
172
+ style: withCellStyle(column.cellStyle, cellPadding, column.truncate)
162
173
  }, getCorrectViewMode(column, mode, isEditable(column)));
163
174
  }));
164
175
  };
@@ -166,7 +177,8 @@ var NewRow = exports.NewRow = function NewRow(_ref2) {
166
177
  var data = _ref2.data,
167
178
  columns = _ref2.columns,
168
179
  errors = _ref2.errors,
169
- onUpdate = _ref2.onUpdate;
180
+ onUpdate = _ref2.onUpdate,
181
+ cellPadding = _ref2.cellPadding;
170
182
  var _useState3 = (0, _react.useState)(function () {
171
183
  return data;
172
184
  }),
@@ -183,7 +195,7 @@ var NewRow = exports.NewRow = function NewRow(_ref2) {
183
195
  "data-testid": "table-row"
184
196
  }, columns.map(function (column, i) {
185
197
  return /*#__PURE__*/_react["default"].createElement(_TableCell["default"], {
186
- style: column.cellStyle,
198
+ style: withCellStyle(column.cellStyle, cellPadding, column.truncate),
187
199
  align: column.align,
188
200
  key: "".concat(column.title, "-").concat(i)
189
201
  }, isEditable(column) ? renderEditMode(column, editableState, partialUpdate, errors, true) : renderViewMode(column, editableState));
@@ -11,6 +11,6 @@ export declare const TableCellRows: import("@emotion/styled").StyledComponent<im
11
11
  }, {}, {}>;
12
12
  export declare const RowTable: import("@emotion/styled").StyledComponent<import("@mui/material/TableRow").TableRowOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
13
13
  ref?: ((instance: HTMLTableRowElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLTableRowElement> | null | undefined;
14
- }, "children" | "style" | "className" | "classes" | "sx" | "selected" | "hover"> & {
14
+ }, "children" | "className" | "style" | "classes" | "sx" | "selected" | "hover"> & {
15
15
  theme?: import("@emotion/react").Theme;
16
16
  }, {}, {}>;
@@ -1,4 +1,5 @@
1
1
  import type { CSSProperties, FunctionComponent } from 'react';
2
+ import type { Truncate } from '../table/styles';
2
3
  import type { IOption } from '@/core/inputs/text-field';
3
4
  export type RecordUnknown = Record<string, unknown>;
4
5
  export type StackView = RecordUnknown;
@@ -17,6 +18,7 @@ type ColumnSpecBase<F = object> = {
17
18
  cellStyle?: CSSProperties;
18
19
  headerStyle?: CSSProperties;
19
20
  align?: Align;
21
+ truncate?: Truncate;
20
22
  renderCell?: FunctionComponent<F>;
21
23
  };
22
24
  export type RenderCellProps<D extends Data> = {
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports["default"] = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _Typography2 = _interopRequireDefault(require("@mui/material/Typography"));
10
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
10
  var _react = _interopRequireDefault(require("react"));
12
11
  var _ListItem = _interopRequireDefault(require("@mui/material/ListItem"));
12
+ var _typography = _interopRequireDefault(require("../typography"));
13
13
  var _tooltip = _interopRequireDefault(require("../../feedback/tooltip"));
14
14
  var _styles = require("./styles");
15
15
  var _excluded = ["id", "name", "href", "icon", "title", "dense", "actions", "selected", "disabled", "className", "expanded", "onClick"];
@@ -59,10 +59,9 @@ var ListItemDark = function ListItemDark(_ref) {
59
59
  }, icon), (title || actions) && /*#__PURE__*/_react["default"].createElement(_styles.ItemLabel, {
60
60
  expanded: expanded,
61
61
  "aria-hidden": !expanded
62
- }, title && /*#__PURE__*/_react["default"].createElement(_Typography2["default"], {
62
+ }, title && /*#__PURE__*/_react["default"].createElement(_typography["default"], {
63
63
  flex: "1 0 0",
64
- variant: "body2",
65
- fontSize: "13.5px",
64
+ variant: "dense",
66
65
  fontWeight: selected ? 500 : 400,
67
66
  sx: {
68
67
  minWidth: 0,
@@ -15,7 +15,7 @@ export declare const ItemLabel: import("@emotion/styled").StyledComponent<{
15
15
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
16
16
  export declare const ItemButton: import("@emotion/styled").StyledComponent<import("@mui/material/ListItemButton").ListItemButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
17
17
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
18
- }, "disabled" | "children" | "style" | "className" | "classes" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "tabIndex" | "TouchRippleProps" | "touchRippleRef" | "autoFocus" | "alignItems" | "dense" | "selected" | "disableGutters" | "divider"> & {
18
+ }, "children" | "action" | "alignItems" | "className" | "style" | "classes" | "sx" | "autoFocus" | "tabIndex" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableGutters" | "dense" | "divider" | "selected"> & {
19
19
  theme?: import("@emotion/react").Theme;
20
20
  } & IRootProps, {}, {}>;
21
21
  export declare const IconSlot: import("@emotion/styled").StyledComponent<{