plataforma-fundacao-componentes 2.22.10 → 2.22.13

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.
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import './Icon.scss';
3
+ export declare const FilterIcon: () => JSX.Element;
@@ -9,6 +9,7 @@ export interface CheckboxProps {
9
9
  value?: boolean;
10
10
  onChange?: (value: boolean) => void;
11
11
  theme?: CheckboxThemes;
12
+ tag?: 'button' | 'div';
12
13
  }
13
14
  declare function Checkbox(props: CheckboxProps): JSX.Element;
14
15
  declare namespace Checkbox {
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import './DropdownItem.scss';
3
3
  interface DropdownItemProps {
4
4
  id?: string;
5
- icon?: object;
5
+ icon?: ReactNode;
6
6
  label?: string;
7
7
  disabled?: boolean;
8
8
  onClick?: (event?: any) => void;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import './DropdownMenu.scss';
3
- interface DropdownMenuProps {
3
+ export interface DropdownMenuProps {
4
4
  id?: string;
5
5
  opened?: boolean;
6
6
  setOpened: (evt?: any) => void;
@@ -1,17 +1,23 @@
1
1
  import React from 'react';
2
+ import { DropdownMenuProps } from '../../../dropdownMenu/DropdownMenu';
2
3
  import './TableUpperHeader.scss';
3
- declare type upperHeaderButtonType = {
4
+ interface upperHeaderButtonType {
5
+ type: 'Button';
4
6
  id?: string;
5
7
  onClick?: () => void;
6
8
  label?: string;
7
9
  leftIcon?: JSX.Element | React.ReactNode;
8
10
  rightIcon?: JSX.Element | React.ReactNode;
9
11
  disabled?: boolean;
10
- };
12
+ }
13
+ export interface upperHeaderDropdownMenuType extends DropdownMenuProps {
14
+ type: 'DropdownMenu';
15
+ children: upperHeaderButtonType;
16
+ }
11
17
  export interface TableUpperHeaderProps {
12
18
  active?: boolean;
13
- leftContent?: upperHeaderButtonType[];
14
- rightContent?: upperHeaderButtonType[];
19
+ leftContent?: (upperHeaderButtonType | upperHeaderDropdownMenuType)[];
20
+ rightContent?: (upperHeaderButtonType | upperHeaderDropdownMenuType)[];
15
21
  }
16
22
  declare function TableUpperHeader(props: TableUpperHeaderProps): JSX.Element;
17
23
  declare const _default: React.MemoExoticComponent<typeof TableUpperHeader>;
@@ -4,7 +4,7 @@ import './TableWithOverflow.scss';
4
4
  interface TableCell extends React.HTMLAttributes<HTMLTableCellElement> {
5
5
  align?: 'left' | 'center' | 'right' | 'justify' | 'char';
6
6
  }
7
- declare type ColumnObject = {
7
+ export declare type ColumnObject = {
8
8
  key: string;
9
9
  props?: TableCell;
10
10
  value: any;
@@ -5,3 +5,4 @@ declare const _default: {
5
5
  export default _default;
6
6
  export declare const Primary: () => JSX.Element;
7
7
  export declare const UpperHeader: () => JSX.Element;
8
+ export declare const UpperHeaderWithColumnFilter: () => JSX.Element;
@@ -1,2 +1,4 @@
1
1
  import React from 'react';
2
- export default function useDraggableScroll<T extends HTMLElement>(reference: React.RefObject<T>): void;
2
+ export default function useDraggableScroll<T extends HTMLElement>(reference: React.RefObject<T>, options?: {
3
+ mouseDownCondition: (target: HTMLElement) => boolean;
4
+ }): void;
package/dist/index.css CHANGED
@@ -3861,12 +3861,12 @@ h5 {
3861
3861
  justify-content: center;
3862
3862
  align-items: center;
3863
3863
  transition: background-color 0.3s ease, opacity 0.3s ease; }
3864
- .component-checkbox:not(:disabled) {
3864
+ .component-checkbox:not(:disabled), .component-checkbox:not(.component-checkbox[aria-disabled='true']) {
3865
3865
  cursor: pointer; }
3866
3866
  .component-checkbox:focus {
3867
3867
  outline: none; }
3868
3868
 
3869
- .component-checkbox-primary:disabled {
3869
+ .component-checkbox-primary:disabled, .component-checkbox-primary[aria-disabled='true'] {
3870
3870
  opacity: 0.6; }
3871
3871
 
3872
3872
  .component-checkbox-primary.component-checkbox-not {
@@ -3875,7 +3875,7 @@ h5 {
3875
3875
  .component-checkbox-primary.component-checkbox-checked {
3876
3876
  background-color: #3fa110; }
3877
3877
 
3878
- .component-checkbox-dark:disabled {
3878
+ .component-checkbox-dark:disabled, .component-checkbox-dark[aria-disabled='true'] {
3879
3879
  opacity: 0.6; }
3880
3880
 
3881
3881
  .component-checkbox-dark.component-checkbox-not {
@@ -3884,7 +3884,7 @@ h5 {
3884
3884
  .component-checkbox-dark.component-checkbox-checked {
3885
3885
  background-color: #323c32; }
3886
3886
 
3887
- .component-checkbox-blue:disabled {
3887
+ .component-checkbox-blue:disabled, .component-checkbox-blue[aria-disabled='true'] {
3888
3888
  opacity: 0.6; }
3889
3889
 
3890
3890
  .component-checkbox-blue.component-checkbox-not {
@@ -3904,9 +3904,9 @@ h5 {
3904
3904
  height: 10px;
3905
3905
  background-color: rgba(0, 0, 0, 0);
3906
3906
  transition: background-color 0.3s ease; }
3907
- .component-checkbox-classic:disabled {
3907
+ .component-checkbox-classic:disabled, .component-checkbox-classic[aria-disabled='true'] {
3908
3908
  border-color: #828a82; }
3909
- .component-checkbox-classic:disabled.component-checkbox-checked::after {
3909
+ .component-checkbox-classic:disabled.component-checkbox-checked::after, .component-checkbox-classic[aria-disabled='true'].component-checkbox-checked::after {
3910
3910
  background-color: #828a82; }
3911
3911
  .component-checkbox-classic.component-checkbox-checked::after {
3912
3912
  background-color: #3fa110; }
@@ -15248,7 +15248,7 @@ h5 {
15248
15248
  background-color: #cdd3cd;
15249
15249
  color: #828a82;
15250
15250
  border-color: #828a82; }
15251
- .component-upper-header-table button {
15251
+ .component-upper-header-table .component-upper-header-table-btn {
15252
15252
  font-size: 16px;
15253
15253
  color: #828a82;
15254
15254
  border-color: #828a82;
@@ -15261,26 +15261,26 @@ h5 {
15261
15261
  align-items: center;
15262
15262
  justify-content: flex-start;
15263
15263
  background-color: rgba(0, 0, 0, 0); }
15264
- .component-upper-header-table button:not(:disabled) {
15264
+ .component-upper-header-table .component-upper-header-table-btn:not(:disabled) {
15265
15265
  cursor: pointer; }
15266
- .component-upper-header-table button:not(:disabled):active {
15266
+ .component-upper-header-table .component-upper-header-table-btn:not(:disabled):active {
15267
15267
  transform: scale(0.95, 0.9); }
15268
- .component-upper-header-table button span {
15268
+ .component-upper-header-table .component-upper-header-table-btn span {
15269
15269
  display: flex;
15270
15270
  align-items: center;
15271
15271
  justify-content: center; }
15272
- .component-upper-header-table button span:first-child {
15272
+ .component-upper-header-table .component-upper-header-table-btn span:first-child {
15273
15273
  padding-right: 8px; }
15274
- .component-upper-header-table button span:last-child {
15274
+ .component-upper-header-table .component-upper-header-table-btn span:last-child {
15275
15275
  padding-left: 8px; }
15276
- .component-upper-header-table button span svg {
15276
+ .component-upper-header-table .component-upper-header-table-btn span svg {
15277
15277
  max-width: 20px !important;
15278
15278
  max-height: 20px !important; }
15279
15279
  .component-upper-header-table.active {
15280
15280
  background-color: #d7e6c8;
15281
15281
  color: #3fa110;
15282
15282
  border-color: #3fa110; }
15283
- .component-upper-header-table.active button {
15283
+ .component-upper-header-table.active .component-upper-header-table-btn:not(:disabled) {
15284
15284
  background-color: #d7e6c8;
15285
15285
  color: #3fa110; }
15286
15286
  .component-upper-header-table .component-upper-header-table-left {
package/dist/index.js CHANGED
@@ -1336,26 +1336,32 @@ var TrashIcon = function TrashIcon() {
1336
1336
 
1337
1337
  var rootClassName$s = 'component-checkbox';
1338
1338
  function Checkbox(props) {
1339
- var handleClick = function handleClick(evt) {
1340
- if (typeof props.onChange === 'function' && !props.disabled) {
1341
- props.onChange(!props.value);
1342
- evt.stopPropagation();
1343
- }
1344
- };
1339
+ var fProps = React.useMemo(function () {
1340
+ var handleClick = function handleClick(evt) {
1341
+ if (typeof props.onChange === 'function' && !props.disabled) {
1342
+ props.onChange(!props.value);
1343
+ evt.stopPropagation();
1344
+ }
1345
+ };
1345
1346
 
1346
- var getProps = function getProps() {
1347
1347
  var p = _extends({}, props, {
1348
1348
  className: getMergedClassNames([rootClassName$s, rootClassName$s + "-" + props.theme, rootClassName$s + "-" + (props.value ? 'checked' : 'not')]),
1349
+ 'aria-disabled': props.disabled || props['aria-disabled'],
1349
1350
  onClick: handleClick
1350
1351
  });
1351
1352
 
1352
1353
  delete p.value;
1354
+ delete p.tag;
1353
1355
  delete p.onChange;
1354
1356
  delete p.theme;
1355
1357
  return p;
1356
- };
1358
+ }, [props]);
1357
1359
 
1358
- return React__default.createElement("button", Object.assign({}, getProps()));
1360
+ if (props.tag === 'div') {
1361
+ return React__default.createElement("div", Object.assign({}, fProps));
1362
+ }
1363
+
1364
+ return React__default.createElement("button", Object.assign({}, fProps));
1359
1365
  }
1360
1366
  Checkbox.defaultProps = {
1361
1367
  disabled: false,
@@ -4396,6 +4402,7 @@ function DropdownItem(props) {
4396
4402
  return React__default.createElement("button", {
4397
4403
  id: props.id,
4398
4404
  disabled: props.disabled,
4405
+ "aria-disabled": props.disabled,
4399
4406
  className: getMergedClassNames([rootClassName$R, props.alignRight ? 'align-right' : '']),
4400
4407
  onClick: function onClick(evt) {
4401
4408
  if (typeof props.onClick === 'function' && !props.disabled) {
@@ -4443,6 +4450,12 @@ function DropdownMenu(props) {
4443
4450
  var windowHeight = window.innerHeight;
4444
4451
  var windowWidth = window.innerWidth;
4445
4452
 
4453
+ if (painel.getBoundingClientRect().height > windowHeight) {
4454
+ painel.style.overflowY = 'overlay';
4455
+ } else {
4456
+ painel.style.overflowY = '';
4457
+ }
4458
+
4446
4459
  if (pontoCentralX < windowWidth / 2) {
4447
4460
  if (pontoCentralY < windowHeight / 2) {
4448
4461
  painel.style.left = bound.x + "px";
@@ -4486,7 +4499,7 @@ function DropdownMenu(props) {
4486
4499
  var deveFechar = true;
4487
4500
 
4488
4501
  while (aux && aux.id !== 'root') {
4489
- if (aux && aux.id && aux.id === id && aux.classList.contains("" + rootClassName$S)) {
4502
+ if (aux && aux.id && aux.id === id && aux.classList.contains(rootClassName$S)) {
4490
4503
  deveFechar = false;
4491
4504
  break;
4492
4505
  }
@@ -9757,7 +9770,7 @@ var CircleArrowLeft = function CircleArrowLeft() {
9757
9770
  }))));
9758
9771
  };
9759
9772
 
9760
- function useDraggableScroll(reference) {
9773
+ function useDraggableScroll(reference, options) {
9761
9774
  React.useEffect(function () {
9762
9775
  var element = reference.current;
9763
9776
  var pos = {
@@ -9767,6 +9780,10 @@ function useDraggableScroll(reference) {
9767
9780
  var moving = false;
9768
9781
 
9769
9782
  var mouseDownHandler = function mouseDownHandler(evt) {
9783
+ if (options && typeof options.mouseDownCondition === 'function' && !options.mouseDownCondition(evt.target)) {
9784
+ return;
9785
+ }
9786
+
9770
9787
  if (evt.button === 0 && (element === null || element === void 0 ? void 0 : element.scrollWidth) > (element === null || element === void 0 ? void 0 : element.clientWidth)) {
9771
9788
  moving = true;
9772
9789
  pos = {
@@ -9799,6 +9816,58 @@ function useDraggableScroll(reference) {
9799
9816
  }, [reference]);
9800
9817
  }
9801
9818
 
9819
+ var ScreenSize;
9820
+
9821
+ (function (ScreenSize) {
9822
+ ScreenSize["xs"] = "xs";
9823
+ ScreenSize["sm"] = "sm";
9824
+ ScreenSize["md"] = "md";
9825
+ ScreenSize["lg"] = "lg";
9826
+ ScreenSize["xl"] = "xl";
9827
+ })(ScreenSize || (ScreenSize = {}));
9828
+
9829
+ function useScreenSize() {
9830
+ var _useState = React.useState(),
9831
+ value = _useState[0],
9832
+ setValue = _useState[1];
9833
+
9834
+ var valueRef = React.useRef(value);
9835
+ valueRef.current = value;
9836
+
9837
+ var f = function f() {
9838
+ if (window.innerWidth <= 575.98) {
9839
+ if (valueRef.current !== ScreenSize.xs) {
9840
+ setValue(ScreenSize.xs);
9841
+ }
9842
+ } else if (window.innerWidth <= 767.98) {
9843
+ if (valueRef.current !== ScreenSize.sm) {
9844
+ setValue(ScreenSize.sm);
9845
+ }
9846
+ } else if (window.innerWidth <= 991.98) {
9847
+ if (valueRef.current !== ScreenSize.md) {
9848
+ setValue(ScreenSize.md);
9849
+ }
9850
+ } else if (window.innerWidth <= 1199.98) {
9851
+ if (valueRef.current !== ScreenSize.lg) {
9852
+ setValue(ScreenSize.lg);
9853
+ }
9854
+ } else if (window.innerWidth > 1199.98) {
9855
+ if (valueRef.current !== ScreenSize.xl) {
9856
+ setValue(ScreenSize.xl);
9857
+ }
9858
+ }
9859
+ };
9860
+
9861
+ React.useLayoutEffect(function () {
9862
+ f();
9863
+ window.addEventListener('resize', f);
9864
+ return function () {
9865
+ window.removeEventListener('resize', f);
9866
+ };
9867
+ }, []);
9868
+ return value;
9869
+ }
9870
+
9802
9871
  var rootClassName$1A = 'component-upper-header-table';
9803
9872
 
9804
9873
  function TableUpperHeader(props) {
@@ -9809,19 +9878,37 @@ function TableUpperHeader(props) {
9809
9878
  }, React__default.createElement("div", {
9810
9879
  className: rootClassName$1A + "-left"
9811
9880
  }, (_props$leftContent = props.leftContent) === null || _props$leftContent === void 0 ? void 0 : _props$leftContent.map(function (btn, i) {
9812
- return React__default.createElement("button", Object.assign({
9881
+ return btn.type === 'Button' ? React__default.createElement("button", Object.assign({
9813
9882
  key: i
9814
9883
  }, btn, {
9815
- disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.disabled) || false
9816
- }), btn.leftIcon && React__default.createElement("span", null, btn.leftIcon), btn.label, btn.rightIcon && React__default.createElement("span", null, btn.rightIcon));
9884
+ 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({
9890
+ key: i
9891
+ }, btn.children, {
9892
+ className: rootClassName$1A + "-btn",
9893
+ disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.children.disabled) || false,
9894
+ 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)));
9817
9896
  })), React__default.createElement("div", {
9818
9897
  className: rootClassName$1A + "-right"
9819
9898
  }, (_props$rightContent = props.rightContent) === null || _props$rightContent === void 0 ? void 0 : _props$rightContent.map(function (btn, i) {
9820
- return React__default.createElement("button", Object.assign({
9899
+ return btn.type === 'Button' ? React__default.createElement("button", Object.assign({
9821
9900
  key: i
9822
9901
  }, btn, {
9823
- disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.disabled) || false
9824
- }), btn.leftIcon && React__default.createElement("span", null, btn.leftIcon), btn.label, btn.rightIcon && React__default.createElement("span", null, btn.rightIcon));
9902
+ disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.disabled) || false,
9903
+ className: rootClassName$1A + "-btn",
9904
+ 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, {
9908
+ disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.children.disabled) || false,
9909
+ className: rootClassName$1A + "-btn",
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)));
9825
9912
  })));
9826
9913
  }
9827
9914
 
@@ -9832,11 +9919,16 @@ var rootClassName$1B = 'component-table-with-overflow';
9832
9919
  function TableWithOverflow(props) {
9833
9920
  var _props$columns, _props$lines;
9834
9921
 
9922
+ var mediaQuery = useScreenSize();
9835
9923
  var wrapperClassName = React.useMemo(function () {
9836
9924
  return getMergedClassNames([rootClassName$1B + "-wrapper", props.hasActionsCol ? 'has-actions-col' : '', props.upperHeader ? 'has-upper-header' : '', 'left-columns-padding']);
9837
9925
  }, [props.hasActionsCol, props.upperHeader]);
9838
9926
  var outerTableRef = React.createRef();
9839
- useDraggableScroll(outerTableRef);
9927
+ useDraggableScroll(outerTableRef, {
9928
+ mouseDownCondition: function mouseDownCondition(el) {
9929
+ return ['xl', 'lg', 'md'].includes(mediaQuery) && el.hasAttribute('data-draggable') && el.getAttribute('data-draggable') === 'true';
9930
+ }
9931
+ });
9840
9932
 
9841
9933
  var handleArrowClick = function handleArrowClick(toAdd) {
9842
9934
  if (toAdd === void 0) {
@@ -11501,58 +11593,6 @@ function useModalManager() {
11501
11593
  }))), openModal, closeModal];
11502
11594
  }
11503
11595
 
11504
- var ScreenSize;
11505
-
11506
- (function (ScreenSize) {
11507
- ScreenSize["xs"] = "xs";
11508
- ScreenSize["sm"] = "sm";
11509
- ScreenSize["md"] = "md";
11510
- ScreenSize["lg"] = "lg";
11511
- ScreenSize["xl"] = "xl";
11512
- })(ScreenSize || (ScreenSize = {}));
11513
-
11514
- function useScreenSize() {
11515
- var _useState = React.useState(),
11516
- value = _useState[0],
11517
- setValue = _useState[1];
11518
-
11519
- var valueRef = React.useRef(value);
11520
- valueRef.current = value;
11521
-
11522
- var f = function f() {
11523
- if (window.innerWidth <= 575.98) {
11524
- if (valueRef.current !== ScreenSize.xs) {
11525
- setValue(ScreenSize.xs);
11526
- }
11527
- } else if (window.innerWidth <= 767.98) {
11528
- if (valueRef.current !== ScreenSize.sm) {
11529
- setValue(ScreenSize.sm);
11530
- }
11531
- } else if (window.innerWidth <= 991.98) {
11532
- if (valueRef.current !== ScreenSize.md) {
11533
- setValue(ScreenSize.md);
11534
- }
11535
- } else if (window.innerWidth <= 1199.98) {
11536
- if (valueRef.current !== ScreenSize.lg) {
11537
- setValue(ScreenSize.lg);
11538
- }
11539
- } else if (window.innerWidth > 1199.98) {
11540
- if (valueRef.current !== ScreenSize.xl) {
11541
- setValue(ScreenSize.xl);
11542
- }
11543
- }
11544
- };
11545
-
11546
- React.useLayoutEffect(function () {
11547
- f();
11548
- window.addEventListener('resize', f);
11549
- return function () {
11550
- window.removeEventListener('resize', f);
11551
- };
11552
- }, []);
11553
- return value;
11554
- }
11555
-
11556
11596
  var rootClassName$22 = 'comp-toast-manager';
11557
11597
  var count$1 = 0;
11558
11598
  function useToastManager(props) {