@vibe/core 3.74.0-alpha-10c01.0 → 3.74.0-alpha-f7c48.0

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.
Files changed (70) hide show
  1. package/dist/components/Dialog/Dialog.d.ts +0 -7
  2. package/dist/components/next/Dropdown/Dropdown.types.d.ts +22 -7
  3. package/dist/components/next/Dropdown/components/DropdownBoxMode/DropdownBoxMode.d.ts +3 -0
  4. package/dist/components/next/Dropdown/components/Menu/MenuList.d.ts +4 -0
  5. package/dist/components/next/Dropdown/context/DropdownContext.types.d.ts +1 -1
  6. package/dist/components/next/index.d.ts +0 -1
  7. package/dist/components/next.d.ts +1 -0
  8. package/dist/metadata.json +2078 -1198
  9. package/dist/mocked_classnames/components/Dialog/Dialog.d.ts +0 -7
  10. package/dist/mocked_classnames/components/next/Dropdown/Dropdown.types.d.ts +22 -7
  11. package/dist/mocked_classnames/components/next/Dropdown/components/DropdownBoxMode/DropdownBoxMode.d.ts +3 -0
  12. package/dist/mocked_classnames/components/next/Dropdown/components/Menu/MenuList.d.ts +4 -0
  13. package/dist/mocked_classnames/components/next/Dropdown/context/DropdownContext.types.d.ts +1 -1
  14. package/dist/mocked_classnames/components/next/index.d.ts +0 -1
  15. package/dist/mocked_classnames/components/next.d.ts +1 -0
  16. package/dist/mocked_classnames/src/components/Dialog/Dialog.js +1 -1
  17. package/dist/mocked_classnames/src/components/Dialog/Dialog.js.map +1 -1
  18. package/dist/mocked_classnames/src/components/RadioButton/RadioButton.js.map +1 -1
  19. package/dist/mocked_classnames/src/components/Tipseen/Tipseen.js +1 -1
  20. package/dist/mocked_classnames/src/components/Tipseen/Tipseen.js.map +1 -1
  21. package/dist/mocked_classnames/src/components/next/Dropdown/components/DropdownBase/DropdownBase.js +1 -1
  22. package/dist/mocked_classnames/src/components/next/Dropdown/components/DropdownBase/DropdownBase.js.map +1 -1
  23. package/dist/mocked_classnames/src/components/next/Dropdown/components/DropdownBase/DropdownBase.module.scss.js +1 -1
  24. package/dist/mocked_classnames/src/components/next/Dropdown/components/DropdownBoxMode/DropdownBoxMode.js +2 -0
  25. package/dist/mocked_classnames/src/components/next/Dropdown/components/DropdownBoxMode/DropdownBoxMode.js.map +1 -0
  26. package/dist/mocked_classnames/src/components/next/Dropdown/components/DropdownBoxMode/DropdownBoxMode.module.scss.js +2 -0
  27. package/dist/mocked_classnames/src/components/next/Dropdown/components/DropdownBoxMode/DropdownBoxMode.module.scss.js.map +1 -0
  28. package/dist/mocked_classnames/src/components/next/Dropdown/components/DropdownWrapperUI.js +1 -1
  29. package/dist/mocked_classnames/src/components/next/Dropdown/components/DropdownWrapperUI.js.map +1 -1
  30. package/dist/mocked_classnames/src/components/next/Dropdown/components/Menu/Menu.js +1 -1
  31. package/dist/mocked_classnames/src/components/next/Dropdown/components/Menu/Menu.js.map +1 -1
  32. package/dist/mocked_classnames/src/components/next/Dropdown/components/Menu/MenuList.js +2 -0
  33. package/dist/mocked_classnames/src/components/next/Dropdown/components/Menu/MenuList.js.map +1 -0
  34. package/dist/mocked_classnames/src/components/next/Dropdown/components/Trigger/DropdownInput.js +1 -1
  35. package/dist/mocked_classnames/src/components/next/Dropdown/components/Trigger/DropdownInput.js.map +1 -1
  36. package/dist/mocked_classnames/src/components/next/Dropdown/components/Trigger/TriggerActions.js +1 -1
  37. package/dist/mocked_classnames/src/components/next/Dropdown/components/Trigger/TriggerActions.js.map +1 -1
  38. package/dist/mocked_classnames/src/components/next/Dropdown/modes/DropdownComboboxController.js +1 -1
  39. package/dist/mocked_classnames/src/components/next/Dropdown/modes/DropdownComboboxController.js.map +1 -1
  40. package/dist/mocked_classnames/src/components/next/Dropdown/modes/DropdownMultiComboboxController.js +1 -1
  41. package/dist/mocked_classnames/src/components/next/Dropdown/modes/DropdownMultiComboboxController.js.map +1 -1
  42. package/dist/mocked_classnames/src/components/next.js +1 -1
  43. package/dist/src/components/Dialog/Dialog.js +1 -1
  44. package/dist/src/components/Dialog/Dialog.js.map +1 -1
  45. package/dist/src/components/RadioButton/RadioButton.js.map +1 -1
  46. package/dist/src/components/Tipseen/Tipseen.js +1 -1
  47. package/dist/src/components/Tipseen/Tipseen.js.map +1 -1
  48. package/dist/src/components/next/Dropdown/components/DropdownBase/DropdownBase.js +1 -1
  49. package/dist/src/components/next/Dropdown/components/DropdownBase/DropdownBase.js.map +1 -1
  50. package/dist/src/components/next/Dropdown/components/DropdownBase/DropdownBase.module.scss.js +1 -1
  51. package/dist/src/components/next/Dropdown/components/DropdownBoxMode/DropdownBoxMode.js +2 -0
  52. package/dist/src/components/next/Dropdown/components/DropdownBoxMode/DropdownBoxMode.js.map +1 -0
  53. package/dist/src/components/next/Dropdown/components/DropdownBoxMode/DropdownBoxMode.module.scss.js +2 -0
  54. package/dist/src/components/next/Dropdown/components/DropdownBoxMode/DropdownBoxMode.module.scss.js.map +1 -0
  55. package/dist/src/components/next/Dropdown/components/DropdownWrapperUI.js +1 -1
  56. package/dist/src/components/next/Dropdown/components/DropdownWrapperUI.js.map +1 -1
  57. package/dist/src/components/next/Dropdown/components/Menu/Menu.js +1 -1
  58. package/dist/src/components/next/Dropdown/components/Menu/Menu.js.map +1 -1
  59. package/dist/src/components/next/Dropdown/components/Menu/MenuList.js +2 -0
  60. package/dist/src/components/next/Dropdown/components/Menu/MenuList.js.map +1 -0
  61. package/dist/src/components/next/Dropdown/components/Trigger/DropdownInput.js +1 -1
  62. package/dist/src/components/next/Dropdown/components/Trigger/DropdownInput.js.map +1 -1
  63. package/dist/src/components/next/Dropdown/components/Trigger/TriggerActions.js +1 -1
  64. package/dist/src/components/next/Dropdown/components/Trigger/TriggerActions.js.map +1 -1
  65. package/dist/src/components/next/Dropdown/modes/DropdownComboboxController.js +1 -1
  66. package/dist/src/components/next/Dropdown/modes/DropdownComboboxController.js.map +1 -1
  67. package/dist/src/components/next/Dropdown/modes/DropdownMultiComboboxController.js +1 -1
  68. package/dist/src/components/next/Dropdown/modes/DropdownMultiComboboxController.js.map +1 -1
  69. package/dist/src/components/next.js +1 -1
  70. package/package.json +7 -7
@@ -173,12 +173,6 @@ export interface DialogProps extends VibeComponentProps {
173
173
  * that may grow or shrink without a re-render being triggered.
174
174
  */
175
175
  observeContentResize?: boolean;
176
- /**
177
- * If true, provides a LayerProvider context for nested dialogs to render correctly.
178
- * This is useful when you have components that use Dialog internally (like Dropdown)
179
- * inside another Dialog, ensuring proper z-index stacking and click-outside behavior.
180
- */
181
- enableNestedDialogLayer?: boolean;
182
176
  }
183
177
  export interface DialogState {
184
178
  /**
@@ -227,7 +221,6 @@ export default class Dialog extends PureComponent<DialogProps, DialogState> {
227
221
  instantShowAndHide: boolean;
228
222
  addKeyboardHideShowTriggersByDefault: boolean;
229
223
  observeContentResize: boolean;
230
- enableNestedDialogLayer: boolean;
231
224
  };
232
225
  private showTimeout;
233
226
  private hideTimeout;
@@ -62,7 +62,26 @@ interface SingleSelectSpecifics<Item extends BaseListItemData<Record<string, unk
62
62
  */
63
63
  onChange?: (option: Item) => void;
64
64
  }
