plataforma-fundacao-componentes 2.22.13 → 2.22.16

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,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { CheckboxThemes } from '../../libraries/CheckboxThemes';
3
3
  import { TooltipPosition } from '../../libraries/Tooltips';
4
4
  import './Checkbox.scss';
@@ -7,7 +7,7 @@ export interface CheckboxProps {
7
7
  'tooltip-text'?: string;
8
8
  disabled?: boolean;
9
9
  value?: boolean;
10
- onChange?: (value: boolean) => void;
10
+ onChange?: (value: boolean, evt: React.MouseEvent<HTMLElement>) => void;
11
11
  theme?: CheckboxThemes;
12
12
  tag?: 'button' | 'div';
13
13
  }
@@ -1,7 +1,9 @@
1
- declare namespace _default {
2
- export const title: string;
3
- export { DropdownMenu as component };
4
- }
1
+ /// <reference types="react" />
2
+ import DropdownMenu from './DropdownMenu';
3
+ declare const _default: {
4
+ title: string;
5
+ component: typeof DropdownMenu;
6
+ };
5
7
  export default _default;
6
- export function LeftTop(): JSX.Element;
7
- import DropdownMenu from "./DropdownMenu";
8
+ export declare const Example: () => JSX.Element;
9
+ export declare const Oversized: () => JSX.Element;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { DropdownMenuProps } from '../../../dropdownMenu/DropdownMenu';
3
3
  import './TableUpperHeader.scss';
