plataforma-fundacao-componentes 2.22.9 → 2.22.14

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.
@@ -1339,26 +1339,32 @@ var CheckboxThemes;
1339
1339
 
1340
1340
  var rootClassName$s = 'component-checkbox';
1341
1341
  function Checkbox(props) {
1342
- var handleClick = function handleClick(evt) {
1343
- if (typeof props.onChange === 'function' && !props.disabled) {
1344
- props.onChange(!props.value);
1345
- evt.stopPropagation();
1346
- }
1347
- };
1342
+ var fProps = useMemo(function () {
1343
+ var handleClick = function handleClick(evt) {
1344
+ if (typeof props.onChange === 'function' && !props.disabled) {
1345
+ props.onChange(!props.value);
1346
+ evt.stopPropagation();
1347
+ }
1348
+ };
1348
1349
 
1349
- var getProps = function getProps() {
1350
1350
  var p = _extends({}, props, {
1351
1351
  className: getMergedClassNames([rootClassName$s, rootClassName$s + "-" + props.theme, rootClassName$s + "-" + (props.value ? 'checked' : 'not')]),
1352
+ 'aria-disabled': props.disabled || props['aria-disabled'],
1352
1353
  onClick: handleClick
1353
1354
  });
1354
1355
 
1355
1356
  delete p.value;
1357
+ delete p.tag;
1356
1358
  delete p.onChange;
1357
1359
  delete p.theme;
1358
1360
  return p;
1359
- };
1361
+ }, [props]);
1360
1362
 
1361
- return React.createElement("button", Object.assign({}, getProps()));
1363
+ if (props.tag === 'div') {
1364
+ return React.createElement("div", Object.assign({}, fProps));
1365
+ }
1366
+
1367
+ return React.createElement("button", Object.assign({}, fProps));
1362
1368
  }