65
- export type BaseDropdownProps<Item extends BaseListItemData<Record<string, unknown>>> = VibeComponentProps & {
65
+ type BoxModeConstraint = {
66
+ /**
67
+ * If true, the dropdown is searchable.
68
+ */
69
+ searchable?: false;
70
+ /**
71
+ * If true, the dropdown menu is displayed inline without a popup/dialog.
72
+ */
73
+ boxMode?: false;
74
+ } | {
75
+ /**
76
+ * If true, the dropdown is searchable.
77
+ */
78
+ searchable: true;
79
+ /**
80
+ * If true, the dropdown menu is displayed inline without a popup/dialog.
81
+ */
82
+ boxMode?: boolean;
83
+ };
84
+ export type BaseDropdownProps<Item extends BaseListItemData<Record<string, unknown>>> = VibeComponentProps & BoxModeConstraint & {
66
85
  /**
67
86
  * The list of options available in the list.
68
87
  */
@@ -87,10 +106,6 @@ export type BaseDropdownProps<Item extends BaseListItemData<Record<string, unkno
87
106
  * The direction of the dropdown.
88
107
  */
89
108
  dir?: DropdownDirection;
90
- /**
91
- * If true, the dropdown is searchable.
92
- */
93
- searchable?: boolean;
94
109
  /**
95
110
  * The function to call to render an option.
96
111
  */
@@ -232,10 +247,10 @@ export type BaseDropdownProps<Item extends BaseListItemData<Record<string, unkno
232
247
  } & (MultiSelectSpecifics<Item> | SingleSelectSpecifics<Item>);
233
248
  export type DropdownSizes = "small" | "medium" | "large";
234
249
  export type DropdownDirection = "ltr" | "rtl" | "auto";
235
- export type DropdownMultiControllerProps<Item extends BaseListItemData<Record<string, unknown>>> = Omit<BaseDropdownProps<Item>, keyof MultiSelectSpecifics<Item>> & MultiSelectSpecifics<Item> & {
250
+ export type DropdownMultiControllerProps<Item extends BaseListItemData<Record<string, unknown>>> = Omit<BaseDropdownProps<Item>, keyof MultiSelectSpecifics<Item> | keyof BoxModeConstraint> & BoxModeConstraint & MultiSelectSpecifics<Item> & {
236
251
  dropdownRef: React.Ref<HTMLDivElement>;
237
252
  };
238
- export type DropdownSingleControllerProps<Item extends BaseListItemData<Record<string, unknown>>> = Omit<BaseDropdownProps<Item>, keyof SingleSelectSpecifics<Item>> & SingleSelectSpecifics<Item> & {
253
+ export type DropdownSingleControllerProps<Item extends BaseListItemData<Record<string, unknown>>> = Omit<BaseDropdownProps<Item>, keyof SingleSelectSpecifics<Item> | keyof BoxModeConstraint> & BoxModeConstraint & SingleSelectSpecifics<Item> & {
239
254
  dropdownRef: React.Ref<HTMLDivElement>;
240
255
  };
241
256
  export {};
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const DropdownBoxMode: () => React.JSX.Element;
3
+ export default DropdownBoxMode;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { type BaseListItemData } from "../../../../BaseListItem";
3
+ declare const MenuList: <Item extends BaseListItemData<Record<string, unknown>>>() => React.JSX.Element;
4
+ export default MenuList;
@@ -7,7 +7,7 @@ type ItemPropGetter<Item> = (options: {
7
7
  item: Item;
8
8
  index: number;
9
9
  }) => Record<string, any>;
10
- type InheritedDropdownProps<Item extends BaseListItemData<Record<string, unknown>>> = Partial<Pick<BaseDropdownProps<Item>, "label" | "required" | "className" | "id" | "ariaLabel" | "data-testid" | "error" | "helperText" | "dir" | "searchable" | "multi" | "multiline" | "disabled" | "readOnly" | "size" | "optionRenderer" | "valueRenderer" | "menuRenderer" | "noOptionsMessage" | "placeholder" | "withGroupDivider" | "stickyGroupTitle" | "maxMenuHeight" | "clearable" | "autoFocus" | "inputAriaLabel" | "menuAriaLabel" | "clearAriaLabel" | "closeMenuOnSelect" | "menuWrapperClassName" | "loading" | "onFocus" | "onBlur" | "onKeyDown" | "onScroll" | "onClear">>;
10
+ type InheritedDropdownProps<Item extends BaseListItemData<Record<string, unknown>>> = Partial<Pick<BaseDropdownProps<Item>, "label" | "required" | "className" | "id" | "ariaLabel" | "data-testid" | "error" | "helperText" | "dir" | "searchable" | "multi" | "multiline" | "disabled" | "readOnly" | "size" | "optionRenderer" | "valueRenderer" | "menuRenderer" | "noOptionsMessage" | "placeholder" | "withGroupDivider" | "stickyGroupTitle" | "maxMenuHeight" | "clearable" | "autoFocus" | "inputAriaLabel" | "menuAriaLabel" | "clearAriaLabel" | "closeMenuOnSelect" | "menuWrapperClassName" | "loading" | "boxMode" | "onFocus" | "onBlur" | "onKeyDown" | "onScroll" | "onClear">>;
11
11
  export interface DropdownContextProps<Item extends BaseListItemData<Record<string, unknown>> = any> extends InheritedDropdownProps<Item> {
12
12
  label?: string;
13
13
  isOpen: boolean;
@@ -1,3 +1,2 @@
1
1
  export * from "./AttentionBox";
2
2
  export * from "./Dropdown";
3
- export * from "../../components/Modal";
@@ -1 +1,2 @@
1
+ export * from "./Modal";
1
2
  export * from "./next/index";
@@ -1,2 +1,2 @@
1
- import{inherits as e,createClass as n,toConsumableArray as o,classCallCheck as t,callSuper as i}from"../../../_virtual/_rollupPluginBabelHelpers.js";import s from"classnames";import r,{PureComponent as a}from"react";import{createPortal as l}from"react-dom";import{Manager as u,Reference as h,Popper as d}from"react-popper";import{isFunction as c}from"es-toolkit";import{NOOP as p,chainRefFunctions as m,chainFunctions as f,convertToArray as g}from"../../utils/function-utils.js";import v from"./DialogContent/DialogContent.js";import{isInsideClass as D}from"../../utils/dom-utils.js";import{Refable as y}from"../Refable/Refable.js";import{HideShowEvent as w,DialogPosition as E,AnimationType as C}from"./DialogConstants.js";import k from"./Dialog.module.scss.js";import{getTestId as T,ComponentDefaultTestId as b}from"../../tests/testIds.js";import S from"../LayerProvider/LayerContext.js";import O from"../LayerProvider/LayerProvider.js";import{isClient as M}from"../../utils/ssr-utils.js";import{createObserveContentResizeModifier as x}from"./modifiers/observeContentResizeModifier.js";var H=function(p){function f(e){var n;return t(this,f),(n=i(this,f,[e])).state={shouldUseDerivedStateFromProps:e.useDerivedStateFromProps,isOpen:e.shouldShowOnMount},n.containerRef=r.createRef(),n.onMouseEnter=n.onMouseEnter.bind(n),n.onMouseLeave=n.onMouseLeave.bind(n),n.onMouseDown=n.onMouseDown.bind(n),n.onClick=n.onClick.bind(n),n.onFocus=n.onFocus.bind(n),n.onBlur=n.onBlur.bind(n),n.isShown=n.isShown.bind(n),n.onEsc=n.onEsc.bind(n),n.onClickOutside=n.onClickOutside.bind(n),n.onDialogEnter=n.onDialogEnter.bind(n),n.onDialogLeave=n.onDialogLeave.bind(n),n.getContainer=n.getContainer.bind(n),n.onContentClick=n.onContentClick.bind(n),n.onKeyDown=n.onKeyDown.bind(n),n.closeDialogOnEscape=n.closeDialogOnEscape.bind(n),n.onContextMenu=n.onContextMenu.bind(n),n.getDefaultContainer=n.getDefaultContainer.bind(n),n.hideTimeout=null,n.showTimeout=null,n}return e(f,a),n(f,[{key:"closeDialogOnEscape",value:function(e){if(this.state.isOpen)switch(e.key){case"Escape":this.hideDialogIfNeeded(e,w.ESCAPE_KEY);break;case"Tab":this.handleEvent(w.TAB_KEY,e.target,e);break;case"Enter":this.handleEvent(w.ENTER,e.target,e)}}},{key:"componentDidMount",value:function(){var e=this.props,n=e.shouldCallbackOnMount,o=e.onDialogDidShow,t=this.state.isOpen;M()&&document.addEventListener("keyup",this.closeDialogOnEscape),n&&t&&o&&o()}},{key:"componentWillUnmount",value:function(){M()&&document.removeEventListener("keyup",this.closeDialogOnEscape),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}},{key:"getDefaultContainer",value:function(){var e=this.context.layerRef;return(null==e?void 0:e.current)?e.current:document.body}},{key:"getContainer",value:function(){var e=this.props.containerSelector;if(!e)return this.getDefaultContainer();var n=document.querySelector(e);return n&&n instanceof Element?n:this.getDefaultContainer()}},{key:"showDialog",value:function(e,n){var o=this,t=this.props,i=t.instantShowAndHide,s=t.getDynamicShowDelay,r=t.showDelay,a=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).preventAnimation;if(s){var l=s();r=l.showDelay||0,a=a||l.preventAnimation}i?(this.onShowDialog(e,n),this.setState({isOpen:!0,preventAnimation:a}),this.showTimeout=null):this.showTimeout=setTimeout((function(){o.onShowDialog(e,n),o.showTimeout=null,o.setState({isOpen:!0,preventAnimation:a})}),r)}},{key:"onShowDialog",value:function(e,n){this.isShown()||(0,this.props.onDialogDidShow)(e,n)}},{key:"showDialogIfNeeded",value:function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.props.disable||(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.showTimeout||this.showDialog(e,n,o))}},{key:"hideDialog",value:function(e,n){var o=this,t=this.props,i=t.hideDelay;t.instantShowAndHide?(this.onHideDialog(e,n),this.setState({isOpen:!1}),this.hideTimeout=null):this.hideTimeout=setTimeout((function(){o.onHideDialog(e,n),o.setState({isOpen:!1}),o.hideTimeout=null}),i)}},{key:"onHideDialog",value:function(e,n){var o=this.props.onDialogDidHide;o&&o(e,n)}},{key:"hideDialogIfNeeded",value:function(e,n){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.hideTimeout||this.hideDialog(e,n)}},{key:"handleEvent",value:function(e,n,o){var t=this.props,i=t.showTriggerIgnoreClass,s=t.hideTriggerIgnoreClass;return!this.isShowTrigger(e)||this.isShown()||D(n,i)?this.isHideTrigger(e)&&!D(n,s)?this.hideDialogIfNeeded(o,e):void 0:this.showDialogIfNeeded(o,e)}},{key:"isShown",value:function(){return this.state.isOpen||this.props.open}},{key:"isShowTrigger",value:function(e){var n=this.props,o=n.addKeyboardHideShowTriggersByDefault,t=g(n.showTrigger);return!(!o||"focus"!==e||-1>=t.indexOf("mouseenter"))||t.indexOf(e)>-1}},{key:"isHideTrigger",value:function(e){var n=this.props,o=n.addKeyboardHideShowTriggersByDefault,t=g(n.hideTrigger);return!(!o||"blur"!==e||-1>=t.indexOf("mouseleave"))||t.indexOf(e)>-1}},{key:"onMouseEnter",value:function(e){this.handleEvent("mouseenter",e.target,e)}},{key:"onMouseLeave",value:function(e){this.handleEvent("mouseleave",e.target,e)}},{key:"onClick",value:function(e){e.button||this.handleEvent("click",e.target,e)}},{key:"onKeyDown",value:function(e){"Enter"===e.key&&this.handleEvent("enter",e.target,e),"Tab"===e.key&&this.handleEvent("tab",e.target,e)}},{key:"onMouseDown",value:function(e){e.button||this.handleEvent("mousedown",e.target,e)}},{key:"onFocus",value:function(e){this.handleEvent("focus",e.target,e)}},{key:"onBlur",value:function(e){this.handleEvent("blur",e.relatedTarget,e)}},{key:"onEsc",value:function(e){this.handleEvent("esckey",e.target,e)}},{key:"onContextMenu",value:function(e){var n=this.isShown();(this.isShowTrigger("contextmenu")&&!n||this.isHideTrigger("contextmenu")&&n)&&e.preventDefault(),this.handleEvent("contextmenu",e.target,e)}},{key:"onClickOutside",value:function(e){var n=this.props.onClickOutside;this.handleEvent("clickoutside",e.target,e),n(e)}},{key:"onDialogEnter",value:function(e){this.props.showOnDialogEnter&&this.showDialogIfNeeded(e,"DialogEnter")}},{key:"onDialogLeave",value:function(e){this.props.showOnDialogEnter&&this.hideDialogIfNeeded(e,"DialogLeave")}},{key:"onContentClick",value:function(e){var n=this.props.onContentClick;this.handleEvent("onContentClick",e.target,e),n(e)}},{key:"render",value:function(){var e=this,n=this.props,t=n.wrapperClassName,i=n.content,a=n.startingEdge,p=n.children,f=n.preventAnimationOnMount,g=n.animationType,D=n.position,w=n.showDelay,E=n.moveBy,C=n.modifiers,S=n.tooltip,H=n.tooltipClassName,R=n.referenceWrapperClassName,N=n.referenceWrapperElement,A=n.zIndex,I=n.hideWhenReferenceHidden,j=n.disableContainerScroll,P=n.containerSelector,B=n.observeContentResize,F=n.enableNestedDialogLayer,K=this.state.preventAnimation,z=n["data-testid"]||T(b.DIALOG,n.id),_=f||K?void 0:g,U=c(i)?i():i;return U?r.createElement(u,null,r.createElement(h,null,(function(n){var o=n.ref;return r.createElement(y,{className:s(R),wrapperElement:N,ref:o,onBlur:L("onBlur",e,e.props),onKeyDown:L("onKeyDown",e,e.props),onClick:L("onClick",e,e.props),onFocus:L("onFocus",e,e.props),onMouseDown:L("onMouseDown",e,e.props),onMouseEnter:L("onMouseEnter",e,e.props),onMouseLeave:L("onMouseLeave",e,e.props),onContextMenu:L("onContextMenu",e,e.props)},p)})),M()&&l(r.createElement(d,{placement:D,modifiers:[{name:"offset",options:{offset:[E.secondary,E.main]}},{name:"zIndex",enabled:!0,phase:"write",fn:function(e){var n=e.state;return A&&(n.styles.popper.zIndex=A+""),n}},{name:"rotator",enabled:!0,phase:"write",fn:function(e){var n=e.state;return n.styles.arrow?(n.styles.arrow.transform="".concat(n.styles.arrow.transform," rotate(45deg)"),n):n}},x(B)].concat(o(C))},(function(n){var o=n.placement,i=n.style,l=n.ref,u=n.arrowProps,h=n.isReferenceHidden;if(!e.isShown()&&o)return null;if(I&&h){var d=new CustomEvent("onReferenceHidden");e.hideDialog(d,"onReferenceHidden")}var c=m([l,e.containerRef]),p=r.createElement(v,{"data-testid":z,isReferenceHidden:I&&h,onMouseEnter:e.onDialogEnter,onMouseLeave:e.onDialogLeave,onClickOutside:e.onClickOutside,onContextMenu:e.onContextMenu,onEsc:e.onEsc,animationType:_,position:o,wrapperClassName:t,startingEdge:a,isOpen:e.isShown(),showDelay:w,styleObject:i,ref:c,onClick:e.onContentClick,hasTooltip:!!S,containerSelector:P,disableContainerScroll:j},U,S&&r.createElement("div",{style:u.style,ref:u.ref,className:s(k.arrow,H),"data-placement":o}));return F?r.createElement(O,{layerRef:e.containerRef},p):p})),this.getContainer())):p}}],[{key:"getDerivedStateFromProps",value:function(e,n){return n.shouldUseDerivedStateFromProps?{isOpen:e.isOpen}:null}}])}();function L(e,n,o){return f([o[e],n[e]],!0)}H.hideShowTriggers=w,H.positions=E,H.animationTypes=C,H.defaultProps={position:"top",modifiers:[],moveBy:{main:0,secondary:0},showDelay:100,hideDelay:100,showTrigger:H.hideShowTriggers.MOUSE_ENTER,hideTrigger:H.hideShowTriggers.MOUSE_LEAVE,showOnDialogEnter:!1,shouldShowOnMount:!1,disable:!1,open:!1,animationType:H.animationTypes.EXPAND,preventAnimationOnMount:!1,tooltip:!1,onDialogDidShow:p,onDialogDidHide:p,onClickOutside:p,onContentClick:p,useDerivedStateFromProps:!1,hideWhenReferenceHidden:!1,shouldCallbackOnMount:!1,instantShowAndHide:!1,addKeyboardHideShowTriggersByDefault:!1,observeContentResize:!1,enableNestedDialogLayer:!1},H.contextType=S;export{H as default};
1
+ import{inherits as e,createClass as n,toConsumableArray as o,classCallCheck as t,callSuper as i}from"../../../_virtual/_rollupPluginBabelHelpers.js";import s from"classnames";import r,{PureComponent as a}from"react";import{createPortal as l}from"react-dom";import{Manager as u,Reference as h,Popper as d}from"react-popper";import{isFunction as c}from"es-toolkit";import{NOOP as p,chainRefFunctions as m,chainFunctions as f,convertToArray as g}from"../../utils/function-utils.js";import v from"./DialogContent/DialogContent.js";import{isInsideClass as D}from"../../utils/dom-utils.js";import{Refable as y}from"../Refable/Refable.js";import{HideShowEvent as w,DialogPosition as E,AnimationType as C}from"./DialogConstants.js";import k from"./Dialog.module.scss.js";import{getTestId as T,ComponentDefaultTestId as S}from"../../tests/testIds.js";import b from"../LayerProvider/LayerContext.js";import O from"../LayerProvider/LayerProvider.js";import{isClient as M}from"../../utils/ssr-utils.js";import{createObserveContentResizeModifier as x}from"./modifiers/observeContentResizeModifier.js";var H=function(p){function f(e){var n;return t(this,f),(n=i(this,f,[e])).state={shouldUseDerivedStateFromProps:e.useDerivedStateFromProps,isOpen:e.shouldShowOnMount},n.containerRef=r.createRef(),n.onMouseEnter=n.onMouseEnter.bind(n),n.onMouseLeave=n.onMouseLeave.bind(n),n.onMouseDown=n.onMouseDown.bind(n),n.onClick=n.onClick.bind(n),n.onFocus=n.onFocus.bind(n),n.onBlur=n.onBlur.bind(n),n.isShown=n.isShown.bind(n),n.onEsc=n.onEsc.bind(n),n.onClickOutside=n.onClickOutside.bind(n),n.onDialogEnter=n.onDialogEnter.bind(n),n.onDialogLeave=n.onDialogLeave.bind(n),n.getContainer=n.getContainer.bind(n),n.onContentClick=n.onContentClick.bind(n),n.onKeyDown=n.onKeyDown.bind(n),n.closeDialogOnEscape=n.closeDialogOnEscape.bind(n),n.onContextMenu=n.onContextMenu.bind(n),n.getDefaultContainer=n.getDefaultContainer.bind(n),n.hideTimeout=null,n.showTimeout=null,n}return e(f,a),n(f,[{key:"closeDialogOnEscape",value:function(e){if(this.state.isOpen)switch(e.key){case"Escape":this.hideDialogIfNeeded(e,w.ESCAPE_KEY);break;case"Tab":this.handleEvent(w.TAB_KEY,e.target,e);break;case"Enter":this.handleEvent(w.ENTER,e.target,e)}}},{key:"componentDidMount",value:function(){var e=this.props,n=e.shouldCallbackOnMount,o=e.onDialogDidShow,t=this.state.isOpen;M()&&document.addEventListener("keyup",this.closeDialogOnEscape),n&&t&&o&&o()}},{key:"componentWillUnmount",value:function(){M()&&document.removeEventListener("keyup",this.closeDialogOnEscape),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}},{key:"getDefaultContainer",value:function(){var e=this.context.layerRef;return(null==e?void 0:e.current)?e.current:document.body}},{key:"getContainer",value:function(){var e=this.props.containerSelector;if(!e)return this.getDefaultContainer();var n=document.querySelector(e);return n&&n instanceof Element?n:this.getDefaultContainer()}},{key:"showDialog",value:function(e,n){var o=this,t=this.props,i=t.instantShowAndHide,s=t.getDynamicShowDelay,r=t.showDelay,a=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).preventAnimation;if(s){var l=s();r=l.showDelay||0,a=a||l.preventAnimation}i?(this.onShowDialog(e,n),this.setState({isOpen:!0,preventAnimation:a}),this.showTimeout=null):this.showTimeout=setTimeout((function(){o.onShowDialog(e,n),o.showTimeout=null,o.setState({isOpen:!0,preventAnimation:a})}),r)}},{key:"onShowDialog",value:function(e,n){this.isShown()||(0,this.props.onDialogDidShow)(e,n)}},{key:"showDialogIfNeeded",value:function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.props.disable||(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.showTimeout||this.showDialog(e,n,o))}},{key:"hideDialog",value:function(e,n){var o=this,t=this.props,i=t.hideDelay;t.instantShowAndHide?(this.onHideDialog(e,n),this.setState({isOpen:!1}),this.hideTimeout=null):this.hideTimeout=setTimeout((function(){o.onHideDialog(e,n),o.setState({isOpen:!1}),o.hideTimeout=null}),i)}},{key:"onHideDialog",value:function(e,n){var o=this.props.onDialogDidHide;o&&o(e,n)}},{key:"hideDialogIfNeeded",value:function(e,n){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.hideTimeout||this.hideDialog(e,n)}},{key:"handleEvent",value:function(e,n,o){var t=this.props,i=t.showTriggerIgnoreClass,s=t.hideTriggerIgnoreClass;return!this.isShowTrigger(e)||this.isShown()||D(n,i)?this.isHideTrigger(e)&&!D(n,s)?this.hideDialogIfNeeded(o,e):void 0:this.showDialogIfNeeded(o,e)}},{key:"isShown",value:function(){return this.state.isOpen||this.props.open}},{key:"isShowTrigger",value:function(e){var n=this.props,o=n.addKeyboardHideShowTriggersByDefault,t=g(n.showTrigger);return!(!o||"focus"!==e||-1>=t.indexOf("mouseenter"))||t.indexOf(e)>-1}},{key:"isHideTrigger",value:function(e){var n=this.props,o=n.addKeyboardHideShowTriggersByDefault,t=g(n.hideTrigger);return!(!o||"blur"!==e||-1>=t.indexOf("mouseleave"))||t.indexOf(e)>-1}},{key:"onMouseEnter",value:function(e){this.handleEvent("mouseenter",e.target,e)}},{key:"onMouseLeave",value:function(e){this.handleEvent("mouseleave",e.target,e)}},{key:"onClick",value:function(e){e.button||this.handleEvent("click",e.target,e)}},{key:"onKeyDown",value:function(e){"Enter"===e.key&&this.handleEvent("enter",e.target,e),"Tab"===e.key&&this.handleEvent("tab",e.target,e)}},{key:"onMouseDown",value:function(e){e.button||this.handleEvent("mousedown",e.target,e)}},{key:"onFocus",value:function(e){this.handleEvent("focus",e.target,e)}},{key:"onBlur",value:function(e){this.handleEvent("blur",e.relatedTarget,e)}},{key:"onEsc",value:function(e){this.handleEvent("esckey",e.target,e)}},{key:"onContextMenu",value:function(e){var n=this.isShown();(this.isShowTrigger("contextmenu")&&!n||this.isHideTrigger("contextmenu")&&n)&&e.preventDefault(),this.handleEvent("contextmenu",e.target,e)}},{key:"onClickOutside",value:function(e){var n=this.props.onClickOutside;this.handleEvent("clickoutside",e.target,e),n(e)}},{key:"onDialogEnter",value:function(e){this.props.showOnDialogEnter&&this.showDialogIfNeeded(e,"DialogEnter")}},{key:"onDialogLeave",value:function(e){this.props.showOnDialogEnter&&this.hideDialogIfNeeded(e,"DialogLeave")}},{key:"onContentClick",value:function(e){var n=this.props.onContentClick;this.handleEvent("onContentClick",e.target,e),n(e)}},{key:"render",value:function(){var e=this,n=this.props,t=n.wrapperClassName,i=n.content,a=n.startingEdge,p=n.children,f=n.preventAnimationOnMount,g=n.animationType,D=n.position,w=n.showDelay,E=n.moveBy,C=n.modifiers,b=n.tooltip,H=n.tooltipClassName,R=n.referenceWrapperClassName,A=n.referenceWrapperElement,N=n.zIndex,I=n.hideWhenReferenceHidden,j=n.disableContainerScroll,P=n.containerSelector,B=n.observeContentResize,F=this.state.preventAnimation,K=n["data-testid"]||T(S.DIALOG,n.id),z=f||F?void 0:g,_=c(i)?i():i;return _?r.createElement(u,null,r.createElement(h,null,(function(n){var o=n.ref;return r.createElement(y,{className:s(R),wrapperElement:A,ref:o,onBlur:L("onBlur",e,e.props),onKeyDown:L("onKeyDown",e,e.props),onClick:L("onClick",e,e.props),onFocus:L("onFocus",e,e.props),onMouseDown:L("onMouseDown",e,e.props),onMouseEnter:L("onMouseEnter",e,e.props),onMouseLeave:L("onMouseLeave",e,e.props),onContextMenu:L("onContextMenu",e,e.props)},p)})),M()&&l(r.createElement(d,{placement:D,modifiers:[{name:"offset",options:{offset:[E.secondary,E.main]}},{name:"zIndex",enabled:!0,phase:"write",fn:function(e){var n=e.state;return N&&(n.styles.popper.zIndex=N+""),n}},{name:"rotator",enabled:!0,phase:"write",fn:function(e){var n=e.state;return n.styles.arrow?(n.styles.arrow.transform="".concat(n.styles.arrow.transform," rotate(45deg)"),n):n}},x(B)].concat(o(C))},(function(n){var o=n.placement,i=n.style,l=n.ref,u=n.arrowProps,h=n.isReferenceHidden;if(!e.isShown()&&o)return null;if(I&&h){var d=new CustomEvent("onReferenceHidden");e.hideDialog(d,"onReferenceHidden")}var c=m([l,e.containerRef]);return r.createElement(O,{layerRef:e.containerRef},r.createElement(v,{"data-testid":K,isReferenceHidden:I&&h,onMouseEnter:e.onDialogEnter,onMouseLeave:e.onDialogLeave,onClickOutside:e.onClickOutside,onContextMenu:e.onContextMenu,onEsc:e.onEsc,animationType:z,position:o,wrapperClassName:t,startingEdge:a,isOpen:e.isShown(),showDelay:w,styleObject:i,ref:c,onClick:e.onContentClick,hasTooltip:!!b,containerSelector:P,disableContainerScroll:j},_,b&&r.createElement("div",{style:u.style,ref:u.ref,className:s(k.arrow,H),"data-placement":o})))})),this.getContainer())):p}}],[{key:"getDerivedStateFromProps",value:function(e,n){return n.shouldUseDerivedStateFromProps?{isOpen:e.isOpen}:null}}])}();function L(e,n,o){return f([o[e],n[e]],!0)}H.hideShowTriggers=w,H.positions=E,H.animationTypes=C,H.defaultProps={position:"top",modifiers:[],moveBy:{main:0,secondary:0},showDelay:100,hideDelay:100,showTrigger:H.hideShowTriggers.MOUSE_ENTER,hideTrigger:H.hideShowTriggers.MOUSE_LEAVE,showOnDialogEnter:!1,shouldShowOnMount:!1,disable:!1,open:!1,animationType:H.animationTypes.EXPAND,preventAnimationOnMount:!1,tooltip:!1,onDialogDidShow:p,onDialogDidHide:p,onClickOutside:p,onContentClick:p,useDerivedStateFromProps:!1,hideWhenReferenceHidden:!1,shouldCallbackOnMount:!1,instantShowAndHide:!1,addKeyboardHideShowTriggersByDefault:!1,observeContentResize:!1},H.contextType=b;export{H as default};
2
2
  //# sourceMappingURL=Dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sources":["../../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { PureComponent, type ReactElement } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Manager, type Modifier, Popper, Reference } from \"react-popper\";\nimport { isFunction } from \"es-toolkit\";\nimport { chainFunctions, chainRefFunctions, convertToArray, NOOP } from \"../../utils/function-utils\";\nimport DialogContent from \"./DialogContent/DialogContent\";\nimport { isInsideClass } from \"../../utils/dom-utils\";\nimport { Refable } from \"../Refable/Refable\";\nimport {\n AnimationType as AnimationTypeEnum,\n HideShowEvent as DialogTriggerEventEnum,\n DialogPosition as DialogPositionEnum\n} from \"./DialogConstants\";\nimport { type VibeComponentProps } from \"../../types\";\nimport type * as PopperJS from \"@popperjs/core\";\nimport styles from \"./Dialog.module.scss\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport { type DialogAnimationType, type DialogPosition, type DialogTriggerEvent } from \"./Dialog.types\";\nimport LayerContext from \"../LayerProvider/LayerContext\";\nimport { LayerProvider } from \"../LayerProvider\";\nimport { isClient } from \"../../utils/ssr-utils\";\nimport { createObserveContentResizeModifier } from \"./modifiers/observeContentResizeModifier\";\n\nexport interface DialogProps extends VibeComponentProps {\n /**\n * Class name applied to the reference wrapper element.\n */\n referenceWrapperClassName?: string;\n /**\n * The wrapper element type to use for React components. Defaults to \"span\".\n */\n referenceWrapperElement?: \"span\" | \"div\";\n /**\n * The placement of the dialog relative to the reference element.\n */\n position?: DialogPosition;\n /**\n * Custom Popper.js modifiers.\n * https://popper.js.org/docs/v2/modifiers/\n */\n modifiers?: Modifier<any>[];\n /**\n * The starting edge of the dialog.\n */\n startingEdge?: string;\n /**\n * Offset values for positioning adjustments.\n * `main` - horizontal offset\n * `secondary` - vertical offset\n */\n moveBy?: { main?: number; secondary?: number };\n /**\n * Delay in milliseconds before showing the dialog.\n */\n showDelay?: number;\n /**\n * Delay in milliseconds before hiding the dialog.\n */\n hideDelay?: number;\n /**\n * Events that trigger showing the dialog.\n */\n showTrigger?: DialogTriggerEvent | DialogTriggerEvent[];\n /**\n * Events that trigger hiding the dialog.\n */\n hideTrigger?: DialogTriggerEvent | DialogTriggerEvent[];\n /**\n * If true, prevents closing the dialog when the mouse enters it.\n */\n showOnDialogEnter?: boolean;\n /**\n * If true, shows the dialog when the component mounts.\n */\n shouldShowOnMount?: boolean;\n /**\n * If true, disables opening the dialog.\n */\n disable?: boolean;\n /**\n * Controls the open state of the dialog.\n */\n open?: boolean;\n /**\n * Derived state control for managing dialog visibility.\n */\n isOpen?: boolean;\n /**\n * Classes that prevent showing the dialog when present.\n */\n showTriggerIgnoreClass?: string | Array<string>;\n /**\n * Classes that prevent hiding the dialog when present.\n */\n hideTriggerIgnoreClass?: string | Array<string>;\n /**\n * The animation type used for the dialog.\n */\n animationType?: DialogAnimationType;\n /**\n * Class name applied to the dialog content container.\n */\n wrapperClassName?: string;\n /**\n * If true, prevents animation when mounting.\n */\n preventAnimationOnMount?: boolean;\n /**\n * The CSS selector of the container where the dialog is rendered.\n */\n containerSelector?: string;\n /**\n * If true, positions the tooltip element.\n */\n tooltip?: boolean;\n /**\n * Class name applied to the tooltip element.\n */\n tooltipClassName?: string;\n /**\n * Callback fired when the dialog is shown.\n */\n onDialogDidShow?: (event?: DialogEvent, eventName?: DialogTriggerEvent | string) => void;\n /**\n * Callback fired when the dialog is hidden.\n */\n onDialogDidHide?: (event: DialogEvent, eventName: DialogTriggerEvent | string) => void;\n /**\n * Callback fired when clicking outside the dialog.\n */\n onClickOutside?: (event: React.MouseEvent) => void;\n /**\n * Callback fired when clicking inside the dialog content.\n */\n onContentClick?: (event: React.MouseEvent) => void;\n /**\n * The z-index applied to the dialog.\n */\n zIndex?: number;\n /**\n * If true, uses derived state from props.\n */\n useDerivedStateFromProps?: boolean;\n /**\n * If true, makes the dialog disappear when the reference element is hidden.\n */\n hideWhenReferenceHidden?: boolean;\n /**\n * If true, triggers the callback when the dialog mounts.\n */\n shouldCallbackOnMount?: boolean;\n /**\n * If true, instantly shows and hides the dialog without delay.\n */\n instantShowAndHide?: boolean;\n /**\n * Callback to dynamically adjust show delay and animation behavior.\n */\n getDynamicShowDelay?: () => { showDelay: number; preventAnimation: boolean };\n /**\n * The content displayed inside the dialog.\n */\n content?: (() => JSX.Element) | JSX.Element;\n /**\n * The element to position the dialog beside.\n */\n children?: ReactElement | ReactElement[] | string;\n /**\n * If true, keyboard focus/blur events behave like mouse enter/leave.\n */\n addKeyboardHideShowTriggersByDefault?: boolean;\n /**\n * If true, disables scrolling for the container element.\n */\n disableContainerScroll?: boolean | string;\n /**\n * Enables the observation of content resize for the popper element.\n * When set to `true`, a ResizeObserver is attached to the popper content,\n * automatically triggering repositioning when the size of the content changes.\n *\n * This is useful for dialogs, tooltips, or popovers with dynamic content\n * that may grow or shrink without a re-render being triggered.\n */\n observeContentResize?: boolean;\n /**\n * If true, provides a LayerProvider context for nested dialogs to render correctly.\n * This is useful when you have components that use Dialog internally (like Dropdown)\n * inside another Dialog, ensuring proper z-index stacking and click-outside behavior.\n */\n enableNestedDialogLayer?: boolean;\n}\n\nexport interface DialogState {\n /**\n * If true, the dialog is open.\n */\n isOpen?: boolean;\n /**\n * If true, the dialog state is derived from props.\n */\n shouldUseDerivedStateFromProps?: boolean;\n /**\n * If true, prevents animation when opening or closing the dialog.\n */\n preventAnimation?: boolean;\n}\n\nexport type DialogEvent = React.MouseEvent | React.KeyboardEvent | KeyboardEvent | React.FocusEvent | CustomEvent;\n\nexport default class Dialog extends PureComponent<DialogProps, DialogState> {\n static hideShowTriggers = DialogTriggerEventEnum;\n static positions = DialogPositionEnum;\n static animationTypes = AnimationTypeEnum;\n static defaultProps = {\n position: \"top\",\n modifiers: [] as Modifier<any>[],\n moveBy: { main: 0, secondary: 0 },\n showDelay: 100,\n hideDelay: 100,\n showTrigger: Dialog.hideShowTriggers.MOUSE_ENTER,\n hideTrigger: Dialog.hideShowTriggers.MOUSE_LEAVE,\n showOnDialogEnter: false,\n shouldShowOnMount: false,\n disable: false,\n open: false,\n animationType: Dialog.animationTypes.EXPAND,\n preventAnimationOnMount: false,\n tooltip: false,\n onDialogDidShow: NOOP,\n onDialogDidHide: NOOP,\n onClickOutside: NOOP,\n onContentClick: NOOP,\n useDerivedStateFromProps: false,\n hideWhenReferenceHidden: false,\n shouldCallbackOnMount: false,\n instantShowAndHide: false,\n addKeyboardHideShowTriggersByDefault: false,\n observeContentResize: false,\n enableNestedDialogLayer: false\n };\n private showTimeout: NodeJS.Timeout;\n private hideTimeout: NodeJS.Timeout;\n private containerRef: React.RefObject<HTMLDivElement>;\n context!: React.ContextType<typeof LayerContext>;\n\n constructor(props: DialogProps) {\n super(props);\n this.state = {\n shouldUseDerivedStateFromProps: props.useDerivedStateFromProps,\n isOpen: props.shouldShowOnMount\n };\n\n this.containerRef = React.createRef<HTMLDivElement>();\n\n // Binding section.\n this.onMouseEnter = this.onMouseEnter.bind(this);\n this.onMouseLeave = this.onMouseLeave.bind(this);\n this.onMouseDown = this.onMouseDown.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n this.isShown = this.isShown.bind(this);\n this.onEsc = this.onEsc.bind(this);\n this.onClickOutside = this.onClickOutside.bind(this);\n this.onDialogEnter = this.onDialogEnter.bind(this);\n this.onDialogLeave = this.onDialogLeave.bind(this);\n this.getContainer = this.getContainer.bind(this);\n this.onContentClick = this.onContentClick.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n this.closeDialogOnEscape = this.closeDialogOnEscape.bind(this);\n this.onContextMenu = this.onContextMenu.bind(this);\n this.getDefaultContainer = this.getDefaultContainer.bind(this);\n\n // Timeouts\n this.hideTimeout = null;\n this.showTimeout = null;\n }\n\n closeDialogOnEscape(event: KeyboardEvent) {\n const { isOpen } = this.state;\n if (!isOpen) {\n return;\n }\n switch (event.key) {\n case \"Escape\":\n this.hideDialogIfNeeded(event, DialogTriggerEventEnum.ESCAPE_KEY);\n break;\n case \"Tab\":\n this.handleEvent(DialogTriggerEventEnum.TAB_KEY, event.target, event);\n break;\n case \"Enter\":\n this.handleEvent(DialogTriggerEventEnum.ENTER, event.target, event);\n break;\n default:\n break;\n }\n }\n\n componentDidMount() {\n const { shouldCallbackOnMount, onDialogDidShow } = this.props;\n const { isOpen } = this.state;\n if (isClient()) {\n document.addEventListener(\"keyup\", this.closeDialogOnEscape);\n }\n if (shouldCallbackOnMount && isOpen) {\n onDialogDidShow && onDialogDidShow();\n }\n }\n\n componentWillUnmount() {\n if (isClient()) {\n document.removeEventListener(\"keyup\", this.closeDialogOnEscape);\n }\n if (this.showTimeout) {\n clearTimeout(this.showTimeout);\n this.showTimeout = null;\n }\n if (this.hideTimeout) {\n clearTimeout(this.hideTimeout);\n this.hideTimeout = null;\n }\n }\n\n static getDerivedStateFromProps(nextProps: DialogProps, state: DialogState): DialogState {\n if (state.shouldUseDerivedStateFromProps) {\n return { isOpen: nextProps.isOpen };\n }\n return null;\n }\n\n getDefaultContainer() {\n const { layerRef } = this.context;\n if (layerRef?.current) {\n return layerRef.current;\n }\n return document.body;\n }\n\n getContainer() {\n const { containerSelector } = this.props;\n if (!containerSelector) {\n return this.getDefaultContainer();\n }\n\n const containerElement = document.querySelector(containerSelector);\n if (!containerElement || !(containerElement instanceof Element)) {\n return this.getDefaultContainer();\n }\n return containerElement;\n }\n\n showDialog(event: DialogEvent, eventName: DialogTriggerEvent | string, options: { preventAnimation?: boolean } = {}) {\n const { showDelay, instantShowAndHide, getDynamicShowDelay } = this.props;\n let finalShowDelay = showDelay;\n let preventAnimation = options.preventAnimation;\n if (getDynamicShowDelay) {\n const dynamicDelayObj = getDynamicShowDelay();\n finalShowDelay = dynamicDelayObj.showDelay || 0;\n preventAnimation = preventAnimation || dynamicDelayObj.preventAnimation;\n }\n\n if (instantShowAndHide) {\n this.onShowDialog(event, eventName);\n this.setState({ isOpen: true, preventAnimation });\n this.showTimeout = null;\n } else {\n this.showTimeout = setTimeout(() => {\n this.onShowDialog(event, eventName);\n this.showTimeout = null;\n this.setState({ isOpen: true, preventAnimation });\n }, finalShowDelay);\n }\n }\n\n onShowDialog(event: DialogEvent, eventName: DialogTriggerEvent | string) {\n if (this.isShown()) return;\n const { onDialogDidShow } = this.props;\n onDialogDidShow(event, eventName);\n }\n\n showDialogIfNeeded(event: DialogEvent, eventName: DialogTriggerEvent | string, options = {}) {\n const { disable } = this.props;\n if (disable) {\n return;\n }\n\n if (this.hideTimeout) {\n clearTimeout(this.hideTimeout);\n this.hideTimeout = null;\n }\n\n if (!this.showTimeout) {\n this.showDialog(event, eventName, options);\n }\n }\n\n hideDialog(event: DialogEvent, eventName: DialogTriggerEvent | string) {\n const { hideDelay, instantShowAndHide } = this.props;\n if (instantShowAndHide) {\n this.onHideDialog(event, eventName);\n this.setState({ isOpen: false });\n this.hideTimeout = null;\n } else {\n this.hideTimeout = setTimeout(() => {\n this.onHideDialog(event, eventName);\n this.setState({ isOpen: false });\n this.hideTimeout = null;\n }, hideDelay);\n }\n }\n\n onHideDialog(event: DialogEvent, eventName: DialogTriggerEvent | string) {\n const { onDialogDidHide } = this.props;\n if (onDialogDidHide) onDialogDidHide(event, eventName);\n }\n\n hideDialogIfNeeded(event: DialogEvent, eventName: DialogTriggerEvent | string) {\n if (this.showTimeout) {\n clearTimeout(this.showTimeout);\n this.showTimeout = null;\n }\n\n if (this.hideTimeout) {\n return;\n }\n this.hideDialog(event, eventName);\n }\n\n handleEvent(eventName: DialogTriggerEvent, target: EventTarget, event: DialogEvent) {\n const { showTriggerIgnoreClass, hideTriggerIgnoreClass } = this.props;\n if (\n this.isShowTrigger(eventName) &&\n !this.isShown() &&\n !isInsideClass(target as HTMLElement, showTriggerIgnoreClass)\n ) {\n return this.showDialogIfNeeded(event, eventName);\n }\n\n if (this.isHideTrigger(eventName) && !isInsideClass(target as HTMLElement, hideTriggerIgnoreClass)) {\n return this.hideDialogIfNeeded(event, eventName);\n }\n }\n\n isShown() {\n const { isOpen } = this.state;\n const { open } = this.props;\n\n return isOpen || open;\n }\n\n isShowTrigger(eventName: DialogTriggerEvent) {\n const { showTrigger, addKeyboardHideShowTriggersByDefault } = this.props;\n const showTriggersArray = convertToArray(showTrigger);\n\n if (addKeyboardHideShowTriggersByDefault) {\n if (eventName === \"focus\" && showTriggersArray.indexOf(\"mouseenter\") > -1) {\n return true;\n }\n }\n\n return showTriggersArray.indexOf(eventName) > -1;\n }\n\n isHideTrigger(eventName: DialogTriggerEvent) {\n const { hideTrigger, addKeyboardHideShowTriggersByDefault } = this.props;\n const hideTriggersArray = convertToArray(hideTrigger);\n\n if (addKeyboardHideShowTriggersByDefault) {\n if (eventName === \"blur\" && hideTriggersArray.indexOf(\"mouseleave\") > -1) {\n return true;\n }\n }\n\n return hideTriggersArray.indexOf(eventName) > -1;\n }\n\n onMouseEnter(e: React.MouseEvent) {\n this.handleEvent(\"mouseenter\", e.target, e);\n }\n\n onMouseLeave(e: React.MouseEvent) {\n this.handleEvent(\"mouseleave\", e.target, e);\n }\n\n onClick(e: React.MouseEvent) {\n if (e.button) return;\n this.handleEvent(\"click\", e.target, e);\n }\n\n onKeyDown(event: React.KeyboardEvent) {\n if (event.key === \"Enter\") {\n this.handleEvent(\"enter\", event.target, event);\n }\n\n if (event.key === \"Tab\") {\n this.handleEvent(\"tab\", event.target, event);\n }\n }\n\n onMouseDown(e: React.MouseEvent) {\n if (e.button) return;\n this.handleEvent(\"mousedown\", e.target, e);\n }\n\n onFocus(e: React.FocusEvent) {\n this.handleEvent(\"focus\", e.target, e);\n }\n\n onBlur(e: React.FocusEvent) {\n this.handleEvent(\"blur\", e.relatedTarget, e);\n }\n\n onEsc(e: React.KeyboardEvent) {\n this.handleEvent(\"esckey\", e.target, e);\n }\n\n onContextMenu(e: React.MouseEvent) {\n const isShown = this.isShown();\n if ((this.isShowTrigger(\"contextmenu\") && !isShown) || (this.isHideTrigger(\"contextmenu\") && isShown)) {\n e.preventDefault();\n }\n this.handleEvent(\"contextmenu\", e.target, e);\n }\n\n onClickOutside(event: React.MouseEvent) {\n const { onClickOutside } = this.props;\n this.handleEvent(\"clickoutside\", event.target, event);\n onClickOutside(event);\n }\n\n onDialogEnter(event: React.MouseEvent) {\n const { showOnDialogEnter } = this.props;\n if (showOnDialogEnter) this.showDialogIfNeeded(event, \"DialogEnter\");\n }\n\n onDialogLeave(event: React.MouseEvent) {\n const { showOnDialogEnter } = this.props;\n if (showOnDialogEnter) this.hideDialogIfNeeded(event, \"DialogLeave\");\n }\n\n onContentClick(e: React.MouseEvent) {\n const { onContentClick } = this.props;\n this.handleEvent(\"onContentClick\", e.target, e);\n onContentClick(e);\n }\n\n render() {\n const {\n wrapperClassName,\n content,\n startingEdge,\n children,\n preventAnimationOnMount,\n animationType,\n position,\n showDelay,\n moveBy,\n modifiers,\n tooltip,\n tooltipClassName,\n referenceWrapperClassName,\n referenceWrapperElement,\n zIndex,\n hideWhenReferenceHidden,\n disableContainerScroll,\n containerSelector,\n observeContentResize,\n enableNestedDialogLayer,\n id,\n \"data-testid\": dataTestId\n } = this.props;\n const { preventAnimation } = this.state;\n const overrideDataTestId = dataTestId || getTestId(ComponentDefaultTestId.DIALOG, id);\n\n const animationTypeCalculated = preventAnimationOnMount || preventAnimation ? undefined : animationType;\n const contentRendered = isFunction(content) ? content() : content;\n\n if (!contentRendered) {\n return children;\n }\n return (\n <Manager>\n <Reference>\n {({ ref }) => {\n return (\n <Refable\n className={cx(referenceWrapperClassName)}\n wrapperElement={referenceWrapperElement}\n ref={ref}\n onBlur={chainOnPropsAndInstance(\"onBlur\", this, this.props)}\n onKeyDown={chainOnPropsAndInstance(\"onKeyDown\", this, this.props)}\n onClick={chainOnPropsAndInstance(\"onClick\", this, this.props)}\n onFocus={chainOnPropsAndInstance(\"onFocus\", this, this.props)}\n onMouseDown={chainOnPropsAndInstance(\"onMouseDown\", this, this.props)}\n onMouseEnter={chainOnPropsAndInstance(\"onMouseEnter\", this, this.props)}\n onMouseLeave={chainOnPropsAndInstance(\"onMouseLeave\", this, this.props)}\n onContextMenu={chainOnPropsAndInstance(\"onContextMenu\", this, this.props)}\n >\n {children}\n </Refable>\n );\n }}\n </Reference>\n {isClient() &&\n createPortal(\n <Popper\n placement={position as unknown as PopperJS.Placement}\n modifiers={[\n {\n name: \"offset\",\n options: {\n offset: [moveBy.secondary, moveBy.main]\n }\n },\n {\n name: \"zIndex\",\n enabled: true,\n phase: \"write\",\n fn({ state }) {\n if (zIndex) {\n state.styles.popper.zIndex = String(zIndex);\n }\n return state;\n }\n },\n {\n name: \"rotator\",\n enabled: true,\n phase: \"write\",\n fn({ state }) {\n if (!state.styles.arrow) {\n return state;\n }\n // const reg = new RegExp(\n // /translate\\(([0-9].*)px, ([0-9].*)px\\)/\n // );\n // const transform = state.styles.arrow.transform;\n // const res = reg.exec(transform);\n // state.styles.popper.transformOrigin = `${100 -\n // res[1]}% ${100 - res[2]}%`;\n state.styles.arrow.transform = `${state.styles.arrow.transform} rotate(45deg)`;\n return state;\n }\n },\n createObserveContentResizeModifier(observeContentResize),\n ...modifiers\n ]}\n >\n {({ placement, style, ref, arrowProps, isReferenceHidden }) => {\n if (!this.isShown() && placement) {\n return null;\n }\n\n if (hideWhenReferenceHidden && isReferenceHidden) {\n const event = new CustomEvent(\"onReferenceHidden\");\n this.hideDialog(event, \"onReferenceHidden\");\n }\n\n const mergedRef = chainRefFunctions([ref, this.containerRef]);\n\n const dialogContent = (\n <DialogContent\n data-testid={overrideDataTestId}\n isReferenceHidden={hideWhenReferenceHidden && isReferenceHidden}\n onMouseEnter={this.onDialogEnter}\n onMouseLeave={this.onDialogLeave}\n onClickOutside={this.onClickOutside}\n onContextMenu={this.onContextMenu}\n onEsc={this.onEsc}\n animationType={animationTypeCalculated}\n position={placement}\n wrapperClassName={wrapperClassName}\n startingEdge={startingEdge}\n isOpen={this.isShown()}\n showDelay={showDelay}\n styleObject={style}\n ref={mergedRef}\n onClick={this.onContentClick}\n hasTooltip={!!tooltip}\n containerSelector={containerSelector}\n disableContainerScroll={disableContainerScroll}\n >\n {contentRendered}\n {tooltip && (\n <div\n style={arrowProps.style}\n ref={arrowProps.ref}\n className={cx(styles.arrow, tooltipClassName)}\n data-placement={placement}\n />\n )}\n </DialogContent>\n );\n\n return enableNestedDialogLayer ? (\n <LayerProvider layerRef={this.containerRef}>{dialogContent}</LayerProvider>\n ) : (\n dialogContent\n );\n }}\n </Popper>,\n this.getContainer()\n )}\n </Manager>\n );\n }\n}\n\nfunction chainOnPropsAndInstance(name: string, instance: Dialog, props: DialogProps) {\n // @ts-ignore\n return chainFunctions([props[name], instance[name]], true);\n}\n\nDialog.contextType = LayerContext;\n"],"names":["Dialog","_PureComponent","props","_this","_classCallCheck","_callSuper","state","shouldUseDerivedStateFromProps","useDerivedStateFromProps","isOpen","shouldShowOnMount","containerRef","React","createRef","onMouseEnter","bind","onMouseLeave","onMouseDown","onClick","onFocus","onBlur","isShown","onEsc","onClickOutside","onDialogEnter","onDialogLeave","getContainer","onContentClick","onKeyDown","closeDialogOnEscape","onContextMenu","getDefaultContainer","hideTimeout","showTimeout","_inherits","PureComponent","_createClass","key","value","event","this","hideDialogIfNeeded","DialogTriggerEventEnum","ESCAPE_KEY","handleEvent","TAB_KEY","target","ENTER","_this$props","shouldCallbackOnMount","onDialogDidShow","isClient","document","addEventListener","removeEventListener","clearTimeout","layerRef","context","current","body","containerSelector","containerElement","querySelector","Element","eventName","_this2","_this$props2","instantShowAndHide","getDynamicShowDelay","finalShowDelay","showDelay","preventAnimation","dynamicDelayObj","onShowDialog","setState","setTimeout","options","arguments","length","undefined","disable","showDialog","_this3","_this$props3","hideDelay","onHideDialog","onDialogDidHide","hideDialog","_this$props4","showTriggerIgnoreClass","hideTriggerIgnoreClass","isShowTrigger","isInsideClass","isHideTrigger","showDialogIfNeeded","open","_this$props5","addKeyboardHideShowTriggersByDefault","showTriggersArray","convertToArray","showTrigger","indexOf","_this$props6","hideTriggersArray","hideTrigger","e","button","relatedTarget","preventDefault","showOnDialogEnter","_this4","_this$props7","wrapperClassName","content","startingEdge","children","preventAnimationOnMount","animationType","position","moveBy","modifiers","tooltip","tooltipClassName","referenceWrapperClassName","referenceWrapperElement","zIndex","hideWhenReferenceHidden","disableContainerScroll","observeContentResize","enableNestedDialogLayer","overrideDataTestId","getTestId","ComponentDefaultTestId","DIALOG","id","animationTypeCalculated","contentRendered","isFunction","Manager","createElement","Reference","_ref","ref","Refable","className","cx","wrapperElement","chainOnPropsAndInstance","createPortal","Popper","placement","name","offset","secondary","main","enabled","phase","fn","_ref2","styles","popper","String","_ref3","arrow","transform","concat","createObserveContentResizeModifier","_toConsumableArray","_ref4","style","arrowProps","isReferenceHidden","CustomEvent","mergedRef","chainRefFunctions","dialogContent","DialogContent","styleObject","hasTooltip","LayerProvider","nextProps","instance","chainFunctions","hideShowTriggers","positions","DialogPositionEnum","animationTypes","AnimationTypeEnum","defaultProps","MOUSE_ENTER","MOUSE_LEAVE","EXPAND","NOOP","contextType","LayerContext"],"mappings":"gkCAkNqBA,IAAAA,WAAOC,GAoC1B,SAAAD,EAAYE,GAAkB,IAAAC,EA8BJ,OA9BIC,OAAAJ,IAC5BG,EAAAE,E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eAAgBqK,EAChBxL,0BAA0B,EAC1BsH,yBAAyB,EACzB7E,uBAAuB,EACvBkB,oBAAoB,EACpB8B,sCAAsC,EACtC+B,sBAAsB,EACtBC,yBAAyB,GA2d7BjI,EAAOiM,YAAcC"}