4
4
  interface upperHeaderButtonType {
@@ -18,6 +18,8 @@ export interface TableUpperHeaderProps {
18
18
  active?: boolean;
19
19
  leftContent?: (upperHeaderButtonType | upperHeaderDropdownMenuType)[];
20
20
  rightContent?: (upperHeaderButtonType | upperHeaderDropdownMenuType)[];
21
+ opened?: boolean;
22
+ collapsedContent?: ReactNode;
21
23
  }
22
24
  declare function TableUpperHeader(props: TableUpperHeaderProps): JSX.Element;
23
25
  declare const _default: React.MemoExoticComponent<typeof TableUpperHeader>;
@@ -16,8 +16,6 @@ export declare type ColumnObject = {
16
16
  };
17
17
  interface TableWithOverflowProps {
18
18
  upperHeader?: TableUpperHeaderProps;
19
- showArrowControl?: boolean;
20
- hasActionsCol?: boolean;
21
19
  showTopNavigator?: boolean;
22
20
  columns: ColumnObject[];
23
21
  lines?: any[];
@@ -25,8 +23,6 @@ interface TableWithOverflowProps {
25
23
  declare function TableWithOverflow(props: TableWithOverflowProps): JSX.Element;
26
24
  declare namespace TableWithOverflow {
27
25
  var defaultProps: {
28
- showArrowControl: boolean;
29
- hasActionsCol: boolean;
30
26
  showTopNavigator: boolean;
31
27
  };
32
28
  }
package/dist/index.css CHANGED
@@ -7876,7 +7876,9 @@ h5 {
7876
7876
  background-color: #fefefe;
7877
7877
  position: fixed;
7878
7878
  border-radius: 8px;
7879
- box-shadow: 0 1px 2px 0 rgba(90, 100, 90, 0.3); }
7879
+ box-shadow: 0 1px 2px 0 rgba(90, 100, 90, 0.3);
7880
+ overflow: overlay;
7881
+ max-height: calc(49% - 46px); }
7880
7882
 
7881
7883
  .component-dropdown-menu-panel-fade-enter {
7882
7884
  transition: transform 0.3s ease, opacity 0.3s ease;
@@ -15238,7 +15240,7 @@ h5 {
15238
15240
  .component-upper-header-table {
15239
15241
  width: 100%;
15240
15242
  border-radius: 8px 8px 0 0;
15241
- padding: 0 8px;
15243
+ padding: 0;
15242
15244
  display: flex;
15243
15245
  align-items: center;
15244
15246
  justify-content: space-between;
@@ -15284,11 +15286,16 @@ h5 {
15284
15286
  background-color: #d7e6c8;
15285
15287
  color: #3fa110; }
15286
15288
  .component-upper-header-table .component-upper-header-table-left {
15289
+ padding-left: 8px;
15287
15290
  display: flex;
15288
15291
  flex-wrap: wrap; }
15289
15292
  .component-upper-header-table .component-upper-header-table-right {
15293
+ padding-right: 8px;
15290
15294
  display: flex;
15291
15295
  flex-wrap: wrap; }
15296
+ .component-upper-header-table .component-upper-header-table-collapsed {
15297
+ border-top: 1px solid #3fa110;
15298
+ background-color: #eff4eb; }
15292
15299
 
15293
15300
  @import url("https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
15294
15301
  @import url("https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200;0,300;0,400;0,600;0,700;0,800;0,900;1,200;1,300;1,400;1,600;1,700;1,800;1,900&display=swap");
package/dist/index.js CHANGED
@@ -1339,7 +1339,7 @@ function Checkbox(props) {
1339
1339
  var fProps = React.useMemo(function () {
1340
1340
  var handleClick = function handleClick(evt) {
1341
1341
  if (typeof props.onChange === 'function' && !props.disabled) {
1342
- props.onChange(!props.value);
1342
+ props.onChange(!props.value, evt);
1343
1343
  evt.stopPropagation();
1344
1344
  }
1345
1345
  };
@@ -4450,26 +4450,20 @@ function DropdownMenu(props) {
4450
4450
  var windowHeight = window.innerHeight;
4451
4451
  var windowWidth = window.innerWidth;
4452
4452
 
4453
- if (painel.getBoundingClientRect().height > windowHeight) {
4454
- painel.style.overflowY = 'overlay';
4455
- } else {
4456
- painel.style.overflowY = '';
4457
- }
4458
-
4459
4453
  if (pontoCentralX < windowWidth / 2) {
4454
+ painel.style.left = bound.x + "px";
4455
+
4460
4456
  if (pontoCentralY < windowHeight / 2) {
4461
- painel.style.left = bound.x + "px";
4462
4457
  painel.style.top = bound.y + bound.height + "px";
4463
4458
  } else {
4464
- painel.style.left = bound.x + "px";
4465
4459
  painel.style.top = bound.y - painel.getBoundingClientRect().height + "px";
4466
4460
  }
4467
4461
  } else {
4462
+ painel.style.right = windowWidth - bound.x - bound.width + "px";
4463
+
4468
4464
  if (pontoCentralY < windowHeight / 2) {
4469
- painel.style.right = windowWidth - bound.x - bound.width + "px";
4470
4465
  painel.style.top = bound.y + bound.height + "px";
4471
4466
  } else {
4472
- painel.style.right = windowWidth - bound.x - bound.width + "px";
4473
4467
  painel.style.top = bound.y - painel.getBoundingClientRect().height + "px";
4474
4468
  }
4475
4469
  }
@@ -4563,7 +4557,7 @@ function DropdownMenu(props) {
4563
4557
  classNames: rootClassName$S + "-panel-fade",
4564
4558
  unmountOnExit: true
4565
4559
  }, React__default.createElement("div", {
4566
- className: rootClassName$S + "-panel"
4560
+ className: rootClassName$S + "-panel scroll-white"
4567
4561
  }, props.content)));
4568
4562
  }
4569
4563
  DropdownMenu.defaultProps = {
@@ -9586,7 +9580,7 @@ var LeftCheckboxWithLabel = function LeftCheckboxWithLabel(props) {
9586
9580
  var _props$spanProps3;
9587
9581
 
9588
9582
  if (props.anchorLabelToCheckbox) {
9589
- props.onChange(!props.value);
9583
+ props.onChange(!props.value, evt);
9590
9584
  }
9591
9585
 
9592
9586
  if (props.spanProps && typeof props.spanProps.onClick === 'function') (_props$spanProps3 = props.spanProps) === null || _props$spanProps3 === void 0 ? void 0 : _props$spanProps3.onClick(evt);
@@ -9878,38 +9872,49 @@ function TableUpperHeader(props) {
9878
9872
  }, React__default.createElement("div", {
9879
9873
  className: rootClassName$1A + "-left"
9880
9874
  }, (_props$leftContent = props.leftContent) === null || _props$leftContent === void 0 ? void 0 : _props$leftContent.map(function (btn, i) {
9881
- return btn.type === 'Button' ? React__default.createElement("button", Object.assign({
9882
- key: i
9883
- }, btn, {
9875
+ return btn.type === 'Button' ? React__default.createElement("button", {
9876
+ key: i,
9877
+ id: btn.id,
9878
+ onClick: btn.onClick,
9884
9879
  disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.disabled) || false,
9885
- type: 'button',
9886
- className: rootClassName$1A + "-btn"
9887
- }), btn.leftIcon && React__default.createElement("span", null, btn.leftIcon), btn.label, btn.rightIcon && React__default.createElement("span", null, btn.rightIcon)) : React__default.createElement(DropdownMenu, Object.assign({}, btn, {
9888
- key: i
9889
- }), React__default.createElement("button", Object.assign({
9880
+ className: rootClassName$1A + "-btn",
9881
+ type: 'button'
9882
+ }, btn.leftIcon && React__default.createElement("span", null, btn.leftIcon), btn.label, btn.rightIcon && React__default.createElement("span", null, btn.rightIcon)) : React__default.createElement(DropdownMenu, Object.assign({}, btn, {
9890
9883
  key: i
9891
- }, btn.children, {
9884
+ }), React__default.createElement("button", {
9885
+ key: i,
9886
+ id: btn.children.id,
9887
+ onClick: btn.children.onClick,
9892
9888
  className: rootClassName$1A + "-btn",
9893
9889
  disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.children.disabled) || false,
9894
9890
  type: 'button'
9895
- }), btn.children.leftIcon && React__default.createElement("span", null, btn.children.leftIcon), btn.children.label, btn.children.rightIcon && React__default.createElement("span", null, btn.children.rightIcon)));
9891
+ }, btn.children.leftIcon && React__default.createElement("span", null, btn.children.leftIcon), btn.children.label, btn.children.rightIcon && React__default.createElement("span", null, btn.children.rightIcon)));
9896
9892
  })), React__default.createElement("div", {
9897
9893
  className: rootClassName$1A + "-right"
9898
9894
  }, (_props$rightContent = props.rightContent) === null || _props$rightContent === void 0 ? void 0 : _props$rightContent.map(function (btn, i) {
9899
- return btn.type === 'Button' ? React__default.createElement("button", Object.assign({
9900
- key: i
9901
- }, btn, {
9895
+ return btn.type === 'Button' ? React__default.createElement("button", {
9896
+ key: i,
9897
+ id: btn.id,
9898
+ onClick: btn.onClick,
9902
9899
  disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.disabled) || false,
9903
9900
  className: rootClassName$1A + "-btn",
9904
9901
  type: 'button'
9905
- }), btn.leftIcon && React__default.createElement("span", null, btn.leftIcon), btn.label, btn.rightIcon && React__default.createElement("span", null, btn.rightIcon)) : React__default.createElement(DropdownMenu, Object.assign({}, btn), React__default.createElement("button", Object.assign({
9906
- key: i
9907
- }, btn.children, {
9902
+ }, btn.leftIcon && React__default.createElement("span", null, btn.leftIcon), btn.label, btn.rightIcon && React__default.createElement("span", null, btn.rightIcon)) : React__default.createElement(DropdownMenu, Object.assign({}, btn, {
9903
+ key: "children_" + i
9904
+ }), React__default.createElement("button", {
9905
+ key: i,
9906
+ id: btn.children.id,
9907
+ onClick: btn.children.onClick,
9908
9908
  disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.children.disabled) || false,
9909
9909
  className: rootClassName$1A + "-btn",
9910
9910
  type: 'button'
9911
- }), btn.children.leftIcon && React__default.createElement("span", null, btn.children.leftIcon), btn.children.label, btn.children.rightIcon && React__default.createElement("span", null, btn.children.rightIcon)));
9912
- })));
9911
+ }, btn.children.leftIcon && React__default.createElement("span", null, btn.children.leftIcon), btn.children.label, btn.children.rightIcon && React__default.createElement("span", null, btn.children.rightIcon)));
9912
+ })), props.collapsedContent ? React__default.createElement(Collapse$1, {
9913
+ opened: props.opened,
9914
+ animateOpacity: true
9915
+ }, React__default.createElement(Row$1, {
9916
+ className: rootClassName$1A + "-collapsed"
9917
+ }, props.collapsedContent)) : undefined);
9913
9918
  }
9914
9919
 
9915
9920
  var TableUpperHeader$1 = React.memo(TableUpperHeader);
@@ -9921,8 +9926,8 @@ function TableWithOverflow(props) {
9921
9926
 
9922
9927
  var mediaQuery = useScreenSize();
9923
9928
  var wrapperClassName = React.useMemo(function () {
9924
- return getMergedClassNames([rootClassName$1B + "-wrapper", props.hasActionsCol ? 'has-actions-col' : '', props.upperHeader ? 'has-upper-header' : '', 'left-columns-padding']);
9925
- }, [props.hasActionsCol, props.upperHeader]);
9929
+ return getMergedClassNames([rootClassName$1B + "-wrapper", props.upperHeader ? 'has-upper-header' : '', 'left-columns-padding']);
9930
+ }, [props.upperHeader]);
9926
9931
  var outerTableRef = React.createRef();