1363
1369
  Checkbox.defaultProps = {
1364
1370
  disabled: false,
@@ -4409,6 +4415,7 @@ function DropdownItem(props) {
4409
4415
  return React.createElement("button", {
4410
4416
  id: props.id,
4411
4417
  disabled: props.disabled,
4418
+ "aria-disabled": props.disabled,
4412
4419
  className: getMergedClassNames([rootClassName$R, props.alignRight ? 'align-right' : '']),
4413
4420
  onClick: function onClick(evt) {
4414
4421
  if (typeof props.onClick === 'function' && !props.disabled) {
@@ -4457,19 +4464,19 @@ function DropdownMenu(props) {
4457
4464
  var windowWidth = window.innerWidth;
4458
4465
 
4459
4466
  if (pontoCentralX < windowWidth / 2) {
4467
+ painel.style.left = bound.x + "px";
4468
+
4460
4469
  if (pontoCentralY < windowHeight / 2) {
4461
- painel.style.left = bound.x + "px";
4462
4470
  painel.style.top = bound.y + bound.height + "px";
4463
4471
  } else {
4464
- painel.style.left = bound.x + "px";
4465
4472
  painel.style.top = bound.y - painel.getBoundingClientRect().height + "px";
4466
4473
  }
4467
4474
  } else {
4475
+ painel.style.right = windowWidth - bound.x - bound.width + "px";
4476
+
4468
4477
  if (pontoCentralY < windowHeight / 2) {
4469
- painel.style.right = windowWidth - bound.x - bound.width + "px";
4470
4478
  painel.style.top = bound.y + bound.height + "px";
4471
4479
  } else {
4472
- painel.style.right = windowWidth - bound.x - bound.width + "px";
4473
4480
  painel.style.top = bound.y - painel.getBoundingClientRect().height + "px";
4474
4481
  }
4475
4482
  }
@@ -4499,7 +4506,7 @@ function DropdownMenu(props) {
4499
4506
  var deveFechar = true;
4500
4507
 
4501
4508
  while (aux && aux.id !== 'root') {
4502
- if (aux && aux.id && aux.id === id && aux.classList.contains("" + rootClassName$S)) {
4509
+ if (aux && aux.id && aux.id === id && aux.classList.contains(rootClassName$S)) {
4503
4510
  deveFechar = false;
4504
4511
  break;
4505
4512
  }
@@ -4563,7 +4570,7 @@ function DropdownMenu(props) {
4563
4570
  classNames: rootClassName$S + "-panel-fade",
4564
4571
  unmountOnExit: true
4565
4572
  }, React.createElement("div", {
4566
- className: rootClassName$S + "-panel"
4573
+ className: rootClassName$S + "-panel scroll-white"
4567
4574
  }, props.content)));
4568
4575
  }
4569
4576
  DropdownMenu.defaultProps = {
@@ -9776,7 +9783,7 @@ var CircleArrowLeft = function CircleArrowLeft() {
9776
9783
  }))));
9777
9784
  };
9778
9785
 
9779
- function useDraggableScroll(reference) {
9786
+ function useDraggableScroll(reference, options) {
9780
9787
  useEffect(function () {
9781
9788
  var element = reference.current;
9782
9789
  var pos = {
@@ -9786,6 +9793,10 @@ function useDraggableScroll(reference) {
9786
9793
  var moving = false;
9787
9794
 
9788
9795
  var mouseDownHandler = function mouseDownHandler(evt) {
9796
+ if (options && typeof options.mouseDownCondition === 'function' && !options.mouseDownCondition(evt.target)) {
9797
+ return;
9798
+ }
9799
+
9789
9800
  if (evt.button === 0 && (element === null || element === void 0 ? void 0 : element.scrollWidth) > (element === null || element === void 0 ? void 0 : element.clientWidth)) {
9790
9801
  moving = true;
9791
9802
  pos = {
@@ -9818,6 +9829,58 @@ function useDraggableScroll(reference) {
9818
9829
  }, [reference]);
9819
9830
  }
9820
9831
 
9832
+ var ScreenSize;
9833
+
9834
+ (function (ScreenSize) {
9835
+ ScreenSize["xs"] = "xs";
9836
+ ScreenSize["sm"] = "sm";
9837
+ ScreenSize["md"] = "md";
9838
+ ScreenSize["lg"] = "lg";
9839
+ ScreenSize["xl"] = "xl";
9840
+ })(ScreenSize || (ScreenSize = {}));
9841
+
9842
+ function useScreenSize() {
9843
+ var _useState = useState(),
9844
+ value = _useState[0],
9845
+ setValue = _useState[1];
9846
+
9847
+ var valueRef = useRef(value);
9848
+ valueRef.current = value;
9849
+
9850
+ var f = function f() {
9851
+ if (window.innerWidth <= 575.98) {
9852
+ if (valueRef.current !== ScreenSize.xs) {
9853
+ setValue(ScreenSize.xs);
9854
+ }
9855
+ } else if (window.innerWidth <= 767.98) {
9856
+ if (valueRef.current !== ScreenSize.sm) {
9857
+ setValue(ScreenSize.sm);
9858
+ }
9859
+ } else if (window.innerWidth <= 991.98) {
9860
+ if (valueRef.current !== ScreenSize.md) {
9861
+ setValue(ScreenSize.md);
9862
+ }
9863
+ } else if (window.innerWidth <= 1199.98) {
9864
+ if (valueRef.current !== ScreenSize.lg) {
9865
+ setValue(ScreenSize.lg);
9866
+ }
9867
+ } else if (window.innerWidth > 1199.98) {
9868
+ if (valueRef.current !== ScreenSize.xl) {
9869
+ setValue(ScreenSize.xl);
9870
+ }
9871
+ }
9872
+ };
9873
+
9874
+ useLayoutEffect(function () {
9875
+ f();
9876
+ window.addEventListener('resize', f);
9877
+ return function () {
9878
+ window.removeEventListener('resize', f);
9879
+ };
9880
+ }, []);
9881
+ return value;
9882
+ }
9883
+
9821
9884
  var rootClassName$1A = 'component-upper-header-table';
9822
9885
 
9823
9886
  function TableUpperHeader(props) {
@@ -9828,19 +9891,37 @@ function TableUpperHeader(props) {
9828
9891
  }, React.createElement("div", {
9829
9892
  className: rootClassName$1A + "-left"
9830
9893
  }, (_props$leftContent = props.leftContent) === null || _props$leftContent === void 0 ? void 0 : _props$leftContent.map(function (btn, i) {
9831
- return React.createElement("button", Object.assign({
9894
+ return btn.type === 'Button' ? React.createElement("button", Object.assign({
9832
9895
  key: i
9833
9896
  }, btn, {
9834
- disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.disabled) || false
9835
- }), btn.leftIcon && React.createElement("span", null, btn.leftIcon), btn.label, btn.rightIcon && React.createElement("span", null, btn.rightIcon));
9897
+ disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.disabled) || false,
9898
+ type: 'button',
9899
+ className: rootClassName$1A + "-btn"
9900
+ }), btn.leftIcon && React.createElement("span", null, btn.leftIcon), btn.label, btn.rightIcon && React.createElement("span", null, btn.rightIcon)) : React.createElement(DropdownMenu, Object.assign({}, btn, {
9901
+ key: i
9902
+ }), React.createElement("button", Object.assign({
9903
+ key: i
9904
+ }, btn.children, {
9905
+ className: rootClassName$1A + "-btn",
9906
+ disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.children.disabled) || false,
9907
+ type: 'button'
9908
+ }), btn.children.leftIcon && React.createElement("span", null, btn.children.leftIcon), btn.children.label, btn.children.rightIcon && React.createElement("span", null, btn.children.rightIcon)));
9836
9909
  })), React.createElement("div", {
9837
9910
  className: rootClassName$1A + "-right"
9838
9911
  }, (_props$rightContent = props.rightContent) === null || _props$rightContent === void 0 ? void 0 : _props$rightContent.map(function (btn, i) {
9839
- return React.createElement("button", Object.assign({
9912
+ return btn.type === 'Button' ? React.createElement("button", Object.assign({
9840
9913
  key: i
9841
9914
  }, btn, {
9842
- disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.disabled) || false
9843
- }), btn.leftIcon && React.createElement("span", null, btn.leftIcon), btn.label, btn.rightIcon && React.createElement("span", null, btn.rightIcon));
9915
+ disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.disabled) || false,
9916
+ className: rootClassName$1A + "-btn",
9917
+ type: 'button'
9918
+ }), btn.leftIcon && React.createElement("span", null, btn.leftIcon), btn.label, btn.rightIcon && React.createElement("span", null, btn.rightIcon)) : React.createElement(DropdownMenu, Object.assign({}, btn), React.createElement("button", Object.assign({
9919
+ key: i
9920
+ }, btn.children, {
9921
+ disabled: !props.active || (btn === null || btn === void 0 ? void 0 : btn.children.disabled) || false,
9922
+ className: rootClassName$1A + "-btn",
9923
+ type: 'button'
9924
+ }), btn.children.leftIcon && React.createElement("span", null, btn.children.leftIcon), btn.children.label, btn.children.rightIcon && React.createElement("span", null, btn.children.rightIcon)));
9844
9925
  })));
9845
9926
  }
9846
9927
 
@@ -9851,11 +9932,16 @@ var rootClassName$1B = 'component-table-with-overflow';
9851
9932
  function TableWithOverflow(props) {
9852
9933
  var _props$columns, _props$lines;
9853
9934
 
9935
+ var mediaQuery = useScreenSize();
9854
9936
  var wrapperClassName = useMemo(function () {
9855
9937
  return getMergedClassNames([rootClassName$1B + "-wrapper", props.hasActionsCol ? 'has-actions-col' : '', props.upperHeader ? 'has-upper-header' : '', 'left-columns-padding']);
9856
9938
  }, [props.hasActionsCol, props.upperHeader]);
9857
9939
  var outerTableRef = createRef();
9858
- useDraggableScroll(outerTableRef);
9940
+ useDraggableScroll(outerTableRef, {
9941
+ mouseDownCondition: function mouseDownCondition(el) {
9942
+ return ['xl', 'lg', 'md'].includes(mediaQuery) && el.hasAttribute('data-draggable') && el.getAttribute('data-draggable') === 'true';
9943
+ }
9944
+ });
9859
9945
 
9860
9946
  var handleArrowClick = function handleArrowClick(toAdd) {
9861
9947
  if (toAdd === void 0) {
@@ -9921,7 +10007,8 @@ function TableWithOverflow(props) {
9921
10007
  var _column$props;
9922
10008
 
9923
10009
  return React.createElement("th", Object.assign({
9924
- key: "header-" + column.key
10010
+ key: "header-" + column.key,
10011
+ "data-draggable": !Boolean(column.absolute)
9925
10012
  }, column.props, {
9926
10013
  style: _extends({}, (_column$props = column.props) === null || _column$props === void 0 ? void 0 : _column$props.style, column.absolute),
9927
10014
  className: getMergedClassNames([column.key + "-cell", column.absolute ? 'absolute' : ''])
@@ -11523,58 +11610,6 @@ function useModalManager() {
11523
11610
  }))), openModal, closeModal];
11524
11611
  }
11525
11612
 
11526
- var ScreenSize;
11527
-
11528
- (function (ScreenSize) {
11529
- ScreenSize["xs"] = "xs";
11530
- ScreenSize["sm"] = "sm";
11531
- ScreenSize["md"] = "md";
11532
- ScreenSize["lg"] = "lg";
11533
- ScreenSize["xl"] = "xl";
11534
- })(ScreenSize || (ScreenSize = {}));
11535
-
11536
- function useScreenSize() {
11537
- var _useState = useState(),
11538
- value = _useState[0],
11539
- setValue = _useState[1];
11540
-
11541
- var valueRef = useRef(value);
11542
- valueRef.current = value;
11543
-
11544
- var f = function f() {
11545
- if (window.innerWidth <= 575.98) {
11546
- if (valueRef.current !== ScreenSize.xs) {
11547
- setValue(ScreenSize.xs);
11548
- }
11549
- } else if (window.innerWidth <= 767.98) {
11550
- if (valueRef.current !== ScreenSize.sm) {
11551
- setValue(ScreenSize.sm);
11552
- }
11553
- } else if (window.innerWidth <= 991.98) {
11554
- if (valueRef.current !== ScreenSize.md) {
11555
- setValue(ScreenSize.md);
11556
- }
11557
- } else if (window.innerWidth <= 1199.98) {
11558
- if (valueRef.current !== ScreenSize.lg) {
11559
- setValue(ScreenSize.lg);
11560
- }
11561
- } else if (window.innerWidth > 1199.98) {
11562
- if (valueRef.current !== ScreenSize.xl) {
11563
- setValue(ScreenSize.xl);
11564
- }
11565
- }
11566
- };
11567
-
11568
- useLayoutEffect(function () {
11569
- f();
11570
- window.addEventListener('resize', f);
11571
- return function () {
11572
- window.removeEventListener('resize', f);
11573
- };
11574
- }, []);
11575
- return value;
11576
- }
11577
-
11578
11613
  var rootClassName$22 = 'comp-toast-manager';
11579
11614
  var count$1 = 0;
11580
11615
  function useToastManager(props) {