1
+ {"version":3,"file":"Dialog.js","sources":["../../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { PureComponent, type ReactElement } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Manager, type Modifier, Popper, Reference } from \"react-popper\";\nimport { isFunction } from \"es-toolkit\";\nimport { chainFunctions, chainRefFunctions, convertToArray, NOOP } from \"../../utils/function-utils\";\nimport DialogContent from \"./DialogContent/DialogContent\";\nimport { isInsideClass } from \"../../utils/dom-utils\";\nimport { Refable } from \"../Refable/Refable\";\nimport {\n AnimationType as AnimationTypeEnum,\n HideShowEvent as DialogTriggerEventEnum,\n DialogPosition as DialogPositionEnum\n} from \"./DialogConstants\";\nimport { type VibeComponentProps } from \"../../types\";\nimport type * as PopperJS from \"@popperjs/core\";\nimport styles from \"./Dialog.module.scss\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport { type DialogAnimationType, type DialogPosition, type DialogTriggerEvent } from \"./Dialog.types\";\nimport LayerContext from \"../LayerProvider/LayerContext\";\nimport { LayerProvider } from \"../LayerProvider\";\nimport { isClient } from \"../../utils/ssr-utils\";\nimport { createObserveContentResizeModifier } from \"./modifiers/observeContentResizeModifier\";\n\nexport interface DialogProps extends VibeComponentProps {\n /**\n * Class name applied to the reference wrapper element.\n */\n referenceWrapperClassName?: string;\n /**\n * The wrapper element type to use for React components. Defaults to \"span\".\n */\n referenceWrapperElement?: \"span\" | \"div\";\n /**\n * The placement of the dialog relative to the reference element.\n */\n position?: DialogPosition;\n /**\n * Custom Popper.js modifiers.\n * https://popper.js.org/docs/v2/modifiers/\n */\n modifiers?: Modifier<any>[];\n /**\n * The starting edge of the dialog.\n */\n startingEdge?: string;\n /**\n * Offset values for positioning adjustments.\n * `main` - horizontal offset\n * `secondary` - vertical offset\n */\n moveBy?: { main?: number; secondary?: number };\n /**\n * Delay in milliseconds before showing the dialog.\n */\n showDelay?: number;\n /**\n * Delay in milliseconds before hiding the dialog.\n */\n hideDelay?: number;\n /**\n * Events that trigger showing the dialog.\n */\n showTrigger?: DialogTriggerEvent | DialogTriggerEvent[];\n /**\n * Events that trigger hiding the dialog.\n */\n hideTrigger?: DialogTriggerEvent | DialogTriggerEvent[];\n /**\n * If true, prevents closing the dialog when the mouse enters it.\n */\n showOnDialogEnter?: boolean;\n /**\n * If true, shows the dialog when the component mounts.\n */\n shouldShowOnMount?: boolean;\n /**\n * If true, disables opening the dialog.\n */\n disable?: boolean;\n /**\n * Controls the open state of the dialog.\n */\n open?: boolean;\n /**\n * Derived state control for managing dialog visibility.\n */\n isOpen?: boolean;\n /**\n * Classes that prevent showing the dialog when present.\n */\n showTriggerIgnoreClass?: string | Array<string>;\n /**\n * Classes that prevent hiding the dialog when present.\n */\n hideTriggerIgnoreClass?: string | Array<string>;\n /**\n * The animation type used for the dialog.\n */\n animationType?: DialogAnimationType;\n /**\n * Class name applied to the dialog content container.\n */\n wrapperClassName?: string;\n /**\n * If true, prevents animation when mounting.\n */\n preventAnimationOnMount?: boolean;\n /**\n * The CSS selector of the container where the dialog is rendered.\n */\n containerSelector?: string;\n /**\n * If true, positions the tooltip element.\n */\n tooltip?: boolean;\n /**\n * Class name applied to the tooltip element.\n */\n tooltipClassName?: string;\n /**\n * Callback fired when the dialog is shown.\n */\n onDialogDidShow?: (event?: DialogEvent, eventName?: DialogTriggerEvent | string) => void;\n /**\n * Callback fired when the dialog is hidden.\n */\n onDialogDidHide?: (event: DialogEvent, eventName: DialogTriggerEvent | string) => void;\n /**\n * Callback fired when clicking outside the dialog.\n */\n onClickOutside?: (event: React.MouseEvent) => void;\n /**\n * Callback fired when clicking inside the dialog content.\n */\n onContentClick?: (event: React.MouseEvent) => void;\n /**\n * The z-index applied to the dialog.\n */\n zIndex?: number;\n /**\n * If true, uses derived state from props.\n */\n useDerivedStateFromProps?: boolean;\n /**\n * If true, makes the dialog disappear when the reference element is hidden.\n */\n hideWhenReferenceHidden?: boolean;\n /**\n * If true, triggers the callback when the dialog mounts.\n */\n shouldCallbackOnMount?: boolean;\n /**\n * If true, instantly shows and hides the dialog without delay.\n */\n instantShowAndHide?: boolean;\n /**\n * Callback to dynamically adjust show delay and animation behavior.\n */\n getDynamicShowDelay?: () => { showDelay: number; preventAnimation: boolean };\n /**\n * The content displayed inside the dialog.\n */\n content?: (() => JSX.Element) | JSX.Element;\n /**\n * The element to position the dialog beside.\n */\n children?: ReactElement | ReactElement[] | string;\n /**\n * If true, keyboard focus/blur events behave like mouse enter/leave.\n */\n addKeyboardHideShowTriggersByDefault?: boolean;\n /**\n * If true, disables scrolling for the container element.\n */\n disableContainerScroll?: boolean | string;\n /**\n * Enables the observation of content resize for the popper element.\n * When set to `true`, a ResizeObserver is attached to the popper content,\n * automatically triggering repositioning when the size of the content changes.\n *\n * This is useful for dialogs, tooltips, or popovers with dynamic content\n * that may grow or shrink without a re-render being triggered.\n */\n observeContentResize?: boolean;\n}\n\nexport interface DialogState {\n /**\n * If true, the dialog is open.\n */\n isOpen?: boolean;\n /**\n * If true, the dialog state is derived from props.\n */\n shouldUseDerivedStateFromProps?: boolean;\n /**\n * If true, prevents animation when opening or closing the dialog.\n */\n preventAnimation?: boolean;\n}\n\nexport type DialogEvent = React.MouseEvent | React.KeyboardEvent | KeyboardEvent | React.FocusEvent | CustomEvent;\n\nexport default class Dialog extends PureComponent<DialogProps, DialogState> {\n static hideShowTriggers = DialogTriggerEventEnum;\n static positions = DialogPositionEnum;\n static animationTypes = AnimationTypeEnum;\n static defaultProps = {\n position: \"top\",\n modifiers: [] as Modifier<any>[],\n moveBy: { main: 0, secondary: 0 },\n showDelay: 100,\n hideDelay: 100,\n showTrigger: Dialog.hideShowTriggers.MOUSE_ENTER,\n hideTrigger: Dialog.hideShowTriggers.MOUSE_LEAVE,\n showOnDialogEnter: false,\n shouldShowOnMount: false,\n disable: false,\n open: false,\n animationType: Dialog.animationTypes.EXPAND,\n preventAnimationOnMount: false,\n tooltip: false,\n onDialogDidShow: NOOP,\n onDialogDidHide: NOOP,\n onClickOutside: NOOP,\n onContentClick: NOOP,\n useDerivedStateFromProps: false,\n hideWhenReferenceHidden: false,\n shouldCallbackOnMount: false,\n instantShowAndHide: false,\n addKeyboardHideShowTriggersByDefault: false,\n observeContentResize: false\n };\n private showTimeout: NodeJS.Timeout;\n private hideTimeout: NodeJS.Timeout;\n private containerRef: React.RefObject<HTMLDivElement>;\n context!: React.ContextType<typeof LayerContext>;\n\n constructor(props: DialogProps) {\n super(props);\n this.state = {\n shouldUseDerivedStateFromProps: props.useDerivedStateFromProps,\n isOpen: props.shouldShowOnMount\n };\n\n this.containerRef = React.createRef<HTMLDivElement>();\n\n // Binding section.\n this.onMouseEnter = this.onMouseEnter.bind(this);\n this.onMouseLeave = this.onMouseLeave.bind(this);\n this.onMouseDown = this.onMouseDown.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n this.isShown = this.isShown.bind(this);\n this.onEsc = this.onEsc.bind(this);\n this.onClickOutside = this.onClickOutside.bind(this);\n this.onDialogEnter = this.onDialogEnter.bind(this);\n this.onDialogLeave = this.onDialogLeave.bind(this);\n this.getContainer = this.getContainer.bind(this);\n this.onContentClick = this.onContentClick.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n this.closeDialogOnEscape = this.closeDialogOnEscape.bind(this);\n this.onContextMenu = this.onContextMenu.bind(this);\n this.getDefaultContainer = this.getDefaultContainer.bind(this);\n\n // Timeouts\n this.hideTimeout = null;\n this.showTimeout = null;\n }\n\n closeDialogOnEscape(event: KeyboardEvent) {\n const { isOpen } = this.state;\n if (!isOpen) {\n return;\n }\n switch (event.key) {\n case \"Escape\":\n this.hideDialogIfNeeded(event, DialogTriggerEventEnum.ESCAPE_KEY);\n break;\n case \"Tab\":\n this.handleEvent(DialogTriggerEventEnum.TAB_KEY, event.target, event);\n break;\n case \"Enter\":\n this.handleEvent(DialogTriggerEventEnum.ENTER, event.target, event);\n break;\n default:\n break;\n }\n }\n\n componentDidMount() {\n const { shouldCallbackOnMount, onDialogDidShow } = this.props;\n const { isOpen } = this.state;\n if (isClient()) {\n document.addEventListener(\"keyup\", this.closeDialogOnEscape);\n }\n if (shouldCallbackOnMount && isOpen) {\n onDialogDidShow && onDialogDidShow();\n }\n }\n\n componentWillUnmount() {\n if (isClient()) {\n document.removeEventListener(\"keyup\", this.closeDialogOnEscape);\n }\n if (this.showTimeout) {\n clearTimeout(this.showTimeout);\n this.showTimeout = null;\n }\n if (this.hideTimeout) {\n clearTimeout(this.hideTimeout);\n this.hideTimeout = null;\n }\n }\n\n static getDerivedStateFromProps(nextProps: DialogProps, state: DialogState): DialogState {\n if (state.shouldUseDerivedStateFromProps) {\n return { isOpen: nextProps.isOpen };\n }\n return null;\n }\n\n getDefaultContainer() {\n const { layerRef } = this.context;\n if (layerRef?.current) {\n return layerRef.current;\n }\n return document.body;\n }\n\n getContainer() {\n const { containerSelector } = this.props;\n if (!containerSelector) {\n return this.getDefaultContainer();\n }\n\n const containerElement = document.querySelector(containerSelector);\n if (!containerElement || !(containerElement instanceof Element)) {\n return this.getDefaultContainer();\n }\n return containerElement;\n }\n\n showDialog(event: DialogEvent, eventName: DialogTriggerEvent | string, options: { preventAnimation?: boolean } = {}) {\n const { showDelay, instantShowAndHide, getDynamicShowDelay } = this.props;\n let finalShowDelay = showDelay;\n let preventAnimation = options.preventAnimation;\n if (getDynamicShowDelay) {\n const dynamicDelayObj = getDynamicShowDelay();\n finalShowDelay = dynamicDelayObj.showDelay || 0;\n preventAnimation = preventAnimation || dynamicDelayObj.preventAnimation;\n }\n\n if (instantShowAndHide) {\n this.onShowDialog(event, eventName);\n this.setState({ isOpen: true, preventAnimation });\n this.showTimeout = null;\n } else {\n this.showTimeout = setTimeout(() => {\n this.onShowDialog(event, eventName);\n this.showTimeout = null;\n this.setState({ isOpen: true, preventAnimation });\n }, finalShowDelay);\n }\n }\n\n onShowDialog(event: DialogEvent, eventName: DialogTriggerEvent | string) {\n if (this.isShown()) return;\n const { onDialogDidShow } = this.props;\n onDialogDidShow(event, eventName);\n }\n\n showDialogIfNeeded(event: DialogEvent, eventName: DialogTriggerEvent | string, options = {}) {\n const { disable } = this.props;\n if (disable) {\n return;\n }\n\n if (this.hideTimeout) {\n clearTimeout(this.hideTimeout);\n this.hideTimeout = null;\n }\n\n if (!this.showTimeout) {\n this.showDialog(event, eventName, options);\n }\n }\n\n hideDialog(event: DialogEvent, eventName: DialogTriggerEvent | string) {\n const { hideDelay, instantShowAndHide } = this.props;\n if (instantShowAndHide) {\n this.onHideDialog(event, eventName);\n this.setState({ isOpen: false });\n this.hideTimeout = null;\n } else {\n this.hideTimeout = setTimeout(() => {\n this.onHideDialog(event, eventName);\n this.setState({ isOpen: false });\n this.hideTimeout = null;\n }, hideDelay);\n }\n }\n\n onHideDialog(event: DialogEvent, eventName: DialogTriggerEvent | string) {\n const { onDialogDidHide } = this.props;\n if (onDialogDidHide) onDialogDidHide(event, eventName);\n }\n\n hideDialogIfNeeded(event: DialogEvent, eventName: DialogTriggerEvent | string) {\n if (this.showTimeout) {\n clearTimeout(this.showTimeout);\n this.showTimeout = null;\n }\n\n if (this.hideTimeout) {\n return;\n }\n this.hideDialog(event, eventName);\n }\n\n handleEvent(eventName: DialogTriggerEvent, target: EventTarget, event: DialogEvent) {\n const { showTriggerIgnoreClass, hideTriggerIgnoreClass } = this.props;\n if (\n this.isShowTrigger(eventName) &&\n !this.isShown() &&\n !isInsideClass(target as HTMLElement, showTriggerIgnoreClass)\n ) {\n return this.showDialogIfNeeded(event, eventName);\n }\n\n if (this.isHideTrigger(eventName) && !isInsideClass(target as HTMLElement, hideTriggerIgnoreClass)) {\n return this.hideDialogIfNeeded(event, eventName);\n }\n }\n\n isShown() {\n const { isOpen } = this.state;\n const { open } = this.props;\n\n return isOpen || open;\n }\n\n isShowTrigger(eventName: DialogTriggerEvent) {\n const { showTrigger, addKeyboardHideShowTriggersByDefault } = this.props;\n const showTriggersArray = convertToArray(showTrigger);\n\n if (addKeyboardHideShowTriggersByDefault) {\n if (eventName === \"focus\" && showTriggersArray.indexOf(\"mouseenter\") > -1) {\n return true;\n }\n }\n\n return showTriggersArray.indexOf(eventName) > -1;\n }\n\n isHideTrigger(eventName: DialogTriggerEvent) {\n const { hideTrigger, addKeyboardHideShowTriggersByDefault } = this.props;\n const hideTriggersArray = convertToArray(hideTrigger);\n\n if (addKeyboardHideShowTriggersByDefault) {\n if (eventName === \"blur\" && hideTriggersArray.indexOf(\"mouseleave\") > -1) {\n return true;\n }\n }\n\n return hideTriggersArray.indexOf(eventName) > -1;\n }\n\n onMouseEnter(e: React.MouseEvent) {\n this.handleEvent(\"mouseenter\", e.target, e);\n }\n\n onMouseLeave(e: React.MouseEvent) {\n this.handleEvent(\"mouseleave\", e.target, e);\n }\n\n onClick(e: React.MouseEvent) {\n if (e.button) return;\n this.handleEvent(\"click\", e.target, e);\n }\n\n onKeyDown(event: React.KeyboardEvent) {\n if (event.key === \"Enter\") {\n this.handleEvent(\"enter\", event.target, event);\n }\n\n if (event.key === \"Tab\") {\n this.handleEvent(\"tab\", event.target, event);\n }\n }\n\n onMouseDown(e: React.MouseEvent) {\n if (e.button) return;\n this.handleEvent(\"mousedown\", e.target, e);\n }\n\n onFocus(e: React.FocusEvent) {\n this.handleEvent(\"focus\", e.target, e);\n }\n\n onBlur(e: React.FocusEvent) {\n this.handleEvent(\"blur\", e.relatedTarget, e);\n }\n\n onEsc(e: React.KeyboardEvent) {\n this.handleEvent(\"esckey\", e.target, e);\n }\n\n onContextMenu(e: React.MouseEvent) {\n const isShown = this.isShown();\n if ((this.isShowTrigger(\"contextmenu\") && !isShown) || (this.isHideTrigger(\"contextmenu\") && isShown)) {\n e.preventDefault();\n }\n this.handleEvent(\"contextmenu\", e.target, e);\n }\n\n onClickOutside(event: React.MouseEvent) {\n const { onClickOutside } = this.props;\n this.handleEvent(\"clickoutside\", event.target, event);\n onClickOutside(event);\n }\n\n onDialogEnter(event: React.MouseEvent) {\n const { showOnDialogEnter } = this.props;\n if (showOnDialogEnter) this.showDialogIfNeeded(event, \"DialogEnter\");\n }\n\n onDialogLeave(event: React.MouseEvent) {\n const { showOnDialogEnter } = this.props;\n if (showOnDialogEnter) this.hideDialogIfNeeded(event, \"DialogLeave\");\n }\n\n onContentClick(e: React.MouseEvent) {\n const { onContentClick } = this.props;\n this.handleEvent(\"onContentClick\", e.target, e);\n onContentClick(e);\n }\n\n render() {\n const {\n wrapperClassName,\n content,\n startingEdge,\n children,\n preventAnimationOnMount,\n animationType,\n position,\n showDelay,\n moveBy,\n modifiers,\n tooltip,\n tooltipClassName,\n referenceWrapperClassName,\n referenceWrapperElement,\n zIndex,\n hideWhenReferenceHidden,\n disableContainerScroll,\n containerSelector,\n observeContentResize,\n id,\n \"data-testid\": dataTestId\n } = this.props;\n const { preventAnimation } = this.state;\n const overrideDataTestId = dataTestId || getTestId(ComponentDefaultTestId.DIALOG, id);\n\n const animationTypeCalculated = preventAnimationOnMount || preventAnimation ? undefined : animationType;\n const contentRendered = isFunction(content) ? content() : content;\n\n if (!contentRendered) {\n return children;\n }\n return (\n <Manager>\n <Reference>\n {({ ref }) => {\n return (\n <Refable\n className={cx(referenceWrapperClassName)}\n wrapperElement={referenceWrapperElement}\n ref={ref}\n onBlur={chainOnPropsAndInstance(\"onBlur\", this, this.props)}\n onKeyDown={chainOnPropsAndInstance(\"onKeyDown\", this, this.props)}\n onClick={chainOnPropsAndInstance(\"onClick\", this, this.props)}\n onFocus={chainOnPropsAndInstance(\"onFocus\", this, this.props)}\n onMouseDown={chainOnPropsAndInstance(\"onMouseDown\", this, this.props)}\n onMouseEnter={chainOnPropsAndInstance(\"onMouseEnter\", this, this.props)}\n onMouseLeave={chainOnPropsAndInstance(\"onMouseLeave\", this, this.props)}\n onContextMenu={chainOnPropsAndInstance(\"onContextMenu\", this, this.props)}\n >\n {children}\n </Refable>\n );\n }}\n </Reference>\n {isClient() &&\n createPortal(\n <Popper\n placement={position as unknown as PopperJS.Placement}\n modifiers={[\n {\n name: \"offset\",\n options: {\n offset: [moveBy.secondary, moveBy.main]\n }\n },\n {\n name: \"zIndex\",\n enabled: true,\n phase: \"write\",\n fn({ state }) {\n if (zIndex) {\n state.styles.popper.zIndex = String(zIndex);\n }\n return state;\n }\n },\n {\n name: \"rotator\",\n enabled: true,\n phase: \"write\",\n fn({ state }) {\n if (!state.styles.arrow) {\n return state;\n }\n // const reg = new RegExp(\n // /translate\\(([0-9].*)px, ([0-9].*)px\\)/\n // );\n // const transform = state.styles.arrow.transform;\n // const res = reg.exec(transform);\n // state.styles.popper.transformOrigin = `${100 -\n // res[1]}% ${100 - res[2]}%`;\n state.styles.arrow.transform = `${state.styles.arrow.transform} rotate(45deg)`;\n return state;\n }\n },\n createObserveContentResizeModifier(observeContentResize),\n ...modifiers\n ]}\n >\n {({ placement, style, ref, arrowProps, isReferenceHidden }) => {\n if (!this.isShown() && placement) {\n return null;\n }\n\n if (hideWhenReferenceHidden && isReferenceHidden) {\n const event = new CustomEvent(\"onReferenceHidden\");\n this.hideDialog(event, \"onReferenceHidden\");\n }\n\n const mergedRef = chainRefFunctions([ref, this.containerRef]);\n\n return (\n <LayerProvider layerRef={this.containerRef}>\n <DialogContent\n data-testid={overrideDataTestId}\n isReferenceHidden={hideWhenReferenceHidden && isReferenceHidden}\n onMouseEnter={this.onDialogEnter}\n onMouseLeave={this.onDialogLeave}\n onClickOutside={this.onClickOutside}\n onContextMenu={this.onContextMenu}\n onEsc={this.onEsc}\n animationType={animationTypeCalculated}\n position={placement}\n wrapperClassName={wrapperClassName}\n startingEdge={startingEdge}\n isOpen={this.isShown()}\n showDelay={showDelay}\n styleObject={style}\n ref={mergedRef}\n onClick={this.onContentClick}\n hasTooltip={!!tooltip}\n containerSelector={containerSelector}\n disableContainerScroll={disableContainerScroll}\n >\n {contentRendered}\n {tooltip && (\n <div\n style={arrowProps.style}\n ref={arrowProps.ref}\n className={cx(styles.arrow, tooltipClassName)}\n data-placement={placement}\n />\n )}\n </DialogContent>\n </LayerProvider>\n );\n }}\n </Popper>,\n this.getContainer()\n )}\n </Manager>\n );\n }\n}\n\nfunction chainOnPropsAndInstance(name: string, instance: Dialog, props: DialogProps) {\n // @ts-ignore\n return chainFunctions([props[name], instance[name]], true);\n}\n\nDialog.contextType = LayerContext;\n"],"names":["Dialog","_PureComponent","props","_this","_classCallCheck","_callSuper","state","shouldUseDerivedStateFromProps","useDerivedStateFromProps","isOpen","shouldShowOnMount","containerRef","React","createRef","onMouseEnter","bind","onMouseLeave","onMouseDown","onClick","onFocus","onBlur","isShown","onEsc","onClickOutside","onDialogEnter","onDialogLeave","getContainer","onContentClick","onKeyDown","closeDialogOnEscape","onContextMenu","getDefaultContainer","hideTimeout","showTimeout","_inherits","PureComponent","_createClass","key","value","event","this","hideDialogIfNeeded","DialogTriggerEventEnum","ESCAPE_KEY","handleEvent","TAB_KEY","target","ENTER","_this$props","shouldCallbackOnMount","onDialogDidShow","isClient","document","addEventListener","removeEventListener","clearTimeout","layerRef","context","current","body","containerSelector","containerElement","querySelector","Element","eventName","_this2","_this$props2","instantShowAndHide","getDynamicShowDelay","finalShowDelay","showDelay","preventAnimation","dynamicDelayObj","onShowDialog","setState","setTimeout","options","arguments","length","undefined","disable","showDialog","_this3","_this$props3","hideDelay","onHideDialog","onDialogDidHide","hideDialog","_this$props4","showTriggerIgnoreClass","hideTriggerIgnoreClass","isShowTrigger","isInsideClass","isHideTrigger","showDialogIfNeeded","open","_this$props5","addKeyboardHideShowTriggersByDefault","showTriggersArray","convertToArray","showTrigger","indexOf","_this$props6","hideTriggersArray","hideTrigger","e","button","relatedTarget","preventDefault","showOnDialogEnter","_this4","_this$props7","wrapperClassName","content","startingEdge","children","preventAnimationOnMount","animationType","position","moveBy","modifiers","tooltip","tooltipClassName","referenceWrapperClassName","referenceWrapperElement","zIndex","hideWhenReferenceHidden","disableContainerScroll","observeContentResize","overrideDataTestId","getTestId","ComponentDefaultTestId","DIALOG","id","animationTypeCalculated","contentRendered","isFunction","Manager","createElement","Reference","_ref","ref","Refable","className","cx","wrapperElement","chainOnPropsAndInstance","createPortal","Popper","placement","name","offset","secondary","main","enabled","phase","fn","_ref2","styles","popper","String","_ref3","arrow","transform","concat","createObserveContentResizeModifier","_toConsumableArray","_ref4","style","arrowProps","isReferenceHidden","CustomEvent","mergedRef","chainRefFunctions","LayerProvider","DialogContent","styleObject","hasTooltip","nextProps","instance","chainFunctions","hideShowTriggers","positions","DialogPositionEnum","animationTypes","AnimationTypeEnum","defaultProps","MOUSE_ENTER","MOUSE_LEAVE","EXPAND","NOOP","contextType","LayerContext"],"mappings":"gkCA4MqBA,IAAAA,WAAOC,GAmC1B,SAAAD,EAAYE,GAAkB,IAAAC,EA8BJ,OA9BIC,OAAAJ,IAC5BG,EAAAE,EAAAL,KAAAA,GAAME,KACDI,MAAQ,CACXC,+BAAgCL,EAAMM,yBACtCC,OAAQP,EAAMQ,mBAGhBP,EAAKQ,aAAeC,EAAMC,YAG1BV,EAAKW,aAAeX,EAAKW,aAAaC,KAAIZ,GAC1CA,EAAKa,aAAeb,EAAKa,aAAaD,KAAIZ,GAC1CA,EAAKc,YAAcd,EAAKc,YAAYF,KAAIZ,GACxCA,EAAKe,QAAUf,EAAKe,QAAQH,KAAIZ,GAChCA,EAAKgB,QAAUhB,EAAKgB,QAAQJ,KAAIZ,GAChCA,EAAKiB,OAASjB,EAAKiB,OAAOL,KAAIZ,GAC9BA,EAAKkB,QAAUlB,EAAKkB,QAAQN,KAAIZ,GAChCA,EAAKmB,MAAQnB,EAAKmB,MAAMP,KAAIZ,GAC5BA,EAAKoB,eAAiBpB,EAAKoB,eAAeR,KAAIZ,GAC9CA,EAAKqB,cAAgBrB,EAAKqB,cAAcT,KAAIZ,GAC5CA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IAAC,IAuXH,SAASyI,EAAwBI,EAAc6B,EAAkBjL,GAE/D,OAAOkL,EAAe,CAAClL,EAAMoJ,GAAO6B,EAAS7B,KAAQ,EACvD,CA/eStJ,EAAgBqL,iBAAG3I,EACnB1C,EAASsL,UAAGC,EACZvL,EAAcwL,eAAGC,EACjBzL,EAAA0L,aAAe,CACpBpE,SAAU,MACVE,UAAW,GACXD,OAAQ,CAAEkC,KAAM,EAAGD,UAAW,GAC9BlF,UAAW,IACXc,UAAW,IACXgB,YAAapG,EAAOqL,iBAAiBM,YACrCnF,YAAaxG,EAAOqL,iBAAiBO,YACrC/E,mBAAmB,EACnBnG,mBAAmB,EACnBsE,SAAS,EACTe,MAAM,EACNsB,cAAerH,EAAOwL,eAAeK,OACrCzE,yBAAyB,EACzBK,SAAS,EACTvE,gBAAiB4I,EACjBxG,gBAAiBwG,EACjBvK,eAAgBuK,EAChBnK,eAAgBmK,EAChBtL,0BAA0B,EAC1BsH,yBAAyB,EACzB7E,uBAAuB,EACvBkB,oBAAoB,EACpB8B,sCAAsC,EACtC+B,sBAAsB,GAsd1BhI,EAAO+L,YAAcC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.js","sources":["../../../../../src/components/RadioButton/RadioButton.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { forwardRef, useCallback, useMemo, useRef } from \"react\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport Clickable from \"../Clickable/Clickable\";\nimport Text from \"../Text/Text\";\nimport { type VibeComponentProps } from \"../../types\";\nimport Tooltip from \"../Tooltip/Tooltip\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport styles from \"./RadioButton.module.scss\";\nimport { ComponentVibeId } from \"../../tests/constants\";\n\nexport interface RadioButtonProps extends VibeComponentProps {\n /**\n * Class name applied to the label text.\n */\n labelClassName?: string;\n /**\n * Class name applied to the radio button element.\n */\n radioButtonClassName?: string;\n /**\n * The label text displayed next to the radio button.\n */\n text?: string;\n /**\n * The value associated with the radio button.\n */\n value?: string;\n /**\n * The name of the radio button group.\n */\n name?: string;\n /**\n * If true, the radio button automatically receives focus on mount.\n */\n autoFocus?: boolean;\n /**\n * If true, the radio button is disabled.\n */\n disabled?: boolean;\n /**\n * The reason why the radio button is disabled, displayed in a tooltip.\n */\n disabledReason?: string;\n /**\n * If true, the radio button is checked by default.\n */\n defaultChecked?: boolean;\n /**\n * The child elements inside the radio button.\n */\n children?: React.ReactNode;\n /**\n * Callback fired when the radio button selection changes.\n */\n onSelect?: (event: React.ChangeEvent<HTMLInputElement | null>) => void;\n /**\n * If provided, controls the checked state of the radio button.\n */\n checked?: boolean;\n /**\n * If true, clicking on children will trigger selection.\n */\n retainChildClick?: boolean;\n /**\n * The tab index applied to the children.\n */\n childrenTabIndex?: string;\n /**\n * If true, disables the label animation.\n */\n noLabelAnimation?: boolean;\n /**\n * ARIA label for accessibility when no text is provided.\n */\n ariaLabel?: string;\n /**\n * ID of element that describe this radio button.\n */\n ariaDescribedby?: string;\n}\n\nconst RadioButton = forwardRef(\n (\n {\n className,\n text = \"\",\n value = \"\",\n name = \"\",\n labelClassName,\n radioButtonClassName,\n disabled = false,\n autoFocus,\n disabledReason,\n defaultChecked = false,\n children,\n onSelect,\n checked,\n retainChildClick = true,\n childrenTabIndex = \"0\",\n noLabelAnimation = false,\n ariaLabel,\n ariaDescribedby,\n id,\n \"data-testid\": dataTestId\n }: RadioButtonProps,\n ref: React.ForwardedRef<HTMLInputElement>\n ) => {\n const inputRef = useRef<HTMLInputElement | null>();\n const mergedRef = useMergeRef(ref, inputRef);\n\n const onChildClick = useCallback(() => {\n if (disabled || !retainChildClick) return;\n if (inputRef.current) {\n inputRef.current.checked = true;\n }\n if (onSelect) {\n onSelect(null);\n }\n }, [onSelect, inputRef, disabled, retainChildClick]);\n\n const checkedProps = useMemo(() => {\n if (checked !== undefined) {\n return { checked };\n }\n return { defaultChecked };\n }, [checked, defaultChecked]);\n\n const tooltipContent = disabled ? disabledReason : null;\n\n return (\n <Tooltip content={tooltipContent}>\n <label\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.RADIO_BUTTON, id)}\n data-vibe={ComponentVibeId.RADIO_BUTTON}\n className={cx(styles.radioButton, className, {\n [styles.disabled]: disabled,\n disabled: disabled\n })}\n >\n <span className={cx(styles.inputContainer)}>\n <input\n className={cx(styles.input)}\n type=\"radio\"\n value={value}\n name={name}\n autoFocus={autoFocus}\n disabled={disabled}\n {...checkedProps}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n onChange={onSelect}\n ref={mergedRef}\n />\n <span\n data-testid={getTestId(ComponentDefaultTestId.RADIO_BUTTON_CONTROL, id)}\n className={cx(styles.control, radioButtonClassName, {\n [styles.labelAnimation]: !noLabelAnimation\n })}\n />\n </span>\n {text && (\n <Text\n element=\"span\"\n type=\"text2\"\n className={labelClassName}\n data-testid={getTestId(ComponentDefaultTestId.RADIO_BUTTON_LABEL, id)}\n >\n {text}\n </Text>\n )}\n {children && (\n <Clickable onClick={onChildClick} tabIndex={childrenTabIndex}>\n {children}\n </Clickable>\n )}\n </label>\n </Tooltip>\n );\n }\n);\n\nexport default RadioButton;\n"],"names":["RadioButton","forwardRef","_ref","ref","className","_ref$text","text","_ref$value","value","_ref$name","name","labelClassName","radioButtonClassName","_ref$disabled","disabled","autoFocus","disabledReason","_ref$defaultChecked","defaultChecked","children","onSelect","checked","_ref$retainChildClick","retainChildClick","_ref$childrenTabIndex","childrenTabIndex","_ref$noLabelAnimation","noLabelAnimation","ariaLabel","ariaDescribedby","id","dataTestId","inputRef","useRef","mergedRef","useMergeRef","onChildClick","useCallback","current","checkedProps","useMemo","undefined","React","createElement","Tooltip","content","getTestId","ComponentDefaultTestId","RADIO_BUTTON","ComponentVibeId","cx","styles","radioButton","_defineProperty","inputContainer","Object","assign","input","type","onChange","RADIO_BUTTON_CONTROL","control","labelAnimation","Text","element","RADIO_BUTTON_LABEL","Clickable","onClick","tabIndex"],"mappings":"ugBAkFMA,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iD,EAAAA,EAAA,CAAA,EACxCF,EAAOrC,SAAWA,GAAQ,WACjBA,KAGZ4B,EAAAC,cAAA,OAAA,CAAMvC,UAAW8C,EAAGC,EAAOG,iBACzBZ,EAAAC,cAAA,QAAAY,OAAAC,OAAA,CACEpD,UAAW8C,EAAGC,EAAOM,OACrBC,KAAK,QACLlD,MAAOA,EACPE,KAAMA,EACNK,UAAWA,EACXD,SAAUA,GACNyB,EACQ,CAAA,aAAAX,qBACMC,EAClB8B,SAAUvC,EACVjB,IAAK+B,KAEPQ,EAAAC,cAAA,OAAA,CAAA,cACeG,EAAUC,EAAuBa,qBAAsB9B,GACpE1B,UAAW8C,EAAGC,EAAOU,QAASjD,EAAoByC,KAC/CF,EAAOW,gBAAkBnC,OAI/BrB,GACCoC,EAACC,cAAAoB,EACC,CAAAC,QAAQ,OACRN,KAAK,QACLtD,UAAWO,EACE,cAAAmC,EAAUC,EAAuBkB,mBAAoBnC,IAEjExB,GAGJa,GACCuB,EAAAC,cAACuB,EAAU,CAAAC,QAAS/B,EAAcgC,SAAU3C,GACzCN,IAMb"}
1
+ {"version":3,"file":"RadioButton.js","sources":["../../../../../src/components/RadioButton/RadioButton.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { forwardRef, useCallback, useMemo, useRef } from \"react\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport Clickable from \"../Clickable/Clickable\";\nimport Text from \"../Text/Text\";\nimport { type VibeComponentProps } from \"../../types\";\nimport Tooltip from \"../Tooltip/Tooltip\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport styles from \"./RadioButton.module.scss\";\nimport { ComponentVibeId } from \"../../tests/constants\";\n\nexport interface RadioButtonProps extends VibeComponentProps {\n /**\n * Class name applied to the label text.\n */\n labelClassName?: string;\n /**\n * Class name applied to the radio button element.\n */\n radioButtonClassName?: string;\n /**\n * The label text displayed next to the radio button.\n */\n text?: string;\n /**\n * The value associated with the radio button.\n */\n value?: string;\n /**\n * The name of the radio button group.\n */\n name?: string;\n /**\n * If true, the radio button automatically receives focus on mount.\n */\n autoFocus?: boolean;\n /**\n * If true, the radio button is disabled.\n */\n disabled?: boolean;\n /**\n * The reason why the radio button is disabled, displayed in a tooltip.\n */\n disabledReason?: string;\n /**\n * If true, the radio button is checked by default.\n */\n defaultChecked?: boolean;\n /**\n * The child elements inside the radio button.\n */\n children?: React.ReactNode;\n /**\n * Callback fired when the radio button selection changes.\n */\n onSelect?: (event: React.ChangeEvent<HTMLInputElement | null>) => void;\n /**\n * If provided, controls the checked state of the radio button.\n */\n checked?: boolean;\n /**\n * If true, clicking on children will trigger selection.\n */\n retainChildClick?: boolean;\n /**\n * The tab index applied to the children.\n */\n childrenTabIndex?: string;\n /**\n * If true, disables the label animation.\n */\n noLabelAnimation?: boolean;\n /**\n * ARIA label for accessibility when no text is provided.\n */\n ariaLabel?: string;\n /**\n * ID of element that describe this radio button.\n */\n ariaDescribedby?: string;\n}\n\nconst RadioButton = forwardRef(\n (\n {\n className,\n text = \"\",\n value = \"\",\n name = \"\",\n /**\n * Radio button label class name\n */\n labelClassName,\n /**\n * Radio button marker class name\n */\n radioButtonClassName,\n disabled = false,\n autoFocus,\n disabledReason,\n defaultChecked = false,\n children,\n onSelect,\n checked,\n retainChildClick = true,\n childrenTabIndex = \"0\",\n noLabelAnimation = false,\n ariaLabel,\n ariaDescribedby,\n id,\n \"data-testid\": dataTestId\n }: RadioButtonProps,\n ref: React.ForwardedRef<HTMLInputElement>\n ) => {\n const inputRef = useRef<HTMLInputElement | null>();\n const mergedRef = useMergeRef(ref, inputRef);\n\n const onChildClick = useCallback(() => {\n if (disabled || !retainChildClick) return;\n if (inputRef.current) {\n inputRef.current.checked = true;\n }\n if (onSelect) {\n onSelect(null);\n }\n }, [onSelect, inputRef, disabled, retainChildClick]);\n\n const checkedProps = useMemo(() => {\n if (checked !== undefined) {\n return { checked };\n }\n return { defaultChecked };\n }, [checked, defaultChecked]);\n\n const tooltipContent = disabled ? disabledReason : null;\n\n return (\n <Tooltip content={tooltipContent}>\n <label\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.RADIO_BUTTON, id)}\n data-vibe={ComponentVibeId.RADIO_BUTTON}\n className={cx(styles.radioButton, className, {\n [styles.disabled]: disabled,\n disabled: disabled\n })}\n >\n <span className={cx(styles.inputContainer)}>\n <input\n className={cx(styles.input)}\n type=\"radio\"\n value={value}\n name={name}\n autoFocus={autoFocus}\n disabled={disabled}\n {...checkedProps}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n onChange={onSelect}\n ref={mergedRef}\n />\n <span\n data-testid={getTestId(ComponentDefaultTestId.RADIO_BUTTON_CONTROL, id)}\n className={cx(styles.control, radioButtonClassName, {\n [styles.labelAnimation]: !noLabelAnimation\n })}\n />\n </span>\n {text && (\n <Text\n element=\"span\"\n type=\"text2\"\n className={labelClassName}\n data-testid={getTestId(ComponentDefaultTestId.RADIO_BUTTON_LABEL, id)}\n >\n {text}\n </Text>\n )}\n {children && (\n <Clickable onClick={onChildClick} tabIndex={childrenTabIndex}>\n {children}\n </Clickable>\n )}\n </label>\n </Tooltip>\n );\n }\n);\n\nexport default RadioButton;\n"],"names":["RadioButton","forwardRef","_ref","ref","className","_ref$text","text","_ref$value","value","_ref$name","name","labelClassName","radioButtonClassName","_ref$disabled","disabled","autoFocus","disabledReason","_ref$defaultChecked","defaultChecked","children","onSelect","checked","_ref$retainChildClick","retainChildClick","_ref$childrenTabIndex","childrenTabIndex","_ref$noLabelAnimation","noLabelAnimation","ariaLabel","ariaDescribedby","id","dataTestId","inputRef","useRef","mergedRef","useMergeRef","onChildClick","useCallback","current","checkedProps","useMemo","undefined","React","createElement","Tooltip","content","getTestId","ComponentDefaultTestId","RADIO_BUTTON","ComponentVibeId","cx","styles","radioButton","_defineProperty","inputContainer","Object","assign","input","type","onChange","RADIO_BUTTON_CONTROL","control","labelAnimation","Text","element","RADIO_BUTTON_LABEL","Clickable","onClick","tabIndex"],"mappings":"ugBAk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D,EAASiD,EAAAA,EAAA,CAAA,EACxCF,EAAOrC,SAAWA,GAAQ,WACjBA,KAGZ4B,EAAAC,cAAA,OAAA,CAAMvC,UAAW8C,EAAGC,EAAOG,iBACzBZ,EAAAC,cAAA,QAAAY,OAAAC,OAAA,CACEpD,UAAW8C,EAAGC,EAAOM,OACrBC,KAAK,QACLlD,MAAOA,EACPE,KAAMA,EACNK,UAAWA,EACXD,SAAUA,GACNyB,EACQ,CAAA,aAAAX,qBACMC,EAClB8B,SAAUvC,EACVjB,IAAK+B,KAEPQ,EAAAC,cAAA,OAAA,CAAA,cACeG,EAAUC,EAAuBa,qBAAsB9B,GACpE1B,UAAW8C,EAAGC,EAAOU,QAASjD,EAAoByC,KAC/CF,EAAOW,gBAAkBnC,OAI/BrB,GACCoC,EAACC,cAAAoB,EACC,CAAAC,QAAQ,OACRN,KAAK,QACLtD,UAAWO,EACE,cAAAmC,EAAUC,EAAuBkB,mBAAoBnC,IAEjExB,GAGJa,GACCuB,EAAAC,cAACuB,EAAU,CAAAC,QAAS/B,EAAcgC,SAAU3C,GACzCN,IAMb"}
@@ -1,2 +1,2 @@
1
- import{slicedToArray as e,defineProperty as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import o,{forwardRef as i,useRef as r,useState as s,useEffect as n,useMemo as a,Fragment as l}from"react";import m from"classnames";import{AnimationType as d,HideShowEvent as p}from"../Dialog/DialogConstants.js";import c from"../../hooks/useMergeRef.js";import u from"../Tooltip/Tooltip.js";import f from"../IconButton/IconButton.js";import h from"./TipseenTitle.js";import{TipseenCloseButtonTheme as v,TipseenColor as T,TIPSEEN_CLOSE_BUTTON_ARIA_LABEL as g}from"./TipseenConstants.js";import{withStaticProps as y}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import{ComponentDefaultTestId as C}from"../../tests/constants.js";import{getTestId as j}from"../../tests/testIds.js";import w from"../Text/Text.js";import N from"./Tipseen.module.scss.js";import{TooltipPositions as E}from"../Tooltip/TooltipConstants.js";import x from"../../../icons/dist/react/CloseSmall.js";var W=o.createContext("primary"),B=y(i((function(i,d){var p=i.className,v=i.id,T=i.position,y=void 0===T?"bottom":T,E=i.animationType,B=void 0===E?"expand":E,k=i.hideDelay,D=void 0===k?0:k,S=i.showDelay,b=void 0===S?100:S,A=i.title,P=i.titleClassName,I=i.hideCloseButton,H=i.closeButtonTheme,R=void 0===H?"light":H,O=i.onClose,L=i.closeAriaLabel,M=i.children,_=void 0===M?null:M,z=i.content,q=i.containerSelector,F=i.hideTrigger,G=void 0===F?[]:F,J=i.showTrigger,K=void 0===J?[]:J,Q=i.width,U=i.moveBy,V=i.hideWhenReferenceHidden,X=void 0!==V&&V,Y=i.referenceWrapperClassName,Z=i.tip,$=void 0===Z||Z,ee=i.tooltipArrowClassName,te=i.modifiers,oe=void 0===te?[]:te,ie=i.floating,re=void 0!==ie&&ie,se=i.color,ne=i["data-testid"],ae=null!=se?se:"inverted",le=Array.isArray(K)&&Array.isArray(G)&&0===K.length&&b>0,me=r(null),de=c(d,me),pe=s(!le),ce=e(pe,2),ue=ce[0],fe=ce[1],he=L||g;n((function(){var e;return b&&(e=setTimeout((function(){fe(!0)}),b)),function(){clearTimeout(e)}}),[b,fe]);var ve=a((function(){return"inverted"===ae?"onInverted":"onPrimary"}),[ae]),Te=a((function(){return"light"===R?"inverted"===ae?"on-inverted-background":"on-primary-color":R}),[ae,R]),ge=d||v?"div":l,ye="div"===ge?{ref:de,id:v,"data-testid":ne||j(C.TIPSEEN,v)}:{},Ce=o.createElement("div",null,o.createElement("div",{className:m(N.tipseenHeader)},I?null:o.createElement(f,{hideTooltip:!0,className:m(N.tipseenCloseButton,t({},N.dark,"dark"===R||"fixed-dark"===R)),onClick:O,size:"xs",kind:"tertiary",color:Te,ariaLabel:he,icon:x}),o.createElement(h,{text:A,className:m(N.tipseenTitle,P)})),o.createElement(w,{color:ve,type:"text2",element:"div",ellipsis:!1,className:m(N.tipseenContent)},o.createElement(W.Provider,{value:ae},z)));return o.createElement(ge,Object.assign({},ye),o.createElement(u,{className:m(N.tipseenWrapper,p,t(t({},N.tipseenWrapperWithoutCustomWidth,!Q),N.floating,re)),maxWidth:Q,arrowClassName:ee,style:Q?{width:Q}:void 0,shouldShowOnMount:!le,position:y,animationType:B,hideDelay:D,showDelay:0,hideTrigger:G,showTrigger:K,showOnDialogEnter:!1,content:Ce,theme:"inverted"===ae?"dark":"primary",containerSelector:q,disableDialogSlide:!1,moveBy:U,hideWhenReferenceHidden:X,referenceWrapperClassName:Y,tip:$&&!re,modifiers:oe,open:le?ue:void 0,forceRenderWithoutChildren:re},_))})),{closeButtonThemes:v,animationTypes:d,hideShowTriggers:p,colors:T,positions:E});export{W as TipseenContext,B as default};
1
+ import{slicedToArray as e,defineProperty as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import o,{forwardRef as i,useRef as r,useState as n,useEffect as s,useMemo as a,Fragment as l}from"react";import m from"classnames";import{AnimationType as d,HideShowEvent as p}from"../Dialog/DialogConstants.js";import c from"../../hooks/useMergeRef.js";import u from"../Tooltip/Tooltip.js";import f from"../IconButton/IconButton.js";import h from"./TipseenTitle.js";import{TipseenCloseButtonTheme as v,TipseenColor as T,TIPSEEN_CLOSE_BUTTON_ARIA_LABEL as y}from"./TipseenConstants.js";import{withStaticProps as g}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import{ComponentDefaultTestId as C}from"../../tests/constants.js";import{getTestId as j}from"../../tests/testIds.js";import w from"../Text/Text.js";import N from"./Tipseen.module.scss.js";import{TooltipPositions as E}from"../Tooltip/TooltipConstants.js";import x from"../../../icons/dist/react/CloseSmall.js";var W=o.createContext("primary"),B=g(i((function(i,d){var p=i.className,v=i.id,T=i.position,g=void 0===T?"bottom":T,E=i.animationType,B=void 0===E?"expand":E,k=i.hideDelay,D=void 0===k?0:k,S=i.showDelay,A=void 0===S?100:S,b=i.title,P=i.titleClassName,I=i.hideCloseButton,H=i.closeButtonTheme,R=void 0===H?"light":H,L=i.onClose,M=i.closeAriaLabel,O=i.children,_=void 0===O?null:O,z=i.content,q=i.containerSelector,F=i.hideTrigger,G=void 0===F?[]:F,J=i.showTrigger,K=void 0===J?[]:J,Q=i.width,U=i.moveBy,V=i.hideWhenReferenceHidden,X=void 0!==V&&V,Y=i.referenceWrapperClassName,Z=i.tip,$=void 0===Z||Z,ee=i.tooltipArrowClassName,te=i.modifiers,oe=void 0===te?[]:te,ie=i.floating,re=void 0!==ie&&ie,ne=i.color,se=i["data-testid"],ae=null!=ne?ne:"inverted",le=Array.isArray(K)&&Array.isArray(G)&&0===K.length&&A>0,me=r(null),de=c(d,me),pe=n(!le),ce=e(pe,2),ue=ce[0],fe=ce[1],he=M||y;s((function(){var e;return A&&(e=setTimeout((function(){fe(!0)}),A)),function(){clearTimeout(e)}}),[A,fe]);var ve=a((function(){return"inverted"===ae?"onInverted":"onPrimary"}),[ae]),Te=a((function(){return"light"===R?"inverted"===ae?"on-inverted-background":"on-primary-color":R}),[ae,R]),ye=d||v?"div":l,ge=o.createElement("div",null,o.createElement("div",{className:m(N.tipseenHeader)},I?null:o.createElement(f,{hideTooltip:!0,className:m(N.tipseenCloseButton,t({},N.dark,"dark"===R||"fixed-dark"===R)),onClick:L,size:"xs",kind:"tertiary",color:Te,ariaLabel:he,icon:x}),o.createElement(h,{text:b,className:m(N.tipseenTitle,P)})),o.createElement(w,{color:ve,type:"text2",element:"p",className:m(N.tipseenContent)},o.createElement(W.Provider,{value:ae},z)));return o.createElement(ye,{ref:de,id:v,"data-testid":se||j(C.TIPSEEN,v)},o.createElement(u,{className:m(N.tipseenWrapper,p,t(t({},N.tipseenWrapperWithoutCustomWidth,!Q),N.floating,re)),maxWidth:Q,arrowClassName:ee,style:Q?{width:Q}:void 0,shouldShowOnMount:!le,position:g,animationType:B,hideDelay:D,showDelay:0,hideTrigger:G,showTrigger:K,showOnDialogEnter:!1,content:ge,theme:"inverted"===ae?"dark":"primary",containerSelector:q,disableDialogSlide:!1,moveBy:U,hideWhenReferenceHidden:X,referenceWrapperClassName:Y,tip:$&&!re,modifiers:oe,open:le?ue:void 0,forceRenderWithoutChildren:re},_))})),{closeButtonThemes:v,animationTypes:d,hideShowTriggers:p,colors:T,positions:E});export{W as TipseenContext,B as default};
2
2
  //# sourceMappingURL=Tipseen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tipseen.js","sources":["../../../../../src/components/Tipseen/Tipseen.tsx"],"sourcesContent":["import { forwardRef, Fragment, type ReactElement, useEffect, useMemo, useRef, useState } from \"react\";\nimport cx from \"classnames\";\nimport { AnimationType as AnimationTypeEnum, HideShowEvent as HideShowEventEnum } from \"../Dialog/DialogConstants\";\nimport { type DialogAnimationType, type DialogTriggerEvent } from \"../Dialog/Dialog.types\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport Tooltip from \"../../components/Tooltip/Tooltip\";\nimport IconButton from \"../../components/IconButton/IconButton\";\nimport { CloseSmall } from \"@vibe/icons\";\nimport TipseenTitle from \"./TipseenTitle\";\nimport {\n TIPSEEN_CLOSE_BUTTON_ARIA_LABEL,\n TipseenCloseButtonTheme as TipseenCloseButtonThemeEnum,\n TipseenColor as TipseenColorEnum\n} from \"./TipseenConstants\";\nimport { type TipseenCloseButtonTheme, type TipseenColor } from \"./Tipseen.types\";\nimport { type ElementContent, type VibeComponentProps, withStaticProps } from \"../../types\";\nimport { type MoveBy } from \"../../types/MoveBy\";\nimport { type Modifier } from \"react-popper\";\nimport { ComponentDefaultTestId } from \"../../tests/constants\";\nimport { getTestId } from \"../../tests/test-ids-utils\";\nimport Text from \"../Text/Text\";\nimport styles from \"./Tipseen.module.scss\";\nimport React from \"react\";\nimport { type TooltipPositions } from \"../Tooltip/Tooltip.types\";\nimport { TooltipPositions as TooltipPositionsEnum } from \"../Tooltip/TooltipConstants\";\n\nexport interface TipseenProps extends VibeComponentProps {\n /**\n * Class name applied to the Tipseen title.\n */\n titleClassName?: string;\n /**\n * The position of the Tipseen relative to the target element.\n */\n position?: TooltipPositions;\n /**\n * The animation type used for showing/hiding the Tipseen.\n */\n animationType?: DialogAnimationType;\n /**\n * The delay in milliseconds before hiding the Tipseen.\n */\n hideDelay?: number;\n /**\n * The delay in milliseconds before showing the Tipseen.\n */\n showDelay?: number;\n /**\n * The title text of the Tipseen.\n */\n title?: string;\n /**\n * If true, hides the close button.\n */\n hideCloseButton?: boolean;\n /**\n * The child element that triggers the Tipseen.\n */\n children?: ReactElement;\n /**\n * The CSS selector of the container where the Tipseen should be rendered.\n */\n containerSelector?: string;\n /**\n * Events that trigger hiding the Tipseen.\n */\n hideTrigger?: DialogTriggerEvent | Array<DialogTriggerEvent>;\n /**\n * Events that trigger showing the Tipseen.\n */\n showTrigger?: DialogTriggerEvent | Array<DialogTriggerEvent>;\n /**\n * The width of the Tipseen.\n */\n width?: number;\n /**\n * Offset values for positioning adjustments.\n */\n moveBy?: MoveBy;\n /**\n * If true, hides the Tipseen when the reference element is hidden.\n */\n hideWhenReferenceHidden?: boolean;\n /**\n * Class name applied to the reference wrapper element.\n */\n referenceWrapperClassName?: string;\n /**\n * If false, hides the arrow of the Tipseen.\n */\n tip?: boolean;\n /**\n * Class name applied to the Tipseen arrow.\n */\n tooltipArrowClassName?: string;\n /**\n * Custom Popper.js modifiers.\n * https://popper.js.org/docs/v2/modifiers/\n */\n modifiers?: Array<Modifier<unknown>>;\n /**\n * The aria-label for the close button.\n */\n closeAriaLabel?: string;\n /**\n * Callback fired when the Tipseen is closed.\n */\n onClose?: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * The content displayed inside the Tipseen.\n */\n content: ElementContent;\n /**\n * The theme of the Tipseen close button.\n */\n closeButtonTheme?: TipseenCloseButtonTheme;\n /**\n * If true, renders the Tipseen as a floating element without a reference.\n */\n floating?: boolean;\n /**\n * The color theme of the Tipseen.\n */\n color?: TipseenColor;\n}\n\nexport const TipseenContext = React.createContext<TipseenColor>(\"primary\");\n\nconst Tipseen = forwardRef(\n (\n {\n className,\n id,\n position = \"bottom\",\n animationType = \"expand\",\n hideDelay = 0,\n showDelay = 100,\n title,\n titleClassName,\n hideCloseButton,\n closeButtonTheme = \"light\",\n onClose,\n closeAriaLabel,\n children = null,\n content,\n containerSelector,\n hideTrigger = [],\n showTrigger = [],\n width,\n moveBy,\n hideWhenReferenceHidden = false,\n referenceWrapperClassName,\n tip = true,\n tooltipArrowClassName,\n modifiers = [],\n floating = false,\n color: colorProp,\n \"data-testid\": dataTestId\n }: TipseenProps,\n ref: React.ForwardedRef<HTMLElement>\n ) => {\n const color = colorProp ?? \"inverted\";\n\n const defaultDelayOpen =\n Array.isArray(showTrigger) && Array.isArray(hideTrigger) && showTrigger.length === 0 && showDelay > 0;\n\n const componentRef = useRef(null);\n const mergedRef = useMergeRef(ref, componentRef);\n const [delayedOpen, setDelayOpen] = useState(!defaultDelayOpen);\n const overrideCloseAriaLabel = closeAriaLabel || TIPSEEN_CLOSE_BUTTON_ARIA_LABEL;\n\n useEffect(() => {\n let timeout: NodeJS.Timeout;\n if (showDelay) {\n timeout = setTimeout(() => {\n setDelayOpen(true);\n }, showDelay);\n }\n return () => {\n clearTimeout(timeout);\n };\n }, [showDelay, setDelayOpen]);\n\n const textColor = useMemo(() => {\n return color === \"inverted\" ? \"onInverted\" : \"onPrimary\";\n }, [color]);\n const closeButtonColor = useMemo(() => {\n if (closeButtonTheme === \"light\") {\n return color === \"inverted\" ? \"on-inverted-background\" : \"on-primary-color\";\n } else {\n return closeButtonTheme;\n }\n }, [color, closeButtonTheme]);\n\n const TipseenWrapper = ref || id ? \"div\" : Fragment;\n const wrapperProps =\n TipseenWrapper === \"div\"\n ? { ref: mergedRef, id, \"data-testid\": dataTestId || getTestId(ComponentDefaultTestId.TIPSEEN, id) }\n : {};\n\n const tooltipContent = (\n <div>\n <div className={cx(styles.tipseenHeader)}>\n {hideCloseButton ? null : (\n <IconButton\n hideTooltip\n className={cx(styles.tipseenCloseButton, {\n [styles.dark]: closeButtonTheme === \"dark\" || closeButtonTheme === \"fixed-dark\"\n })}\n onClick={onClose}\n size=\"xs\"\n kind=\"tertiary\"\n // @ts-ignore\n color={closeButtonColor}\n ariaLabel={overrideCloseAriaLabel}\n icon={CloseSmall}\n />\n )}\n <TipseenTitle text={title} className={cx(styles.tipseenTitle, titleClassName)} />\n </div>\n <Text color={textColor} type=\"text2\" element=\"div\" ellipsis={false} className={cx(styles.tipseenContent)}>\n <TipseenContext.Provider value={color}>{content}</TipseenContext.Provider>\n </Text>\n </div>\n );\n\n return (\n <TipseenWrapper {...wrapperProps}>\n <Tooltip\n className={cx(styles.tipseenWrapper, className, {\n [styles.tipseenWrapperWithoutCustomWidth]: !width,\n [styles.floating]: floating\n })}\n maxWidth={width}\n arrowClassName={tooltipArrowClassName}\n style={width ? { width } : undefined}\n shouldShowOnMount={!defaultDelayOpen}\n position={position}\n animationType={animationType}\n hideDelay={hideDelay}\n showDelay={0}\n hideTrigger={hideTrigger}\n showTrigger={showTrigger}\n showOnDialogEnter={false}\n content={tooltipContent}\n theme={color === \"inverted\" ? \"dark\" : \"primary\"}\n containerSelector={containerSelector}\n disableDialogSlide={false}\n moveBy={moveBy}\n hideWhenReferenceHidden={hideWhenReferenceHidden}\n referenceWrapperClassName={referenceWrapperClassName}\n tip={tip && !floating}\n modifiers={modifiers}\n open={defaultDelayOpen ? delayedOpen : undefined}\n forceRenderWithoutChildren={floating}\n >\n {children}\n </Tooltip>\n </TipseenWrapper>\n );\n }\n);\n\ninterface TipseenStaticProps {\n closeButtonThemes: typeof TipseenCloseButtonThemeEnum;\n animationTypes: typeof AnimationTypeEnum;\n hideShowTriggers: typeof HideShowEventEnum;\n colors: typeof TipseenColorEnum;\n positions: typeof TooltipPositionsEnum;\n}\n\nexport default withStaticProps<TipseenProps, TipseenStaticProps>(Tipseen, {\n closeButtonThemes: TipseenCloseButtonThemeEnum,\n animationTypes: AnimationTypeEnum,\n hideShowTriggers: HideShowEventEnum,\n colors: TipseenColorEnum,\n positions: TooltipPositionsEnum\n});\n"],"names":["TipseenContext","React","createContext","withStaticProps","forwardRef","_ref","ref","className","id","_ref$position","position","_ref$animationType","animationType","_ref$hideDelay","hideDelay","_ref$showDelay","showDelay","title","titleClassName","hideCloseButton","_ref$closeButtonTheme","closeButtonTheme","onClose","closeAriaLabel","_ref$children","children","content","containerSelector","_ref$hideTrigger","hideTrigger","_ref$showTrigger","showTrigger","width","moveBy","_ref$hideWhenReferenc","hideWhenReferenceHidden","referenceWrapperClassName","_ref$tip","tip","tooltipArrowClassName","_ref$modifiers","modifiers","_ref$floating","floating","colorProp","color","dataTestId","defaultDelayOpen","Array","isArray","length","componentRef","useRef","mergedRef","useMergeRef","_useState","useState","_useState2","_slicedToArray","delayedOpen","setDelayOpen","overrideCloseAriaLabel","TIPSEEN_CLOSE_BUTTON_ARIA_LABEL","useEffect","timeout","setTimeout","clearTimeout","textColor","useMemo","closeButtonColor","TipseenWrapper","Fragment","wrapperProps","getTestId","ComponentDefaultTestId","TIPSEEN","tooltipContent","createElement","cx","styles","tipseenHeader","IconButton","hideTooltip","tipseenCloseButton","_defineProperty","dark","onClick","size","kind","ariaLabel","icon","CloseSmall","TipseenTitle","text","tipseenTitle","Text","type","element","ellipsis","tipseenContent","Provider","value","Object","assign","Tooltip","tipseenWrapper","tipseenWrapperWithoutCustomWidth","maxWidth","arrowClassName","style","undefined","shouldShowOnMount","showOnDialogEnter","theme","disableDialogSlide","open","forceRenderWithoutChildren","closeButtonThemes","TipseenCloseButtonThemeEnum","animationTypes","AnimationTypeEnum","hideShowTriggers","HideShowEventEnum","colors","TipseenColorEnum","positions","TooltipPositionsEnum"],"mappings":"s+BA8HO,IAAMA,EAAiBC,EAAMC,cAA4B,WAiJjDC,EAAAA,EA/ICC,GACd,SAAAC,EA8BEC,GACE,IA7BAC,EAASF,EAATE,UACAC,EAAEH,EAAFG,GAAEC,EAAAJ,EACFK,SAAAA,OAAW,IAAHD,EAAG,SAAQA,EAAAE,EAAAN,EACnBO,cAAAA,OAAgB,IAAHD,EAAG,SAAQA,EAAAE,EAAAR,EACxBS,UA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gBrE,GAChBsE,MAAO7E,EAAQ,CAAEA,MAAAA,QAAU8E,EAC3BC,mBAAoBhE,GACpBrC,SAAUA,EACVE,cAAeA,EACfE,UAAWA,EACXE,UAAW,EACXa,YAAaA,EACbE,YAAaA,EACbiF,mBAAmB,EACnBtF,QAASkD,GACTqC,MAAiB,aAAVpE,GAAuB,OAAS,UACvClB,kBAAmBA,EACnBuF,oBAAoB,EACpBjF,OAAQA,EACRE,wBAAyBA,EACzBC,0BAA2BA,EAC3BE,IAAKA,IAAQK,GACbF,UAAWA,GACX0E,KAAMpE,GAAmBY,QAAcmD,EACvCM,2BAA4BzE,IAE3BlB,GAIT,IAWwE,CACxE4F,kBAAmBC,EACnBC,eAAgBC,EAChBC,iBAAkBC,EAClBC,OAAQC,EACRC,UAAWC"}
1
+ {"version":3,"file":"Tipseen.js","sources":["../../../../../src/components/Tipseen/Tipseen.tsx"],"sourcesContent":["import { forwardRef, Fragment, type ReactElement, useEffect, useMemo, useRef, useState } from \"react\";\nimport cx from \"classnames\";\nimport { AnimationType as AnimationTypeEnum, HideShowEvent as HideShowEventEnum } from \"../Dialog/DialogConstants\";\nimport { type DialogAnimationType, type DialogTriggerEvent } from \"../Dialog/Dialog.types\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport Tooltip from \"../../components/Tooltip/Tooltip\";\nimport IconButton from \"../../components/IconButton/IconButton\";\nimport { CloseSmall } from \"@vibe/icons\";\nimport TipseenTitle from \"./TipseenTitle\";\nimport {\n TIPSEEN_CLOSE_BUTTON_ARIA_LABEL,\n TipseenCloseButtonTheme as TipseenCloseButtonThemeEnum,\n TipseenColor as TipseenColorEnum\n} from \"./TipseenConstants\";\nimport { type TipseenCloseButtonTheme, type TipseenColor } from \"./Tipseen.types\";\nimport { type ElementContent, type VibeComponentProps, withStaticProps } from \"../../types\";\nimport { type MoveBy } from \"../../types/MoveBy\";\nimport { type Modifier } from \"react-popper\";\nimport { ComponentDefaultTestId } from \"../../tests/constants\";\nimport { getTestId } from \"../../tests/test-ids-utils\";\nimport Text from \"../Text/Text\";\nimport styles from \"./Tipseen.module.scss\";\nimport React from \"react\";\nimport { type TooltipPositions } from \"../Tooltip/Tooltip.types\";\nimport { TooltipPositions as TooltipPositionsEnum } from \"../Tooltip/TooltipConstants\";\n\nexport interface TipseenProps extends VibeComponentProps {\n /**\n * Class name applied to the Tipseen title.\n */\n titleClassName?: string;\n /**\n * The position of the Tipseen relative to the target element.\n */\n position?: TooltipPositions;\n /**\n * The animation type used for showing/hiding the Tipseen.\n */\n animationType?: DialogAnimationType;\n /**\n * The delay in milliseconds before hiding the Tipseen.\n */\n hideDelay?: number;\n /**\n * The delay in milliseconds before showing the Tipseen.\n */\n showDelay?: number;\n /**\n * The title text of the Tipseen.\n */\n title?: string;\n /**\n * If true, hides the close button.\n */\n hideCloseButton?: boolean;\n /**\n * The child element that triggers the Tipseen.\n */\n children?: ReactElement;\n /**\n * The CSS selector of the container where the Tipseen should be rendered.\n */\n containerSelector?: string;\n /**\n * Events that trigger hiding the Tipseen.\n */\n hideTrigger?: DialogTriggerEvent | Array<DialogTriggerEvent>;\n /**\n * Events that trigger showing the Tipseen.\n */\n showTrigger?: DialogTriggerEvent | Array<DialogTriggerEvent>;\n /**\n * The width of the Tipseen.\n */\n width?: number;\n /**\n * Offset values for positioning adjustments.\n */\n moveBy?: MoveBy;\n /**\n * If true, hides the Tipseen when the reference element is hidden.\n */\n hideWhenReferenceHidden?: boolean;\n /**\n * Class name applied to the reference wrapper element.\n */\n referenceWrapperClassName?: string;\n /**\n * If false, hides the arrow of the Tipseen.\n */\n tip?: boolean;\n /**\n * Class name applied to the Tipseen arrow.\n */\n tooltipArrowClassName?: string;\n /**\n * Custom Popper.js modifiers.\n * https://popper.js.org/docs/v2/modifiers/\n */\n modifiers?: Array<Modifier<unknown>>;\n /**\n * The aria-label for the close button.\n */\n closeAriaLabel?: string;\n /**\n * Callback fired when the Tipseen is closed.\n */\n onClose?: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * The content displayed inside the Tipseen.\n */\n content: ElementContent;\n /**\n * The theme of the Tipseen close button.\n */\n closeButtonTheme?: TipseenCloseButtonTheme;\n /**\n * If true, renders the Tipseen as a floating element without a reference.\n */\n floating?: boolean;\n /**\n * The color theme of the Tipseen.\n */\n color?: TipseenColor;\n}\n\nexport const TipseenContext = React.createContext<TipseenColor>(\"primary\");\n\nconst Tipseen = forwardRef(\n (\n {\n className,\n id,\n position = \"bottom\",\n animationType = \"expand\",\n hideDelay = 0,\n showDelay = 100,\n title,\n titleClassName,\n hideCloseButton,\n closeButtonTheme = \"light\",\n onClose,\n closeAriaLabel,\n children = null,\n content,\n containerSelector,\n hideTrigger = [],\n showTrigger = [],\n width,\n moveBy,\n hideWhenReferenceHidden = false,\n referenceWrapperClassName,\n tip = true,\n tooltipArrowClassName,\n modifiers = [],\n floating = false,\n color: colorProp,\n \"data-testid\": dataTestId\n }: TipseenProps,\n ref: React.ForwardedRef<HTMLElement>\n ) => {\n const color = colorProp ?? \"inverted\";\n\n const defaultDelayOpen =\n Array.isArray(showTrigger) && Array.isArray(hideTrigger) && showTrigger.length === 0 && showDelay > 0;\n\n const componentRef = useRef(null);\n const mergedRef = useMergeRef(ref, componentRef);\n const [delayedOpen, setDelayOpen] = useState(!defaultDelayOpen);\n const overrideCloseAriaLabel = closeAriaLabel || TIPSEEN_CLOSE_BUTTON_ARIA_LABEL;\n\n useEffect(() => {\n let timeout: NodeJS.Timeout;\n if (showDelay) {\n timeout = setTimeout(() => {\n setDelayOpen(true);\n }, showDelay);\n }\n return () => {\n clearTimeout(timeout);\n };\n }, [showDelay, setDelayOpen]);\n\n const textColor = useMemo(() => {\n return color === \"inverted\" ? \"onInverted\" : \"onPrimary\";\n }, [color]);\n const closeButtonColor = useMemo(() => {\n if (closeButtonTheme === \"light\") {\n return color === \"inverted\" ? \"on-inverted-background\" : \"on-primary-color\";\n } else {\n return closeButtonTheme;\n }\n }, [color, closeButtonTheme]);\n\n const TipseenWrapper = ref || id ? \"div\" : Fragment;\n const tooltipContent = (\n <div>\n <div className={cx(styles.tipseenHeader)}>\n {hideCloseButton ? null : (\n <IconButton\n hideTooltip\n className={cx(styles.tipseenCloseButton, {\n [styles.dark]: closeButtonTheme === \"dark\" || closeButtonTheme === \"fixed-dark\"\n })}\n onClick={onClose}\n size=\"xs\"\n kind=\"tertiary\"\n // @ts-ignore\n color={closeButtonColor}\n ariaLabel={overrideCloseAriaLabel}\n icon={CloseSmall}\n />\n )}\n <TipseenTitle text={title} className={cx(styles.tipseenTitle, titleClassName)} />\n </div>\n <Text color={textColor} type=\"text2\" element=\"p\" className={cx(styles.tipseenContent)}>\n <TipseenContext.Provider value={color}>{content}</TipseenContext.Provider>\n </Text>\n </div>\n );\n\n return (\n <TipseenWrapper ref={mergedRef} id={id} data-testid={dataTestId || getTestId(ComponentDefaultTestId.TIPSEEN, id)}>\n <Tooltip\n className={cx(styles.tipseenWrapper, className, {\n [styles.tipseenWrapperWithoutCustomWidth]: !width,\n [styles.floating]: floating\n })}\n maxWidth={width}\n arrowClassName={tooltipArrowClassName}\n style={width ? { width } : undefined}\n shouldShowOnMount={!defaultDelayOpen}\n position={position}\n animationType={animationType}\n hideDelay={hideDelay}\n showDelay={0}\n hideTrigger={hideTrigger}\n showTrigger={showTrigger}\n showOnDialogEnter={false}\n content={tooltipContent}\n theme={color === \"inverted\" ? \"dark\" : \"primary\"}\n containerSelector={containerSelector}\n disableDialogSlide={false}\n moveBy={moveBy}\n hideWhenReferenceHidden={hideWhenReferenceHidden}\n referenceWrapperClassName={referenceWrapperClassName}\n tip={tip && !floating}\n modifiers={modifiers}\n open={defaultDelayOpen ? delayedOpen : undefined}\n forceRenderWithoutChildren={floating}\n >\n {children}\n </Tooltip>\n </TipseenWrapper>\n );\n }\n);\n\ninterface TipseenStaticProps {\n closeButtonThemes: typeof TipseenCloseButtonThemeEnum;\n animationTypes: typeof AnimationTypeEnum;\n hideShowTriggers: typeof HideShowEventEnum;\n colors: typeof TipseenColorEnum;\n positions: typeof TooltipPositionsEnum;\n}\n\nexport default withStaticProps<TipseenProps, TipseenStaticProps>(Tipseen, {\n closeButtonThemes: TipseenCloseButtonThemeEnum,\n animationTypes: AnimationTypeEnum,\n hideShowTriggers: HideShowEventEnum,\n colors: TipseenColorEnum,\n positions: TooltipPositionsEnum\n});\n"],"names":["TipseenContext","React","createContext","withStaticProps","forwardRef","_ref","ref","className","id","_ref$position","position","_ref$animationType","animationType","_ref$hideDelay","hideDelay","_ref$showDelay","showDelay","title","titleClassName","hideCloseButton","_ref$closeButtonTheme","closeButtonTheme","onClose","closeAriaLabel","_ref$children","children","content","containerSelector","_ref$hideTrigger","hideTrigger","_ref$showTrigger","showTrigger","width","moveBy","_ref$hideWhenReferenc","hideWhenReferenceHidden","referenceWrapperClassName","_ref$tip","tip","tooltipArrowClassName","_ref$modifiers","modifiers","_ref$floating","floating","colorProp","color","dataTestId","defaultDelayOpen","Array","isArray","length","componentRef","useRef","mergedRef","useMergeRef","_useState","useState","_useState2","_slicedToArray","delayedOpen","setDelayOpen","overrideCloseAriaLabel","TIPSEEN_CLOSE_BUTTON_ARIA_LABEL","useEffect","timeout","setTimeout","clearTimeout","textColor","useMemo","closeButtonColor","TipseenWrapper","Fragment","tooltipContent","createElement","cx","styles","tipseenHeader","IconButton","hideTooltip","tipseenCloseButton","_defineProperty","dark","onClick","size","kind","ariaLabel","icon","CloseSmall","TipseenTitle","text","tipseenTitle","Text","type","element","tipseenContent","Provider","value","getTestId","ComponentDefaultTestId","TIPSEEN","Tooltip","tipseenWrapper","tipseenWrapperWithoutCustomWidth","maxWidth","arrowClassName","style","undefined","shouldShowOnMount","showOnDialogEnter","theme","disableDialogSlide","open","forceRenderWithoutChildren","closeButtonThemes","TipseenCloseButtonThemeEnum","animationTypes","AnimationTypeEnum","hideShowTriggers","HideShowEventEnum","colors","TipseenColorEnum","positions","TooltipPositionsEnum"],"mappings":"s+BA8HO,IAAMA,EAAiBC,EAAMC,cAA4B,WA4IjD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AAO0B,eAAgB9F,EAASyE,EAAAA,EAAA,CAAA,EAC3CL,EAAO2B,kCAAoCtE,GAC3C2C,EAAOhC,SAAWA,KAErB4D,SAAUvE,EACVwE,eAAgBjE,GAChBkE,MAAOzE,EAAQ,CAAEA,MAAAA,QAAU0E,EAC3BC,mBAAoB5D,GACpBrC,SAAUA,EACVE,cAAeA,EACfE,UAAWA,EACXE,UAAW,EACXa,YAAaA,EACbE,YAAaA,EACb6E,mBAAmB,EACnBlF,QAAS8C,GACTqC,MAAiB,aAAVhE,GAAuB,OAAS,UACvClB,kBAAmBA,EACnBmF,oBAAoB,EACpB7E,OAAQA,EACRE,wBAAyBA,EACzBC,0BAA2BA,EAC3BE,IAAKA,IAAQK,GACbF,UAAWA,GACXsE,KAAMhE,GAAmBY,QAAc+C,EACvCM,2BAA4BrE,IAE3BlB,GAIT,IAWwE,CACxEwF,kBAAmBC,EACnBC,eAAgBC,EAChBC,iBAAkBC,EAClBC,OAAQC,EACRC,UAAWC"}
@@ -1,2 +1,2 @@
1
- import{defineProperty as e}from"../../../../../../_virtual/_rollupPluginBabelHelpers.js";import r from"react";import t from"classnames";import a from"../../../../FieldLabel/FieldLabel.js";import o from"../../../../Text/Text.js";import s from"./DropdownBase.module.scss.js";import{getTestId as l}from"../../../../../tests/testIds.js";import{ComponentDefaultTestId as i,ComponentVibeId as d}from"../../../../../tests/constants.js";import{useDropdownContext as m}from"../../context/DropdownContext.js";import n from"../../../../Tooltip/Tooltip.js";var p=function(p){var c=p.dropdownRef,f=p.children,b=m(),u=b.label,j=b.required,v=b.getLabelProps,O=b.id,x=b.ariaLabel,T=b["data-testid"],D=b.readOnly,N=b.error,P=b.isFocused,g=b.isOpen,E=b.helperText,w=b.dir,y=b.tooltipProps,L=r.createElement("div",{ref:c,className:t(s.wrapper,b.className,e(e(e(e({},s.disabled,b.disabled),s.readOnly,D),s.error,N),s.active,P||g)),id:O,"aria-label":x,"data-testid":T||l(i.DROPDOWN,O),"data-vibe":d.DROPDOWN},f);return r.createElement("div",{dir:w,className:s.outerWrapper},u&&r.createElement(a,Object.assign({labelText:u,required:j},v())),r.createElement(n,Object.assign({},y,{content:null==y?void 0:y.content}),L),E&&r.createElement(o,{color:N?"negative":"secondary",className:s.helperText},E))};export{p as default};
1
+ import{defineProperty as e}from"../../../../../../_virtual/_rollupPluginBabelHelpers.js";import r from"react";import t from"classnames";import o from"../../../../FieldLabel/FieldLabel.js";import a from"../../../../Text/Text.js";import s from"./DropdownBase.module.scss.js";import{getTestId as l}from"../../../../../tests/testIds.js";import{ComponentDefaultTestId as i,ComponentVibeId as d}from"../../../../../tests/constants.js";import{useDropdownContext as m}from"../../context/DropdownContext.js";import n from"../../../../Tooltip/Tooltip.js";var p=function(p){var c=p.dropdownRef,b=p.children,f=m(),u=f.label,j=f.required,x=f.getLabelProps,v=f.className,O=f.id,T=f.ariaLabel,D=f["data-testid"],N=f.readOnly,P=f.error,g=f.isFocused,E=f.isOpen,w=f.helperText,y=f.dir,L=f.tooltipProps,h=f.boxMode,F=r.createElement("div",{ref:c,className:t(s.wrapper,e(e(e(e(e({},s.disabled,f.disabled),s.readOnly,N),s.error,P),s.active,g||E),s.boxMode,h),v),id:O,"aria-label":T,"data-testid":D||l(i.DROPDOWN,O),"data-vibe":d.DROPDOWN},b);return r.createElement("div",{dir:y,className:s.outerWrapper},u&&r.createElement(o,Object.assign({labelText:u,required:j},x())),r.createElement(n,Object.assign({},L,{content:null==L?void 0:L.content}),F),w&&r.createElement(a,{color:P?"negative":"secondary",className:s.helperText},w))};export{p as default};
2
2
  //# sourceMappingURL=DropdownBase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownBase.js","sources":["../../../../../../../../src/components/next/Dropdown/components/DropdownBase/DropdownBase.tsx"],"sourcesContent":["import React from \"react\";\nimport cx from \"classnames\";\nimport FieldLabel from \"../../../../FieldLabel/FieldLabel\";\nimport Text from \"../../../../Text/Text\";\nimport styles from \"./DropdownBase.module.scss\";\nimport { getTestId } from \"../../../../../tests/test-ids-utils\";\nimport { ComponentDefaultTestId, ComponentVibeId } from \"../../../../../tests/constants\";\nimport { useDropdownContext } from \"../../context/DropdownContext\";\nimport { type BaseListItemData } from \"../../../../BaseListItem\";\nimport Tooltip from \"../../../../Tooltip/Tooltip\";\n\ninterface DropdownBaseProps {\n dropdownRef: React.Ref<HTMLDivElement>;\n children: React.ReactNode;\n}\n\nconst DropdownBase = ({ dropdownRef, children }: DropdownBaseProps) => {\n const {\n label,\n required,\n getLabelProps,\n className,\n id,\n ariaLabel,\n \"data-testid\": dataTestIdFromContext,\n disabled,\n readOnly,\n error,\n isFocused,\n isOpen,\n helperText,\n dir,\n tooltipProps\n } = useDropdownContext<BaseListItemData>();\n\n const coreDropdownElement = (\n <div\n ref={dropdownRef}\n className={cx(styles.wrapper, className, {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.error]: error,\n [styles.active]: isFocused || isOpen\n })}\n id={id}\n aria-label={ariaLabel}\n data-testid={dataTestIdFromContext || getTestId(ComponentDefaultTestId.DROPDOWN, id)}\n data-vibe={ComponentVibeId.DROPDOWN}\n >\n {children}\n </div>\n );\n\n return (\n <div dir={dir} className={styles.outerWrapper}>\n {label && <FieldLabel labelText={label} required={required} {...getLabelProps()} />}\n <Tooltip {...tooltipProps} content={tooltipProps?.content}>\n {coreDropdownElement}\n </Tooltip>\n {helperText && (\n <Text color={error ? \"negative\" : \"secondary\"} className={styles.helperText}>\n {helperText}\n </Text>\n )}\n </div>\n );\n};\n\nexport default DropdownBase;\n"],"names":["DropdownBase","_ref","dropdownRef","children","_useDropdownContext","useDropdownContext","label","required","getLabelProps","id","ariaLabel","dataTestIdFromContext","readOnly","error","isFocused","isOpen","helperText","dir","tooltipProps","coreDropdownElement","React","createElement","ref","className","cx","styles","wrapper","_defineProperty","disabled","active","getTestId","ComponentDefaultTestId","DROPDOWN","ComponentVibeId","outerWrapper","FieldLabel","Object","assign","labelText","Tooltip","content","Text","color"],"mappings":"iiBAgBA,IAAMA,EAAe,SAAHC,GAAoD,IAA9CC,EAAWD,EAAXC,YAAaC,EAAQF,EAARE,SACnCC,EAgBIC,IAfFC,EAAKF,EAALE,MACAC,EAAQH,EAARG,SACAC,EAAaJ,EAAbI,cAEAC,EAAEL,EAAFK,GACAC,EAASN,EAATM,UACeC,EAAqBP,EAApC,eAEAQ,EAAQR,EAARQ,SACAC,EAAKT,EAALS,MACAC,EAASV,EAATU,UACAC,EAAMX,EAANW,OACAC,EAAUZ,EAAVY,WACAC,EAAGb,EAAHa,IACAC,EAAYd,EAAZc,aAGIC,EACJC,EACEC,cAAA,MAAA,CAAAC,IAAKpB,EACLqB,UAAWC,EAAGC,EAAOC,QAjBdtB,EAATmB,UAiByCI,EAAAA,EAAAA,EAAAA,EACpCF,CAAAA,EAAAA,EAAOG,SAdJxB,EAARwB,UAeKH,EAAOb,SAAWA,GAClBa,EAAOZ,MAAQA,GACfY,EAAOI,OAASf,GAAaC,IAEhCN,GAAIA,EAAE,aACMC,EACC,cAAAC,GAAyBmB,EAAUC,EAAuBC,SAAUvB,GACtE,YAAAwB,EAAgBD,UAE1B7B,GAIL,OACEiB,EAAKC,cAAA,MAAA,CAAAJ,IAAKA,EAAKM,UAAWE,EAAOS,cAC9B5B,GAASc,EAAAC,cAACc,EAAUC,OAAAC,OAAA,CAACC,UAAWhC,EAAOC,SAAUA,GAAcC,MAChEY,EAAAC,cAACkB,EAAOH,OAAAC,OAAA,CAAA,EAAKnB,EAAY,CAAEsB,QAAStB,eAAAA,EAAcsB,UAC/CrB,GAEFH,GACCI,EAACC,cAAAoB,EAAK,CAAAC,MAAO7B,EAAQ,WAAa,YAAaU,UAAWE,EAAOT,YAC9DA,GAKX"}
1
+ {"version":3,"file":"DropdownBase.js","sources":["../../../../../../../../src/components/next/Dropdown/components/DropdownBase/DropdownBase.tsx"],"sourcesContent":["import React from \"react\";\nimport cx from \"classnames\";\nimport FieldLabel from \"../../../../FieldLabel/FieldLabel\";\nimport Text from \"../../../../Text/Text\";\nimport styles from \"./DropdownBase.module.scss\";\nimport { getTestId } from \"../../../../../tests/test-ids-utils\";\nimport { ComponentDefaultTestId, ComponentVibeId } from \"../../../../../tests/constants\";\nimport { useDropdownContext } from \"../../context/DropdownContext\";\nimport { type BaseListItemData } from \"../../../../BaseListItem\";\nimport Tooltip from \"../../../../Tooltip/Tooltip\";\n\ninterface DropdownBaseProps {\n dropdownRef: React.Ref<HTMLDivElement>;\n children: React.ReactNode;\n}\n\nconst DropdownBase = ({ dropdownRef, children }: DropdownBaseProps) => {\n const {\n label,\n required,\n getLabelProps,\n className,\n id,\n ariaLabel,\n \"data-testid\": dataTestIdFromContext,\n disabled,\n readOnly,\n error,\n isFocused,\n isOpen,\n helperText,\n dir,\n tooltipProps,\n boxMode\n } = useDropdownContext<BaseListItemData>();\n\n const coreDropdownElement = (\n <div\n ref={dropdownRef}\n className={cx(\n styles.wrapper,\n {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.error]: error,\n [styles.active]: isFocused || isOpen,\n [styles.boxMode]: boxMode\n },\n className\n )}\n id={id}\n aria-label={ariaLabel}\n data-testid={dataTestIdFromContext || getTestId(ComponentDefaultTestId.DROPDOWN, id)}\n data-vibe={ComponentVibeId.DROPDOWN}\n >\n {children}\n </div>\n );\n\n return (\n <div dir={dir} className={styles.outerWrapper}>\n {label && <FieldLabel labelText={label} required={required} {...getLabelProps()} />}\n <Tooltip {...tooltipProps} content={tooltipProps?.content}>\n {coreDropdownElement}\n </Tooltip>\n {helperText && (\n <Text color={error ? \"negative\" : \"secondary\"} className={styles.helperText}>\n {helperText}\n </Text>\n )}\n </div>\n );\n};\n\nexport default DropdownBase;\n"],"names":["DropdownBase","_ref","dropdownRef","children","_useDropdownContext","useDropdownContext","label","required","getLabelProps","className","id","ariaLabel","dataTestIdFromContext","readOnly","error","isFocused","isOpen","helperText","dir","tooltipProps","boxMode","coreDropdownElement","React","createElement","ref","cx","styles","wrapper","_defineProperty","disabled","active","getTestId","ComponentDefaultTestId","DROPDOWN","ComponentVibeId","outerWrapper","FieldLabel","Object","assign","labelText","Tooltip","content","Text","color"],"mappings":"iiBAgBA,IAAMA,EAAe,SAAHC,GAAoD,IAA9CC,EAAWD,EAAXC,YAAaC,EAAQF,EAARE,SACnCC,EAiBIC,IAhBFC,EAAKF,EAALE,MACAC,EAAQH,EAARG,SACAC,EAAaJ,EAAbI,cACAC,EAASL,EAATK,UACAC,EAAEN,EAAFM,GACAC,EAASP,EAATO,UACeC,EAAqBR,EAApC,eAEAS,EAAQT,EAARS,SACAC,EAAKV,EAALU,MACAC,EAASX,EAATW,UACAC,EAAMZ,EAANY,OACAC,EAAUb,EAAVa,WACAC,EAAGd,EAAHc,IACAC,EAAYf,EAAZe,aACAC,EAAOhB,EAAPgB,QAGIC,EACJC,EAAAC,cAAA,MAAA,CACEC,IAAKtB,EACLO,UAAWgB,EACTC,EAAOC,QAAOC,EAAAA,EAAAA,EAAAA,EAAAA,EAEXF,CAAAA,EAAAA,EAAOG,SAjBNzB,EAARyB,UAkBOH,EAAOb,SAAWA,GAClBa,EAAOZ,MAAQA,GACfY,EAAOI,OAASf,GAAaC,GAC7BU,EAAON,QAAUA,GAEpBX,GAEFC,GAAIA,EAAE,aACMC,EAAS,cACRC,GAAyBmB,EAAUC,EAAuBC,SAAUvB,GACtE,YAAAwB,EAAgBD,UAE1B9B,GAIL,OACEmB,EAAKC,cAAA,MAAA,CAAAL,IAAKA,EAAKT,UAAWiB,EAAOS,cAC9B7B,GAASgB,EAAAC,cAACa,EAAUC,OAAAC,OAAA,CAACC,UAAWjC,EAAOC,SAAUA,GAAcC,MAChEc,EAAAC,cAACiB,EAAOH,OAAAC,OAAA,CAAA,EAAKnB,EAAY,CAAEsB,QAAStB,eAAAA,EAAcsB,UAC/CpB,GAEFJ,GACCK,EAACC,cAAAmB,EAAK,CAAAC,MAAO7B,EAAQ,WAAa,YAAaL,UAAWiB,EAAOT,YAC9DA,GAKX"}
@@ -1,2 +1,2 @@
1
- var r={outerWrapper:"outerWrapper",wrapper:"wrapper",active:"active",disabled:"disabled",readOnly:"readOnly",error:"error",helperText:"helperText"};!function(r){const e="s_id-640373641d03_3_73_0";if("undefined"!=typeof document){const o=document.head||document.getElementsByTagName("head")[0];if(o.querySelector("#"+e))return;const n=document.createElement("style");n.id=e,o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.appendChild(document.createTextNode(r))}else globalThis.injectedStyles&&(globalThis.injectedStyles[e]=r)}(".outerWrapper {\n width: 100%;\n}\n\n.wrapper {\n --border-color: var(--ui-border-color);\n --background-color: var(--secondary-background-color);\n border-radius: var(--border-radius-small);\n box-shadow: inset 0 0 0 1px var(--border-color);\n background: var(--background-color);\n cursor: pointer;\n}\n\n.wrapper:hover {\n --border-color: var(--primary-text-color);\n}\n\n.wrapper.active, .wrapper:focus {\n --border-color: var(--primary-color);\n}\n\n.wrapper.disabled {\n --border-color: var(--disabled-background-color);\n --background-color: var(--disabled-background-color);\n cursor: not-allowed;\n}\n\n.wrapper.readOnly {\n --border-color: var(--allgrey-background-color);\n --background-color: var(--allgrey-background-color);\n cursor: default;\n}\n\n.wrapper.error {\n --border-color: var(--negative-color);\n}\n\n.helperText {\n margin-top: var(--spacing-xs);\n}");export{r as default};
1
+ var r={outerWrapper:"outerWrapper",wrapper:"wrapper",active:"active",disabled:"disabled",readOnly:"readOnly",error:"error",boxMode:"boxMode",helperText:"helperText"};!function(r){const e="s_id-7686a1aea847_3_73_0";if("undefined"!=typeof document){const o=document.head||document.getElementsByTagName("head")[0];if(o.querySelector("#"+e))return;const n=document.createElement("style");n.id=e,o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.appendChild(document.createTextNode(r))}else globalThis.injectedStyles&&(globalThis.injectedStyles[e]=r)}(".outerWrapper {\n width: 100%;\n}\n\n.wrapper {\n --border-color: var(--ui-border-color);\n --background-color: var(--secondary-background-color);\n border-radius: var(--border-radius-small);\n box-shadow: inset 0 0 0 1px var(--border-color);\n background: var(--background-color);\n cursor: pointer;\n}\n\n.wrapper:hover {\n --border-color: var(--primary-text-color);\n}\n\n.wrapper.active, .wrapper:focus {\n --border-color: var(--primary-color);\n}\n\n.wrapper.disabled {\n --border-color: var(--disabled-background-color);\n --background-color: var(--disabled-background-color);\n cursor: not-allowed;\n}\n\n.wrapper.readOnly {\n --border-color: var(--allgrey-background-color);\n --background-color: var(--allgrey-background-color);\n cursor: default;\n}\n\n.wrapper.error {\n --border-color: var(--negative-color);\n}\n\n.wrapper.boxMode {\n box-shadow: none;\n background: transparent;\n cursor: default;\n}\n\n.helperText {\n margin-top: var(--spacing-xs);\n}");export{r as default};
2
2
  //# sourceMappingURL=DropdownBase.module.scss.js.map
@@ -0,0 +1,2 @@
1
+ import{defineProperty as e}from"../../../../../../_virtual/_rollupPluginBabelHelpers.js";import r from"react";import o from"classnames";import{useDropdownContext as t}from"../../context/DropdownContext.js";import l from"../Menu/MenuList.js";import n from"../Trigger/SingleSelectTrigger.js";import a from"../Trigger/MultiSelectTrigger.js";import i from"../../../../Flex/Flex.js";import m from"./DropdownBoxMode.module.scss.js";var s=function(){var s=t(),c=s.multi,p=s.disabled,u=s.readOnly,d=s.error;return s.searchable?r.createElement(i,{direction:"column",gap:"xs",className:o(m.boxModeContainer)},r.createElement("div",{className:o(m.inputContainer,e(e(e({},m.disabled,p),m.readOnly,u),m.error,d))},r.createElement(c?a:n,null)),r.createElement("div",{className:m.menuContainer},r.createElement(l,null))):null};export{s as default};
2
+ //# sourceMappingURL=DropdownBoxMode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownBoxMode.js","sources":["../../../../../../../../src/components/next/Dropdown/components/DropdownBoxMode/DropdownBoxMode.tsx"],"sourcesContent":["import React from \"react\";\nimport cx from \"classnames\";\nimport { useDropdownContext } from \"../../context/DropdownContext\";\nimport MenuList from \"../Menu/MenuList\";\nimport SingleSelectTrigger from \"../Trigger/SingleSelectTrigger\";\nimport MultiSelectTrigger from \"../Trigger/MultiSelectTrigger\";\nimport { Flex } from \"../../../../Flex\";\nimport styles from \"./DropdownBoxMode.module.scss\";\n\nconst DropdownBoxMode = () => {\n const { multi, searchable, disabled, readOnly, error } = useDropdownContext();\n\n if (!searchable) {\n return null;\n }\n\n return (\n <Flex direction=\"column\" gap=\"xs\" className={cx(styles.boxModeContainer)}>\n <div\n className={cx(styles.inputContainer, {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.error]: error\n })}\n >\n {multi ? <MultiSelectTrigger /> : <SingleSelectTrigger />}\n </div>\n <div className={styles.menuContainer}>\n <MenuList />\n </div>\n </Flex>\n );\n};\n\nexport default DropdownBoxMode;\n"],"names":["DropdownBoxMode","_useDropdownContext","useDropdownContext","multi","disabled","readOnly","error","searchable","React","createElement","Flex","direction","gap","className","cx","styles","boxModeContainer","inputContainer","_defineProperty","MultiSelectTrigger","SingleSelectTrigger","menuContainer","MenuList"],"mappings":"0aASA,IAAMA,EAAkB,WACtB,IAAAC,EAAyDC,IAAjDC,EAAKF,EAALE,MAAmBC,EAAQH,EAARG,SAAUC,EAAQJ,EAARI,SAAUC,EAAKL,EAALK,MAE/C,OAFyBL,EAAVM,WAObC,EAACC,cAAAC,GAAKC,UAAU,SAASC,IAAI,KAAKC,UAAWC,EAAGC,EAAOC,mBACrDR,EAAAC,cAAA,MAAA,CACEI,UAAWC,EAAGC,EAAOE,eAAcC,EAAAA,EAAAA,KAChCH,EAAOX,SAAWA,GAClBW,EAAOV,SAAWA,GAClBU,EAAOT,MAAQA,KAGTE,EAACC,cAATN,EAASgB,EAAyBC,EAAJ,OAEjCZ,EAAAC,cAAA,MAAA,CAAKI,UAAWE,EAAOM,eACrBb,EAAAC,cAACa,EAAQ,QAfN,IAmBX"}
@@ -0,0 +1,2 @@
1
+ var n={boxModeContainer:"boxModeContainer",inputContainer:"inputContainer",disabled:"disabled",readOnly:"readOnly",error:"error",menuContainer:"menuContainer"};!function(n){const r="s_id-f92aa28952f8_3_73_0";if("undefined"!=typeof document){const o=document.head||document.getElementsByTagName("head")[0];if(o.querySelector("#"+r))return;const e=document.createElement("style");e.id=r,o.firstChild?o.insertBefore(e,o.firstChild):o.appendChild(e),e.appendChild(document.createTextNode(n))}else globalThis.injectedStyles&&(globalThis.injectedStyles[r]=n)}(".boxModeContainer {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n\n.inputContainer {\n --border-color: var(--ui-border-color);\n --background-color: var(--secondary-background-color);\n border-radius: var(--border-radius-small);\n box-shadow: inset 0 0 0 1px var(--border-color);\n background: var(--background-color);\n width: 100%;\n}\n\n.inputContainer:hover {\n --border-color: var(--primary-text-color);\n}\n\n.inputContainer:focus-within {\n --border-color: var(--primary-color);\n}\n\n.inputContainer.disabled {\n --border-color: var(--disabled-background-color);\n --background-color: var(--disabled-background-color);\n}\n\n.inputContainer.readOnly {\n --border-color: var(--allgrey-background-color);\n --background-color: var(--allgrey-background-color);\n}\n\n.inputContainer.error {\n --border-color: var(--negative-color);\n}\n\n.menuContainer {\n width: 100%;\n}");export{n as default};
2
+ //# sourceMappingURL=DropdownBoxMode.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownBoxMode.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import o from"react";import{DropdownContext as e}from"../context/DropdownContext.js";import r from"./DropdownPopup/DropdownPopup.js";import t from"./DropdownBase/DropdownBase.js";var n=function(n){return o.createElement(e.Provider,{value:n.contextValue},o.createElement(t,{dropdownRef:n.dropdownRef},o.createElement(r,null)))};export{n as default};
1
+ import o from"react";import{DropdownContext as r}from"../context/DropdownContext.js";import e from"./DropdownPopup/DropdownPopup.js";import t from"./DropdownBoxMode/DropdownBoxMode.js";import n from"./DropdownBase/DropdownBase.js";var p=function(p){var d=p.contextValue;return o.createElement(r.Provider,{value:d},o.createElement(n,{dropdownRef:p.dropdownRef},o.createElement(d.boxMode?t:e,null)))};export{p as default};
2
2
  //# sourceMappingURL=DropdownWrapperUI.js.map