9927
9932
  useDraggableScroll(outerTableRef, {
9928
9933
  mouseDownCondition: function mouseDownCondition(el) {
@@ -9947,22 +9952,27 @@ function TableWithOverflow(props) {
9947
9952
  }
9948
9953
  };
9949
9954
 
9955
+ var atLeastOneStaticColumn = React.useMemo(function () {
9956
+ return props.columns.some(function (c) {
9957
+ return !c.absolute;
9958
+ });
9959
+ }, [props.columns]);
9950
9960
  var paddingLeft = React.useMemo(function () {
9951
- return props.columns.reduce(function (prev, atual) {
9961
+ return atLeastOneStaticColumn ? props.columns.reduce(function (prev, atual) {
9952
9962
  var _atual$absolute;
9953
9963
 
9954
9964
  var n = (_atual$absolute = atual.absolute) !== null && _atual$absolute !== void 0 && _atual$absolute.left ? parseInt(atual.absolute.width) : 0;
9955
9965
  return prev + n;
9956
- }, 8) + "px";
9957
- }, [props.columns]);
9966
+ }, 8) + "px" : '8px';
9967
+ }, [props.columns, atLeastOneStaticColumn]);
9958
9968
  var paddingRight = React.useMemo(function () {
9959
- return props.columns.reduce(function (prev, atual) {
9969
+ return atLeastOneStaticColumn ? props.columns.reduce(function (prev, atual) {
9960
9970
  var _atual$absolute2;
9961
9971
 
9962
9972
  var n = (_atual$absolute2 = atual.absolute) !== null && _atual$absolute2 !== void 0 && _atual$absolute2.right ? parseInt(atual.absolute.width) : 0;
9963
9973
  return prev + n;
9964
- }, 8) + "px";
9965
- }, [props.columns]);
9974
+ }, 8) + "px" : '8px';
9975
+ }, [props.columns, atLeastOneStaticColumn]);
9966
9976
  return React__default.createElement("div", {
9967
9977
  className: rootClassName$1B
9968
9978
  }, props.upperHeader ? React__default.createElement("div", {
@@ -9993,12 +10003,13 @@ function TableWithOverflow(props) {
9993
10003
  }), (_props$columns = props.columns) === null || _props$columns === void 0 ? void 0 : _props$columns.map(function (column) {
9994
10004
  var _column$props;
9995
10005
 
10006
+ var absoluteObj = atLeastOneStaticColumn && column.absolute ? column.absolute : {};
9996
10007
  return React__default.createElement("th", Object.assign({
9997
10008
  key: "header-" + column.key,
9998
- "data-draggable": !Boolean(column.absolute)
10009
+ "data-draggable": atLeastOneStaticColumn && !Boolean(absoluteObj)
9999
10010
  }, column.props, {
10000
- style: _extends({}, (_column$props = column.props) === null || _column$props === void 0 ? void 0 : _column$props.style, column.absolute),
10001
- className: getMergedClassNames([column.key + "-cell", column.absolute ? 'absolute' : ''])
10011
+ style: _extends({}, (_column$props = column.props) === null || _column$props === void 0 ? void 0 : _column$props.style, absoluteObj),
10012
+ className: getMergedClassNames([column.key + "-cell", atLeastOneStaticColumn && column.absolute ? 'absolute' : ''])
10002
10013
  }), column.value);
10003
10014
  }), React__default.createElement("th", {
10004
10015
  className: 'absolute right-0'
@@ -10014,12 +10025,13 @@ function TableWithOverflow(props) {
10014
10025
  }), (_props$columns2 = props.columns) === null || _props$columns2 === void 0 ? void 0 : _props$columns2.map(function (column) {
10015
10026
  var _column$props2, _column$props3;
10016
10027
 
10028
+ var absoluteObj = atLeastOneStaticColumn && column.absolute ? column.absolute : {};
10017
10029
  return React__default.createElement("td", Object.assign({
10018
- "data-draggable": !Boolean(column.absolute),
10030
+ "data-draggable": atLeastOneStaticColumn && !Boolean(column.absolute),
10019
10031
  key: lineIndex + "-" + column.key
10020
10032
  }, column.props, {
10021
- style: _extends({}, (_column$props2 = column.props) === null || _column$props2 === void 0 ? void 0 : _column$props2.style, column.absolute),
10022
- className: getMergedClassNames([(_column$props3 = column.props) === null || _column$props3 === void 0 ? void 0 : _column$props3.className, column.key + "-cell", column.absolute ? 'absolute' : ''])
10033
+ style: _extends({}, (_column$props2 = column.props) === null || _column$props2 === void 0 ? void 0 : _column$props2.style, absoluteObj),
10034
+ className: getMergedClassNames([(_column$props3 = column.props) === null || _column$props3 === void 0 ? void 0 : _column$props3.className, column.key + "-cell", atLeastOneStaticColumn && column.absolute ? 'absolute' : ''])
10023
10035
  }), line[column.key]);
10024
10036
  }), React__default.createElement("td", {
10025
10037
  className: 'absolute right-0'
@@ -10028,8 +10040,6 @@ function TableWithOverflow(props) {
10028
10040
  }
10029
10041
 
10030
10042
  TableWithOverflow.defaultProps = {
10031
- showArrowControl: true,
10032
- hasActionsCol: true,
10033
10043
  showTopNavigator: true
10034
10044
  };
10035
10045
  var TableWithOverflow$1 = React.memo(TableWithOverflow);