plataforma-fundacao-componentes 2.25.9 → 2.25.10

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.
@@ -11,11 +11,11 @@ export declare type ButtonFileUploadProps = {
11
11
  disabled?: boolean;
12
12
  onTypeNotAllowed?: () => void;
13
13
  buttonProps?: Omit<ButtonProps, 'theme' | 'onClick' | 'disabled' | 'leftIcon' | 'w100' | 'children'> & {
14
- 'data-testid': string;
14
+ 'data-testid'?: string;
15
15
  };
16
16
  w100?: boolean;
17
17
  inputProps?: Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'multiple' | 'tabIndex' | 'type' | 'accept' | 'hidden'> & {
18
- 'data-testid': string;
18
+ 'data-testid'?: string;
19
19
  };
20
20
  } & ({
21
21
  multiple: true;
@@ -6,6 +6,7 @@ export interface CheckboxProps {
6
6
  'tooltip-position'?: TooltipPosition;
7
7
  'tooltip-text'?: string;
8
8
  disabled?: boolean;
9
+ 'aria-disabled'?: boolean;
9
10
  value?: boolean;
10
11
  onChange?: (value: boolean, evt: React.MouseEvent<HTMLElement>) => void;
11
12
  theme?: CheckboxThemes;
@@ -1,16 +1,14 @@
1
- import React from 'react';
1
+ import React, { HTMLAttributes } from 'react';
2
2
  import './DropdownMenu.scss';
3
- export interface DropdownMenuProps {
4
- id?: string;
3
+ export interface DropdownMenuProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {
5
4
  opened?: boolean;
6
- setOpened: (evt?: any) => void;
5
+ setOpened: (evt: boolean) => void;
7
6
  content?: React.ReactNode;
8
7
  closeOnOutClick?: boolean;
9
8
  closeOnEsc?: boolean;
10
- className?: string;
11
- children?: any;
9
+ panelProps?: HTMLAttributes<HTMLDivElement>;
12
10
  }
13
- declare function DropdownMenu(props: DropdownMenuProps): React.JSX.Element;
11
+ declare function DropdownMenu({ opened, setOpened, content, closeOnEsc, closeOnOutClick, children, panelProps, ...props }: DropdownMenuProps): React.JSX.Element;
14
12
  declare namespace DropdownMenu {
15
13
  var defaultProps: {
16
14
  closeOnOutClick: boolean;
@@ -10,7 +10,7 @@ interface upperHeaderButtonType {
10
10
  rightIcon?: JSX.Element | React.ReactNode;
11
11
  disabled?: boolean;
12
12
  }
13
- export interface upperHeaderDropdownMenuType extends DropdownMenuProps {
13
+ export interface upperHeaderDropdownMenuType extends Omit<DropdownMenuProps, 'children'> {
14
14
  type: 'DropdownMenu';
15
15
  children: upperHeaderButtonType;
16
16
  }
@@ -1,2 +1,4 @@
1
1
  import { RefObject } from 'react';
2
- export default function useOutsideClick(refs: RefObject<null | HTMLButtonElement | HTMLDivElement | HTMLInputElement | HTMLLabelElement | HTMLParagraphElement | HTMLSpanElement> | Array<RefObject<null | HTMLButtonElement | HTMLDivElement | HTMLInputElement | HTMLLabelElement | HTMLParagraphElement | HTMLSpanElement>>, handler: (isInside: boolean) => void): void;
2
+ export default function useOutsideClick(refs: Array<RefObject<null | HTMLButtonElement | HTMLDivElement | HTMLInputElement | HTMLLabelElement | HTMLParagraphElement | HTMLSpanElement>>, handler: (isInside: boolean) => void, options?: {
3
+ events: (keyof DocumentEventMap)[];
4
+ }): void;
package/dist/index.css CHANGED
@@ -5943,6 +5943,82 @@ h5 {
5943
5943
  warningLight: #ffeb98;
5944
5944
  warningDark: #765f00; }
5945
5945
 
5946
+ .component-chip {
5947
+ font-size: 14px;
5948
+ -webkit-user-select: none;
5949
+ -moz-user-select: none;
5950
+ user-select: none;
5951
+ display: flex;
5952
+ align-items: center;
5953
+ justify-content: space-between;
5954
+ border-radius: 200px;
5955
+ border-width: 1px;
5956
+ border-style: solid;
5957
+ font-weight: 600;
5958
+ transition: all 0.3s ease; }
5959
+ .component-chip span {
5960
+ max-width: calc(100% - 24px);
5961
+ padding-left: 4px;
5962
+ text-overflow: ellipsis;
5963
+ overflow: hidden; }
5964
+ .component-chip.w100 {
5965
+ width: 100%; }
5966
+ .component-chip.all-clickable,
5967
+ .component-chip .component-chip-button {
5968
+ transform: scale(1);
5969
+ transition: transform 0.3s ease;
5970
+ cursor: pointer; }
5971
+ .component-chip.all-clickable:active,
5972
+ .component-chip .component-chip-button:active {
5973
+ transform: scale(0.95); }
5974
+ .component-chip .component-chip-button {
5975
+ display: flex;
5976
+ align-items: center;
5977
+ justify-content: center;
5978
+ padding: 2px; }
5979
+ .component-chip .component-chip-button svg {
5980
+ width: 20px;
5981
+ height: 20px; }
5982
+ .component-chip.primary-outline {
5983
+ color: #3fa110;
5984
+ background-color: rgba(0, 0, 0, 0);
5985
+ border: 1px solid #3fa110; }
5986
+ .component-chip.primary {
5987
+ color: #fefefe;
5988
+ background-color: #3fa110;
5989
+ border: 1px solid #3fa110; }
5990
+ .component-chip.danger {
5991
+ color: #fefefe;
5992
+ background-color: #e60000;
5993
+ border: 1px solid #e60000; }
5994
+
5995
+ :export {
5996
+ widthXs: 575.98px;
5997
+ widthSm: 767.98px;
5998
+ widthMd: 991.98px;
5999
+ widthLg: 1199.98px; }
6000
+
6001
+ :export {
6002
+ white: #fefefe;
6003
+ darkenWhite: #efefef;
6004
+ black: #121212;
6005
+ transparent: rgba(0, 0, 0, 0);
6006
+ primary: #3fa110;
6007
+ primaryDark: #33820d;
6008
+ primaryLight: #d7e6c8;
6009
+ secondaryDarker: #323c32;
6010
+ secondaryDark: #5a645a;
6011
+ blueDarker: #2b517b;
6012
+ secondary: #828a82;
6013
+ secondaryLight: #cdd3cd;
6014
+ secondaryLighter: #f8f9f7;
6015
+ danger: #e60000;
6016
+ dangerLight: #ffb4b4;
6017
+ dangerDark: #ab4745;
6018
+ warning: #ffcd00;
6019
+ warningLight: #ffeb98;
6020
+ warningDark: #765f00; }
6021
+
5946
6022
  .component-search {
5947
6023
  position: relative;
5948
6024
  width: 100%; }
@@ -6038,82 +6114,6 @@ h5 {
6038
6114
  warningLight: #ffeb98;
6039
6115
  warningDark: #765f00; }
6040
6116
 
6041
- .component-chip {
6042
- font-size: 14px;
6043
- -webkit-user-select: none;
6044
- -moz-user-select: none;
6045
- user-select: none;
6046
- display: flex;
6047
- align-items: center;
6048
- justify-content: space-between;
6049
- border-radius: 200px;
6050
- border-width: 1px;
6051
- border-style: solid;
6052
- font-weight: 600;
6053
- transition: all 0.3s ease; }
6054
- .component-chip span {
6055
- max-width: calc(100% - 24px);
6056
- padding-left: 4px;
6057
- text-overflow: ellipsis;
6058
- overflow: hidden; }
6059
- .component-chip.w100 {
6060
- width: 100%; }
6061
- .component-chip.all-clickable,
6062
- .component-chip .component-chip-button {
6063
- transform: scale(1);
6064
- transition: transform 0.3s ease;
6065
- cursor: pointer; }
6066
- .component-chip.all-clickable:active,
6067
- .component-chip .component-chip-button:active {
6068
- transform: scale(0.95); }
6069
- .component-chip .component-chip-button {
6070
- display: flex;
6071
- align-items: center;
6072
- justify-content: center;
6073
- padding: 2px; }
6074
- .component-chip .component-chip-button svg {
6075
- width: 20px;
6076
- height: 20px; }
6077
- .component-chip.primary-outline {
6078
- color: #3fa110;
6079
- background-color: rgba(0, 0, 0, 0);
6080
- border: 1px solid #3fa110; }
6081
- .component-chip.primary {
6082
- color: #fefefe;
6083
- background-color: #3fa110;
6084
- border: 1px solid #3fa110; }
6085
- .component-chip.danger {
6086
- color: #fefefe;
6087
- background-color: #e60000;
6088
- border: 1px solid #e60000; }
6089
-
6090
- :export {
6091
- widthXs: 575.98px;
6092
- widthSm: 767.98px;
6093
- widthMd: 991.98px;
6094
- widthLg: 1199.98px; }
6095
-
6096
- :export {
6097
- white: #fefefe;
6098
- darkenWhite: #efefef;
6099
- black: #121212;
6100
- transparent: rgba(0, 0, 0, 0);
6101
- primary: #3fa110;
6102
- primaryDark: #33820d;
6103
- primaryLight: #d7e6c8;
6104
- secondaryDarker: #323c32;
6105
- secondaryDark: #5a645a;
6106
- blueDarker: #2b517b;
6107
- secondary: #828a82;
6108
- secondaryLight: #cdd3cd;
6109
- secondaryLighter: #f8f9f7;
6110
- danger: #e60000;
6111
- dangerLight: #ffb4b4;
6112
- dangerDark: #ab4745;
6113
- warning: #ffcd00;
6114
- warningLight: #ffeb98;
6115
- warningDark: #765f00; }
6116
-
6117
6117
  .component-select-outer {
6118
6118
  position: relative;
6119
6119
  width: 100%; }
package/dist/index.js CHANGED
@@ -7523,39 +7523,54 @@ function DropdownItem(props) {
7523
7523
  }
7524
7524
  var DropdownItem$1 = React$1.memo(DropdownItem);
7525
7525
 
7526
- function useOutsideClick(refs, handler) {
7526
+ function useOutsideClick(refs, handler, options) {
7527
+ var _options3;
7528
+ if (options === void 0) {
7529
+ options = {
7530
+ events: ['mouseup', 'touchstart']
7531
+ };
7532
+ }
7527
7533
  var handleClickOutside = React$1.useCallback(function (e) {
7528
- if (refs && 'current' in refs && refs.current) {
7529
- var isInside = Array.isArray(refs.current) ? refs.current.some(function (element) {
7530
- return !!element && element.contains(e.target);
7531
- }) : !!refs && !!refs.current && refs.current.contains(e.target);
7532
- handler(isInside);
7533
- } else {
7534
- var _isInside = Array.isArray(refs) && refs.some(function (element) {
7535
- return !!element && !!element.current && element.current.contains(e.target);
7536
- });
7537
- handler(_isInside);
7538
- }
7534
+ var isInside = refs.some(function (r) {
7535
+ return (r === null || r === void 0 ? void 0 : r.current) && r.current.contains(e.target);
7536
+ });
7537
+ handler(isInside);
7539
7538
  }, [handler, refs]);
7540
7539
  React$1.useEffect(function () {
7541
- document.addEventListener('mouseup', handleClickOutside);
7542
- document.addEventListener('touchstart', handleClickOutside);
7540
+ var _options;
7541
+ (_options = options) === null || _options === void 0 ? void 0 : _options.events.forEach(function (evt) {
7542
+ document.addEventListener(evt, handleClickOutside);
7543
+ });
7543
7544
  return function () {
7544
- document.removeEventListener('mouseup', handleClickOutside);
7545
- document.removeEventListener('touchstart', handleClickOutside);
7545
+ var _options2;
7546
+ (_options2 = options) === null || _options2 === void 0 ? void 0 : _options2.events.forEach(function (evt) {
7547
+ document.removeEventListener(evt, handleClickOutside);
7548
+ });
7546
7549
  };
7547
- }, [refs, handler, handleClickOutside]);
7550
+ }, [refs, handler, handleClickOutside, (_options3 = options) === null || _options3 === void 0 ? void 0 : _options3.events]);
7548
7551
  }
7549
7552
 
7553
+ var _excluded = ["opened", "setOpened", "content", "closeOnEsc", "closeOnOutClick", "children", "panelProps"];
7550
7554
  var rootClassName$1Z = 'component-dropdown-menu';
7551
- function DropdownMenu(props) {
7555
+ function DropdownMenu(_ref) {
7556
+ var _panelProps$className;
7557
+ var opened = _ref.opened,
7558
+ setOpened = _ref.setOpened,
7559
+ content = _ref.content,
7560
+ closeOnEsc = _ref.closeOnEsc,
7561
+ closeOnOutClick = _ref.closeOnOutClick,
7562
+ children = _ref.children,
7563
+ _ref$panelProps = _ref.panelProps,
7564
+ panelProps = _ref$panelProps === void 0 ? {} : _ref$panelProps,
7565
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
7552
7566
  var id = React$1.useMemo(function () {
7553
7567
  return props.id ? props.id : getUniqueKey();
7554
7568
  }, [props.id]);
7555
7569
  var _useState = React$1.useState(null),
7556
7570
  inter = _useState[0],
7557
7571
  setInter = _useState[1];
7558
- var panelRef = React$1.useRef(null);
7572
+ var wrapperRef = React$1.createRef();
7573
+ var panelRef = React$1.createRef();
7559
7574
  var interRef = React$1.useRef(inter);
7560
7575
  interRef.current = inter;
7561
7576
  React$1.useEffect(function () {
@@ -7589,7 +7604,7 @@ function DropdownMenu(props) {
7589
7604
  }
7590
7605
  }
7591
7606
  };
7592
- if (props.opened) {
7607
+ if (opened) {
7593
7608
  position();
7594
7609
  var _inter = setInterval(position, 100);
7595
7610
  setInter(_inter);
@@ -7600,20 +7615,20 @@ function DropdownMenu(props) {
7600
7615
  setInter(null);
7601
7616
  }
7602
7617
  };
7603
- }, [props.opened]);
7604
- useOutsideClick([panelRef], function (isInside) {
7605
- if (props.closeOnOutClick && !isInside) {
7606
- props.setOpened(false);
7618
+ }, [opened]);
7619
+ useOutsideClick([wrapperRef], function (isInside) {
7620
+ if (closeOnOutClick && !isInside) {
7621
+ setOpened(false);
7607
7622
  }
7608
7623
  });
7609
7624
  React$1.useEffect(function () {
7610
7625
  var onEscPress = function onEscPress(evt) {
7611
7626
  if (evt.key === 'Escape') {
7612
- props.setOpened(false);
7627
+ setOpened(false);
7613
7628
  }
7614
7629
  };
7615
- if (props.closeOnEsc) {
7616
- if (props.opened) {
7630
+ if (closeOnEsc) {
7631
+ if (opened) {
7617
7632
  document.addEventListener('keyup', onEscPress);
7618
7633
  } else {
7619
7634
  document.removeEventListener('keyup', onEscPress);
@@ -7622,30 +7637,24 @@ function DropdownMenu(props) {
7622
7637
  return function () {
7623
7638
  document.removeEventListener('keyup', onEscPress);
7624
7639
  };
7625
- }, [props.opened]);
7626
- var getProps = function getProps() {
7627
- var p = _extends({}, props, {
7628
- id: id,
7629
- className: getMergedClassNames([rootClassName$1Z, props.className || ''])
7630
- });
7631
- delete p.opened;
7632
- delete p.setOpened;
7633
- delete p.content;
7634
- delete p.closeOnOutClick;
7635
- delete p.closeOnEsc;
7636
- return p;
7637
- };
7638
- return React$1__default.createElement("div", Object.assign({}, getProps()), React$1__default.createElement("div", {
7640
+ }, [opened]);
7641
+ return React$1__default.createElement("div", Object.assign({
7642
+ ref: wrapperRef
7643
+ }, props, {
7644
+ id: id,
7645
+ className: [rootClassName$1Z, props.className || ''].join(' ')
7646
+ }), React$1__default.createElement("div", {
7639
7647
  className: rootClassName$1Z + "-children"
7640
- }, props.children), React$1__default.createElement(reactTransitionGroup.CSSTransition, {
7641
- "in": props.opened,
7648
+ }, children), React$1__default.createElement(reactTransitionGroup.CSSTransition, {
7649
+ "in": opened,
7642
7650
  timeout: 300,
7643
7651
  classNames: rootClassName$1Z + "-panel-fade",
7644
7652
  unmountOnExit: true
7645
- }, React$1__default.createElement("div", {
7646
- ref: panelRef,
7647
- className: rootClassName$1Z + "-panel scroll-white"
7648
- }, props.content)));
7653
+ }, React$1__default.createElement("div", Object.assign({
7654
+ ref: panelRef
7655
+ }, panelProps, {
7656
+ className: [rootClassName$1Z + "-panel scroll-white", (_panelProps$className = panelProps === null || panelProps === void 0 ? void 0 : panelProps.className) != null ? _panelProps$className : ''].join(' ')
7657
+ }), content)));
7649
7658
  }
7650
7659
  DropdownMenu.defaultProps = {
7651
7660
  closeOnOutClick: true,
@@ -9092,7 +9101,7 @@ function Paginator(props) {
9092
9101
  }
9093
9102
  Paginator.defaultProps = {};
9094
9103
 
9095
- var _excluded = ["boundaryCount", "count", "currentPage", "disabled", "hideNextButton", "hidePrevButton", "onChange", "page", "siblingCount", "maxLength"];
9104
+ var _excluded$1 = ["boundaryCount", "count", "currentPage", "disabled", "hideNextButton", "hidePrevButton", "onChange", "page", "siblingCount", "maxLength"];
9096
9105
  function usePagination(props) {
9097
9106
  if (props === void 0) {
9098
9107
  props = {};
@@ -9115,7 +9124,7 @@ function usePagination(props) {
9115
9124
  _props$siblingCount = _props.siblingCount,
9116
9125
  siblingCount = _props$siblingCount === void 0 ? 1 : _props$siblingCount,
9117
9126
  maxLength = _props.maxLength,
9118
- other = _objectWithoutPropertiesLoose(_props, _excluded);
9127
+ other = _objectWithoutPropertiesLoose(_props, _excluded$1);
9119
9128
  var isControlledRef = React$1.useRef(pageProp !== undefined);
9120
9129
  var _useState = React$1.useState(currentPage),
9121
9130
  pageCurrent = _useState[0],
@@ -9254,7 +9263,7 @@ function useScreenSize() {
9254
9263
  return value;
9255
9264
  }
9256
9265
 
9257
- var _excluded$1 = ["page", "type", "selected"];
9266
+ var _excluded$2 = ["page", "type", "selected"];
9258
9267
  var rootClassName$2k = 'pagination-component';
9259
9268
  var Pagination = function Pagination(props) {
9260
9269
  var screenSize = useScreenSize();
@@ -9378,7 +9387,7 @@ var Pagination = function Pagination(props) {
9378
9387
  var page = _ref2.page,
9379
9388
  type = _ref2.type,
9380
9389
  selected = _ref2.selected,
9381
- item = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
9390
+ item = _objectWithoutPropertiesLoose(_ref2, _excluded$2);
9382
9391
  var children = null;
9383
9392
  if (type === 'start-ellipsis' || type === 'end-ellipsis') {
9384
9393
  children = React$1__default.createElement("li", {
@@ -9712,11 +9721,11 @@ function Search(props) {
9712
9721
  var _useState7 = React$1.useState(false),
9713
9722
  showResults = _useState7[0],
9714
9723
  setShowResults = _useState7[1];
9715
- var wrapperRef = React$1.useRef(null);
9724
+ var wrapperRef = React$1.createRef();
9716
9725
  var handleClickOutside = function handleClickOutside(e) {
9717
9726
  if (!e) setShowResults(false);
9718
9727
  };
9719
- useOutsideClick(wrapperRef, handleClickOutside);
9728
+ useOutsideClick([wrapperRef], handleClickOutside);
9720
9729
  var onEsc = function onEsc(evt) {
9721
9730
  if (evt.key === 'Escape') {
9722
9731
  setShowResults(false);
@@ -11149,13 +11158,13 @@ TextEditorColorPicker.defaultProps = {
11149
11158
  onChange: function onChange() {}
11150
11159
  };
11151
11160
 
11152
- var _excluded$2 = ["icon", "active"];
11161
+ var _excluded$3 = ["icon", "active"];
11153
11162
  var rootClassName$2B = 'text-editor-header-button';
11154
11163
  function TextEditorHeaderButton(_ref) {
11155
11164
  var _props$className;
11156
11165
  var icon = _ref.icon,
11157
11166
  active = _ref.active,
11158
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
11167
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
11159
11168
  return React$1__default.createElement("button", Object.assign({
11160
11169
  className: getMergedClassNames([rootClassName$2B, active ? 'active' : '', (_props$className = props.className) != null ? _props$className : ''])
11161
11170
  }, props), icon);