widenarrow-ui 1.1.102 → 1.1.104

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.
@@ -20,6 +20,7 @@ export interface DropDownProps {
20
20
  rotateLeftIconByDegree?: number;
21
21
  rotateMiddleIconByDegree?: number;
22
22
  rotateRightIconByDegree?: number;
23
+ withPortal?: boolean;
23
24
  placement?: Placement;
24
25
  strategy?: PositioningStrategy;
25
26
  offset?: {
package/lib/index.d.ts CHANGED
@@ -539,6 +539,7 @@ interface DropDownProps {
539
539
  rotateLeftIconByDegree?: number;
540
540
  rotateMiddleIconByDegree?: number;
541
541
  rotateRightIconByDegree?: number;
542
+ withPortal?: boolean;
542
543
  placement?: Placement;
543
544
  strategy?: PositioningStrategy;
544
545
  offset?: {
package/lib/index.esm.js CHANGED
@@ -710,7 +710,7 @@ var AppColors;
710
710
  var styles$s = {"body":"ToolTip-module_EfvT16","container":"ToolTip-module_rxb-Ce","withEllipsis":"ToolTip-module_vea-tI"};
711
711
 
712
712
  var s$s = classNames.bind(styles$s);
713
- var htmlRootNode = document.getElementById('root');
713
+ var htmlRootNode$1 = document.getElementById('root');
714
714
  /**
715
715
  * @desc This components extends the react-tooltip library.
716
716
  * Full api documentation here: https://github.com/wwayne/react-tooltip
@@ -731,8 +731,8 @@ var ToolTip = function (_a) {
731
731
  var toolTipMarkup = (jsxs(Tooltip, { className: s$s('container', (_b = {},
732
732
  _b[toolTipClassName] = toolTipClassName,
733
733
  _b)), id: uniq, place: is(String, placement) ? placement : 'top', variant: is(String, variant) ? variant : 'dark', offset: offset || 8, delayShow: delayShow || 150, closeOnScroll: true, children: [text ? jsx("span", { children: text }) : null, component || null] }));
734
- if (displayInPortal || !!htmlRootNode) {
735
- return (jsxs(Fragment, { children: [jsx("div", { "data-tooltip-id": uniq, className: s$s((_c = {}, _c[className] = className, _c.withEllipsis = withEllipsis, _c)), children: children }), createPortal(toolTipMarkup, htmlRootNode)] }));
734
+ if (displayInPortal || !!htmlRootNode$1) {
735
+ return (jsxs(Fragment, { children: [jsx("div", { "data-tooltip-id": uniq, className: s$s((_c = {}, _c[className] = className, _c.withEllipsis = withEllipsis, _c)), children: children }), createPortal(toolTipMarkup, htmlRootNode$1)] }));
736
736
  }
737
737
  return (jsxs(Fragment, { children: [jsx("div", { "data-tooltip-id": uniq, className: s$s((_d = {}, _d[className] = className, _d.withEllipsis = withEllipsis, _d)), children: children }), toolTipMarkup] }));
738
738
  };
@@ -2693,14 +2693,15 @@ function useHandleClickOutside(callback) {
2693
2693
  var styles$j = {"body":"DropDown-module_s-41xK","container":"DropDown-module_ms9Bnm","dropDownContainer":"DropDown-module_1bVmMF","arrow":"DropDown-module_b3hGdC","arrow_topIsDark":"DropDown-module_R8bNg1","opacityIn":"DropDown-module_nxu56-","headingContainer":"DropDown-module_d9ELNG","heading":"DropDown-module_h3xW01","childrenContainer":"DropDown-module_SegKtJ","childrenContainer_left":"DropDown-module_6BCK8k","slideInRight":"DropDown-module_si25YW","childrenContainer_top":"DropDown-module_FyuZ2X","slideInBottom":"DropDown-module_kkRcRV","childrenContainer_right":"DropDown-module_I06m6q","slideInLeft":"DropDown-module_0LyhMh","childrenContainer_bottom":"DropDown-module_8k0-k4","slideInTop":"DropDown-module_Q28lTs","list":"DropDown-module_OPwMsl","list_noHeader":"DropDown-module_RMfcZD","list_noFooter":"DropDown-module_EuuqD-","list_noHeaderOrFooter":"DropDown-module_3teSz6","list_withVisibleOverflow":"DropDown-module_Rvc2NZ","children":"DropDown-module_O5fSBy","children_noHeader":"DropDown-module_LQizIT","children_noFooter":"DropDown-module_HtsACa","children_noHeaderOrFooter":"DropDown-module_ho5wUS","spinner":"DropDown-module_hsbQPA","spinner_noHeader":"DropDown-module_T6lMJg","spinner_noFooter":"DropDown-module_-Tojji","footer":"DropDown-module_C-TdDM"};
2694
2694
 
2695
2695
  var s$j = classNames.bind(styles$j);
2696
+ var htmlRootNode = document.getElementById('root');
2696
2697
  var DropDown = function (_a) {
2697
- var _b, _c, _d, _e, _f;
2698
- var title = _a.title, _g = _a.offset, offset = _g === void 0 ? { horizontal: 8, vertical: 12 } : _g, arrowPadding = _a.arrowPadding, _h = _a.placement, placement = _h === void 0 ? 'auto' : _h, _j = _a.strategy, strategy = _j === void 0 ? 'absolute' : _j, className = _a.className, buttonComponent = _a.buttonComponent, triggerComponent = _a.triggerComponent, _k = _a.buttonCallbackName, buttonCallbackName = _k === void 0 ? 'onClickCallback' : _k, footerComponent = _a.footerComponent, onCloseCallback = _a.onCloseCallback, onOpenCallback = _a.onOpenCallback, children = _a.children, dropDownClassName = _a.dropDownClassName, childrenClassName = _a.childrenClassName, loading = _a.loading, _l = _a.withArrow, withArrow = _l === void 0 ? true : _l, _m = _a.childrenIsList, childrenIsList = _m === void 0 ? true : _m, isOpen = _a.isOpen, _o = _a.closeOnEscape, closeOnEscape = _o === void 0 ? true : _o, rotateIconByDegree = _a.rotateIconByDegree, rotateLeftIconByDegree = _a.rotateLeftIconByDegree, rotateMiddleIconByDegree = _a.rotateMiddleIconByDegree, rotateRightIconByDegree = _a.rotateRightIconByDegree, withVisibleOverflow = _a.withVisibleOverflow;
2699
- var _p = useState(false), _isOpen = _p[0], _setIsOpen = _p[1];
2700
- var _q = useState(null), referenceElement = _q[0], setReferenceElement = _q[1];
2701
- var _r = useState(null), popperElement = _r[0], setPopperElement = _r[1];
2702
- var _s = useState(null), arrowElement = _s[0], setArrowElement = _s[1];
2703
- var _t = useState(false), hasBeenOpened = _t[0], setHasBeenOpened = _t[1];
2698
+ var _b, _c, _d;
2699
+ var title = _a.title, _e = _a.offset, offset = _e === void 0 ? { horizontal: 8, vertical: 12 } : _e, arrowPadding = _a.arrowPadding, _f = _a.placement, placement = _f === void 0 ? 'auto' : _f, _g = _a.strategy, strategy = _g === void 0 ? 'absolute' : _g, className = _a.className, buttonComponent = _a.buttonComponent, triggerComponent = _a.triggerComponent, _h = _a.buttonCallbackName, buttonCallbackName = _h === void 0 ? 'onClickCallback' : _h, footerComponent = _a.footerComponent, onCloseCallback = _a.onCloseCallback, onOpenCallback = _a.onOpenCallback, children = _a.children, dropDownClassName = _a.dropDownClassName, childrenClassName = _a.childrenClassName, loading = _a.loading, _j = _a.withArrow, withArrow = _j === void 0 ? true : _j, _k = _a.childrenIsList, childrenIsList = _k === void 0 ? true : _k, isOpen = _a.isOpen, _l = _a.closeOnEscape, closeOnEscape = _l === void 0 ? true : _l, rotateIconByDegree = _a.rotateIconByDegree, rotateLeftIconByDegree = _a.rotateLeftIconByDegree, rotateMiddleIconByDegree = _a.rotateMiddleIconByDegree, rotateRightIconByDegree = _a.rotateRightIconByDegree, withVisibleOverflow = _a.withVisibleOverflow, withPortal = _a.withPortal;
2700
+ var _m = useState(false), _isOpen = _m[0], _setIsOpen = _m[1];
2701
+ var _o = useState(null), referenceElement = _o[0], setReferenceElement = _o[1];
2702
+ var _p = useState(null), popperElement = _p[0], setPopperElement = _p[1];
2703
+ var _q = useState(null), arrowElement = _q[0], setArrowElement = _q[1];
2704
+ var _r = useState(false), hasBeenOpened = _r[0], setHasBeenOpened = _r[1];
2704
2705
  var isOpenState = is(Boolean, isOpen) ? isOpen : _isOpen;
2705
2706
  var horizontal = offset.horizontal, vertical = offset.vertical;
2706
2707
  var escFunction = function (event) {
@@ -2726,14 +2727,14 @@ var DropDown = function (_a) {
2726
2727
  },
2727
2728
  // eslint-disable-next-line
2728
2729
  [closeOnEscape, hasBeenOpened]);
2729
- var _u = usePopper(referenceElement, popperElement, {
2730
+ var _s = usePopper(referenceElement, popperElement, {
2730
2731
  placement: placement,
2731
2732
  strategy: strategy,
2732
2733
  modifiers: [
2733
2734
  { name: 'arrow', enabled: withArrow, options: { element: arrowElement, padding: arrowPadding || 16 } },
2734
2735
  { name: 'offset', enabled: true, options: { offset: [horizontal, vertical] } }
2735
2736
  ]
2736
- }), styles = _u.styles, attributes = _u.attributes;
2737
+ }), styles = _s.styles, attributes = _s.attributes;
2737
2738
  var onClose = function () {
2738
2739
  if (isOpenState) {
2739
2740
  is(Function, onCloseCallback) && onCloseCallback();
@@ -2838,23 +2839,27 @@ var DropDown = function (_a) {
2838
2839
  _b[rotateMiddleIconByDegree ? 'rotateMiddleIconByDegree' : ''] = _isOpen ? rotateMiddleIconByDegree : 0,
2839
2840
  _b[rotateRightIconByDegree ? 'rotateRightIconByDegree' : ''] = _isOpen ? rotateRightIconByDegree : 0,
2840
2841
  _b);
2842
+ var dropDownMarkup = function () {
2843
+ var _a, _b;
2844
+ return isOpenState ? (jsxs("div", __assign({ className: s$j('dropDownContainer', (_a = {},
2845
+ _a[dropDownClassName] = dropDownClassName,
2846
+ _a)), ref: setPopperElement, style: styles.popper }, attributes.popper, { children: [withArrow && (jsx("div", { ref: setArrowElement, className: s$j('arrow', {
2847
+ arrow_topIsDark: title
2848
+ }), style: styles.arrow })), jsxs("div", { className: s$j('childrenContainer', (_b = {},
2849
+ _b["childrenContainer_".concat(getAnimationOrigin(attributes))] = getAnimationOrigin(attributes),
2850
+ _b)), children: [title && (jsx("header", { className: s$j('headingContainer'), children: jsx(Heading, { className: s$j('heading'), type: 'h6', marginBottom: '0', color: ColorTypes.WHITE, textAlign: 'left', children: title }) })), jsxs("div", { className: s$j('children', {
2851
+ children_noFooter: !footerComponent && title,
2852
+ children_noHeader: !title && footerComponent,
2853
+ children_noHeaderOrFooter: !title && !footerComponent
2854
+ }), children: [loading ? jsx(SolidSpinner, { type: HierarchyTypes.PRIMARY, absoluteCenter: true }) : null, getChildrenListMarkup()] }), footerComponent ? jsx("div", { className: s$j('footer'), children: footerComponent }) : null] })] }))) : null;
2855
+ };
2841
2856
  return (jsxs("div", { ref: containerRef, className: s$j('container', (_c = {},
2842
2857
  _c[className] = className,
2843
2858
  _c)), children: [triggerComponent ? (jsx(Box, { displayFlex: true, alignItems: 'center', ref: setReferenceElement, children: isValidElement(triggerComponent)
2844
2859
  ? cloneElement(triggerComponent, __assign({}, pickAttributes(buttonAttributes)))
2845
2860
  : null })) : null, buttonComponent ? (jsx(Box, { displayFlex: true, alignItems: 'center', ref: setReferenceElement, children: isValidElement(buttonComponent)
2846
2861
  ? cloneElement(buttonComponent, __assign((_d = {}, _d[buttonCallbackName] = function (e) { return onClickButton(e); }, _d), pickAttributes(buttonAttributes)))
2847
- : null })) : null, isOpenState ? (jsxs("div", __assign({ className: s$j('dropDownContainer', (_e = {},
2848
- _e[dropDownClassName] = dropDownClassName,
2849
- _e)), ref: setPopperElement, style: styles.popper }, attributes.popper, { children: [withArrow && (jsx("div", { ref: setArrowElement, className: s$j('arrow', {
2850
- arrow_topIsDark: title
2851
- }), style: styles.arrow })), jsxs("div", { className: s$j('childrenContainer', (_f = {},
2852
- _f["childrenContainer_".concat(getAnimationOrigin(attributes))] = getAnimationOrigin(attributes),
2853
- _f)), children: [title && (jsx("header", { className: s$j('headingContainer'), children: jsx(Heading, { className: s$j('heading'), type: 'h6', marginBottom: '0', color: ColorTypes.WHITE, textAlign: 'left', children: title }) })), jsxs("div", { className: s$j('children', {
2854
- children_noFooter: !footerComponent && title,
2855
- children_noHeader: !title && footerComponent,
2856
- children_noHeaderOrFooter: !title && !footerComponent
2857
- }), children: [loading ? jsx(SolidSpinner, { type: HierarchyTypes.PRIMARY, absoluteCenter: true }) : null, getChildrenListMarkup()] }), footerComponent ? jsx("div", { className: s$j('footer'), children: footerComponent }) : null] })] }))) : null] }));
2862
+ : null })) : null, withPortal ? createPortal(dropDownMarkup(), htmlRootNode) : dropDownMarkup()] }));
2858
2863
  };
2859
2864
 
2860
2865
  var styles$i = {"body":"DropDownItem-module_UqDzTt","container":"DropDownItem-module_SLjW0W","container_disabled":"DropDownItem-module_n4Ei9p","innerContainer":"DropDownItem-module_yTPeWz","button":"DropDownItem-module_mxcLFJ","button_clickable":"DropDownItem-module_OZsG-E","text":"DropDownItem-module_jUNg9b","button_small":"DropDownItem-module_t-DbXt","button_medium":"DropDownItem-module_RC2tFi","button_large":"DropDownItem-module_cRR335","icon_placeholder":"DropDownItem-module_rnlTmr","icon_small":"DropDownItem-module_IP7eDy","icon_medium":"DropDownItem-module_zAzvAS","icon_large":"DropDownItem-module_evC7qy","icon_left":"DropDownItem-module_qT-IaM","icon_right":"DropDownItem-module_F1274l","text_active":"DropDownItem-module_WKiUMc","text_disabled":"DropDownItem-module_GMkCiF","text_activeDisabled":"DropDownItem-module_vwOfg5"};