@vibe/core 3.50.1-alpha-1be71.0 → 3.50.1
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.
- package/dist/components/AlertBanner/AlertBanner.d.ts +1 -1
- package/dist/components/AttentionBox/AttentionBox.d.ts +1 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Avatar/AvatarBadge.d.ts +1 -1
- package/dist/components/Avatar/AvatarContent.d.ts +1 -1
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/Badge/Indicator/Indicator.d.ts +1 -1
- package/dist/components/Box/Box.d.ts +1 -1
- package/dist/components/BreadcrumbsBar/BreadcrumbsBar.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/dist/components/Chips/Chips.d.ts +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/components/ColorPicker/components/ColorPickerContent/ColorPickerContent.d.ts +1 -1
- package/dist/components/Combobox/Combobox.d.ts +1 -1
- package/dist/components/Combobox/components/ComboboxOption/ComboboxOption.d.ts +1 -1
- package/dist/components/Counter/Counter.d.ts +1 -1
- package/dist/components/DialogContentContainer/DialogContentContainer.d.ts +1 -1
- package/dist/components/Divider/Divider.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/DropdownNew/Dropdown.types.d.ts +4 -0
- package/dist/components/DropdownNew/hooks/useDropdownCombobox.d.ts +1 -1
- package/dist/components/DropdownNew/hooks/useDropdownFiltering.d.ts +1 -1
- package/dist/components/DropdownNew/hooks/useDropdownMultiCombobox.d.ts +1 -1
- package/dist/components/DropdownNew/utils/dropdownUtils.d.ts +1 -1
- package/dist/components/EditableHeading/EditableHeading.d.ts +1 -1
- package/dist/components/EditableText/EditableText.d.ts +1 -1
- package/dist/components/Flex/Flex.d.ts +1 -1
- package/dist/components/FormattedNumber/FormattedNumber.d.ts +1 -1
- package/dist/components/Heading/Heading.d.ts +1 -1
- package/dist/components/Icon/Icon.d.ts +1 -1
- package/dist/components/IconButton/IconButton.d.ts +1 -1
- package/dist/components/Label/Label.d.ts +1 -1
- package/dist/components/LegacyModal/LegacyModal.d.ts +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/List/List.d.ts +1 -1
- package/dist/components/ListItem/ListItem.d.ts +1 -1
- package/dist/components/ListItemAvatar/ListItemAvatar.d.ts +1 -1
- package/dist/components/ListItemIcon/ListItemIcon.d.ts +1 -1
- package/dist/components/Loader/Loader.d.ts +1 -1
- package/dist/components/Menu/Menu/Menu.d.ts +1 -1
- package/dist/components/Menu/MenuItem/MenuItem.d.ts +1 -1
- package/dist/components/Menu/MenuItemButton/MenuItemButton.d.ts +1 -1
- package/dist/components/Menu/MenuTitle/MenuTitle.d.ts +1 -1
- package/dist/components/MenuButton/MenuButton.d.ts +1 -1
- package/dist/components/MultiStepIndicator/MultiStepIndicator.d.ts +1 -1
- package/dist/components/ProgressBars/LinearProgressBar/LinearProgressBar.d.ts +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/components/Slider/Slider.d.ts +1 -1
- package/dist/components/Slider/SliderInfix.d.ts +1 -1
- package/dist/components/SplitButton/SplitButton.d.ts +1 -1
- package/dist/components/Steps/Steps.d.ts +1 -1
- package/dist/components/Table/Table/Table.d.ts +1 -1
- package/dist/components/Tabs/TabPanels/TabPanels.d.ts +1 -1
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/TextField/TextField.d.ts +1 -1
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/dist/components/Tipseen/Tipseen.d.ts +1 -1
- package/dist/components/Toast/Toast.d.ts +1 -1
- package/dist/metadata.json +11649 -8784
- package/dist/mocked_classnames/components/AlertBanner/AlertBanner.d.ts +1 -1
- package/dist/mocked_classnames/components/AttentionBox/AttentionBox.d.ts +1 -1
- package/dist/mocked_classnames/components/Avatar/Avatar.d.ts +1 -1
- package/dist/mocked_classnames/components/Avatar/AvatarBadge.d.ts +1 -1
- package/dist/mocked_classnames/components/Avatar/AvatarContent.d.ts +1 -1
- package/dist/mocked_classnames/components/Badge/Badge.d.ts +1 -1
- package/dist/mocked_classnames/components/Badge/Indicator/Indicator.d.ts +1 -1
- package/dist/mocked_classnames/components/Box/Box.d.ts +1 -1
- package/dist/mocked_classnames/components/BreadcrumbsBar/BreadcrumbsBar.d.ts +1 -1
- package/dist/mocked_classnames/components/Button/Button.d.ts +1 -1
- package/dist/mocked_classnames/components/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/dist/mocked_classnames/components/Chips/Chips.d.ts +1 -1
- package/dist/mocked_classnames/components/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/mocked_classnames/components/ColorPicker/components/ColorPickerContent/ColorPickerContent.d.ts +1 -1
- package/dist/mocked_classnames/components/Combobox/Combobox.d.ts +1 -1
- package/dist/mocked_classnames/components/Combobox/components/ComboboxOption/ComboboxOption.d.ts +1 -1
- package/dist/mocked_classnames/components/Counter/Counter.d.ts +1 -1
- package/dist/mocked_classnames/components/DialogContentContainer/DialogContentContainer.d.ts +1 -1
- package/dist/mocked_classnames/components/Divider/Divider.d.ts +1 -1
- package/dist/mocked_classnames/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/mocked_classnames/components/DropdownNew/Dropdown.types.d.ts +4 -0
- package/dist/mocked_classnames/components/DropdownNew/hooks/useDropdownCombobox.d.ts +1 -1
- package/dist/mocked_classnames/components/DropdownNew/hooks/useDropdownFiltering.d.ts +1 -1
- package/dist/mocked_classnames/components/DropdownNew/hooks/useDropdownMultiCombobox.d.ts +1 -1
- package/dist/mocked_classnames/components/DropdownNew/utils/dropdownUtils.d.ts +1 -1
- package/dist/mocked_classnames/components/EditableHeading/EditableHeading.d.ts +1 -1
- package/dist/mocked_classnames/components/EditableText/EditableText.d.ts +1 -1
- package/dist/mocked_classnames/components/Flex/Flex.d.ts +1 -1
- package/dist/mocked_classnames/components/FormattedNumber/FormattedNumber.d.ts +1 -1
- package/dist/mocked_classnames/components/Heading/Heading.d.ts +1 -1
- package/dist/mocked_classnames/components/Icon/Icon.d.ts +1 -1
- package/dist/mocked_classnames/components/IconButton/IconButton.d.ts +1 -1
- package/dist/mocked_classnames/components/Label/Label.d.ts +1 -1
- package/dist/mocked_classnames/components/LegacyModal/LegacyModal.d.ts +1 -1
- package/dist/mocked_classnames/components/Link/Link.d.ts +1 -1
- package/dist/mocked_classnames/components/List/List.d.ts +1 -1
- package/dist/mocked_classnames/components/ListItem/ListItem.d.ts +1 -1
- package/dist/mocked_classnames/components/ListItemAvatar/ListItemAvatar.d.ts +1 -1
- package/dist/mocked_classnames/components/ListItemIcon/ListItemIcon.d.ts +1 -1
- package/dist/mocked_classnames/components/Loader/Loader.d.ts +1 -1
- package/dist/mocked_classnames/components/Menu/Menu/Menu.d.ts +1 -1
- package/dist/mocked_classnames/components/Menu/MenuItem/MenuItem.d.ts +1 -1
- package/dist/mocked_classnames/components/Menu/MenuItemButton/MenuItemButton.d.ts +1 -1
- package/dist/mocked_classnames/components/Menu/MenuTitle/MenuTitle.d.ts +1 -1
- package/dist/mocked_classnames/components/MenuButton/MenuButton.d.ts +1 -1
- package/dist/mocked_classnames/components/MultiStepIndicator/MultiStepIndicator.d.ts +1 -1
- package/dist/mocked_classnames/components/ProgressBars/LinearProgressBar/LinearProgressBar.d.ts +1 -1
- package/dist/mocked_classnames/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/mocked_classnames/components/Slider/Slider.d.ts +1 -1
- package/dist/mocked_classnames/components/Slider/SliderInfix.d.ts +1 -1
- package/dist/mocked_classnames/components/SplitButton/SplitButton.d.ts +1 -1
- package/dist/mocked_classnames/components/Steps/Steps.d.ts +1 -1
- package/dist/mocked_classnames/components/Table/Table/Table.d.ts +1 -1
- package/dist/mocked_classnames/components/Tabs/TabPanels/TabPanels.d.ts +1 -1
- package/dist/mocked_classnames/components/Text/Text.d.ts +1 -1
- package/dist/mocked_classnames/components/TextField/TextField.d.ts +1 -1
- package/dist/mocked_classnames/components/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/dist/mocked_classnames/components/Tipseen/Tipseen.d.ts +1 -1
- package/dist/mocked_classnames/components/Toast/Toast.d.ts +1 -1
- package/dist/mocked_classnames/src/components/AttentionBox/AttentionBox.js +1 -1
- package/dist/mocked_classnames/src/components/AttentionBox/AttentionBox.js.map +1 -1
- package/dist/mocked_classnames/src/components/Avatar/Avatar.js +1 -1
- package/dist/mocked_classnames/src/components/Avatar/Avatar.js.map +1 -1
- package/dist/mocked_classnames/src/components/Avatar/AvatarBadge.js +1 -1
- package/dist/mocked_classnames/src/components/Avatar/AvatarBadge.js.map +1 -1
- package/dist/mocked_classnames/src/components/Avatar/AvatarContent.js +1 -1
- package/dist/mocked_classnames/src/components/Avatar/AvatarContent.js.map +1 -1
- package/dist/mocked_classnames/src/components/Badge/Indicator/Indicator.js +1 -1
- package/dist/mocked_classnames/src/components/Badge/Indicator/Indicator.js.map +1 -1
- package/dist/mocked_classnames/src/components/BreadcrumbsBar/BreadcrumbsBar.js +1 -1
- package/dist/mocked_classnames/src/components/BreadcrumbsBar/BreadcrumbsBar.js.map +1 -1
- package/dist/mocked_classnames/src/components/Combobox/components/ComboboxOption/ComboboxOption.js +1 -1
- package/dist/mocked_classnames/src/components/Combobox/components/ComboboxOption/ComboboxOption.js.map +1 -1
- package/dist/mocked_classnames/src/components/Counter/Counter.js +1 -1
- package/dist/mocked_classnames/src/components/Counter/Counter.js.map +1 -1
- package/dist/mocked_classnames/src/components/Dialog/Dialog.js +1 -1
- package/dist/mocked_classnames/src/components/Dialog/Dialog.js.map +1 -1
- package/dist/mocked_classnames/src/components/Divider/Divider.js +1 -1
- package/dist/mocked_classnames/src/components/Divider/Divider.js.map +1 -1
- package/dist/mocked_classnames/src/components/LegacyModal/LegacyModal.js +1 -1
- package/dist/mocked_classnames/src/components/LegacyModal/LegacyModal.js.map +1 -1
- package/dist/mocked_classnames/src/components/Menu/MenuItemButton/MenuItemButton.js +1 -1
- package/dist/mocked_classnames/src/components/Menu/MenuItemButton/MenuItemButton.js.map +1 -1
- package/dist/mocked_classnames/src/components/Menu/MenuTitle/MenuTitle.js +1 -1
- package/dist/mocked_classnames/src/components/Menu/MenuTitle/MenuTitle.js.map +1 -1
- package/dist/mocked_classnames/src/components/Skeleton/Skeleton.js +1 -1
- package/dist/mocked_classnames/src/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/mocked_classnames/src/components/Slider/SliderInfix.js +1 -1
- package/dist/mocked_classnames/src/components/Slider/SliderInfix.js.map +1 -1
- package/dist/mocked_classnames/src/components/SplitButton/SplitButton.js +1 -1
- package/dist/mocked_classnames/src/components/SplitButton/SplitButton.js.map +1 -1
- package/dist/mocked_classnames/src/components/Table/TableContainer/TableContainer.module.scss.js +1 -1
- package/dist/mocked_classnames/src/components/Table/TableRowMenu/TableRowMenu.js +1 -1
- package/dist/mocked_classnames/src/components/Table/TableRowMenu/TableRowMenu.js.map +1 -1
- package/dist/mocked_classnames/src/components/TextField/TextField.js.map +1 -1
- package/dist/mocked_classnames/src/components/ThemeProvider/ThemeProvider.js +1 -1
- package/dist/mocked_classnames/src/components/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/mocked_classnames/src/components/Toast/Toast.js +1 -1
- package/dist/mocked_classnames/src/components/Toast/Toast.js.map +1 -1
- package/dist/mocked_classnames/src/index.js +1 -1
- package/dist/mocked_classnames/src/types/withStaticProps.js +1 -1
- package/dist/mocked_classnames/src/types/withStaticProps.js.map +1 -1
- package/dist/mocked_classnames/types/withStaticProps.d.ts +2 -2
- package/dist/src/components/AttentionBox/AttentionBox.js +1 -1
- package/dist/src/components/AttentionBox/AttentionBox.js.map +1 -1
- package/dist/src/components/Avatar/Avatar.js +1 -1
- package/dist/src/components/Avatar/Avatar.js.map +1 -1
- package/dist/src/components/Avatar/AvatarBadge.js +1 -1
- package/dist/src/components/Avatar/AvatarBadge.js.map +1 -1
- package/dist/src/components/Avatar/AvatarContent.js +1 -1
- package/dist/src/components/Avatar/AvatarContent.js.map +1 -1
- package/dist/src/components/Badge/Indicator/Indicator.js +1 -1
- package/dist/src/components/Badge/Indicator/Indicator.js.map +1 -1
- package/dist/src/components/BreadcrumbsBar/BreadcrumbsBar.js +1 -1
- package/dist/src/components/BreadcrumbsBar/BreadcrumbsBar.js.map +1 -1
- package/dist/src/components/Combobox/components/ComboboxOption/ComboboxOption.js +1 -1
- package/dist/src/components/Combobox/components/ComboboxOption/ComboboxOption.js.map +1 -1
- package/dist/src/components/Counter/Counter.js +1 -1
- package/dist/src/components/Counter/Counter.js.map +1 -1
- package/dist/src/components/Dialog/Dialog.js +1 -1
- package/dist/src/components/Dialog/Dialog.js.map +1 -1
- package/dist/src/components/Divider/Divider.js +1 -1
- package/dist/src/components/Divider/Divider.js.map +1 -1
- package/dist/src/components/LegacyModal/LegacyModal.js +1 -1
- package/dist/src/components/LegacyModal/LegacyModal.js.map +1 -1
- package/dist/src/components/Menu/MenuItemButton/MenuItemButton.js +1 -1
- package/dist/src/components/Menu/MenuItemButton/MenuItemButton.js.map +1 -1
- package/dist/src/components/Menu/MenuTitle/MenuTitle.js +1 -1
- package/dist/src/components/Menu/MenuTitle/MenuTitle.js.map +1 -1
- package/dist/src/components/Skeleton/Skeleton.js +1 -1
- package/dist/src/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/src/components/Slider/SliderInfix.js +1 -1
- package/dist/src/components/Slider/SliderInfix.js.map +1 -1
- package/dist/src/components/SplitButton/SplitButton.js +1 -1
- package/dist/src/components/SplitButton/SplitButton.js.map +1 -1
- package/dist/src/components/Table/TableContainer/TableContainer.module.scss.js +1 -1
- package/dist/src/components/Table/TableRowMenu/TableRowMenu.js +1 -1
- package/dist/src/components/Table/TableRowMenu/TableRowMenu.js.map +1 -1
- package/dist/src/components/TextField/TextField.js.map +1 -1
- package/dist/src/components/ThemeProvider/ThemeProvider.js +1 -1
- package/dist/src/components/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/src/components/Toast/Toast.js +1 -1
- package/dist/src/components/Toast/Toast.js.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/types/withStaticProps.js +1 -1
- package/dist/src/types/withStaticProps.js.map +1 -1
- package/dist/types/withStaticProps.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sources":["../../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { PureComponent, ReactElement } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Manager, Modifier, Popper, Reference } from \"react-popper\";\nimport { isFunction } from \"lodash-es\";\nimport { chainFunctions, 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 { VibeComponentProps } from \"../../types\";\nimport * as PopperJS from \"@popperjs/core\";\nimport styles from \"./Dialog.module.scss\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport { DialogAnimationType, DialogPosition, DialogTriggerEvent } from \"./Dialog.types\";\nimport LayerContext from \"../LayerProvider/LayerContext\";\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 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 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 // 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\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 }\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 getContainer() {\n const { containerSelector } = this.props;\n const containerElement = document.querySelector(containerSelector);\n if (!containerElement || !(containerElement instanceof Element)) {\n const { layerRef } = this.context;\n if (layerRef?.current) {\n return layerRef.current;\n }\n return document.body;\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 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 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 return (\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={ref}\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 </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","onMouseEnter","bind","onMouseLeave","onMouseDown","onClick","onFocus","onBlur","isShown","onEsc","onClickOutside","onDialogEnter","onDialogLeave","getContainer","onContentClick","onKeyDown","closeDialogOnEscape","onContextMenu","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","containerElement","querySelector","containerSelector","Element","layerRef","context","current","body","eventName","_this2","_this$props2","instantShowAndHide","getDynamicShowDelay","finalShowDelay","showDelay","preventAnimation","dynamicDelayObj","onShowDialog","setState","setTimeout","options","arguments","length","undefined","disable","clearTimeout","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","zIndex","hideWhenReferenceHidden","disableContainerScroll","observeContentResize","overrideDataTestId","getTestId","ComponentDefaultTestId","DIALOG","id","animationTypeCalculated","contentRendered","isFunction","React","Manager","createElement","Reference","_ref","ref","Refable","className","cx","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","DialogContent","styleObject","hasTooltip","nextProps","instance","chainFunctions","hideShowTriggers","positions","DialogPositionEnum","animationTypes","AnimationTypeEnum","defaultProps","MOUSE_ENTER","MOUSE_LEAVE","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A6B,MAAOC,EAAWD,MAClB1B,IAAK2B,EAAW3B,IAChBE,UAAWC,EAAGa,EAAOI,MAAOvC,GAAiB,iBAC7B0B,IAKzB,IAEH5G,KAAKb,iBAlHJwF,CAsHX,IAAC,CAAA,CAAA9E,IAAA,2BAAAC,MA3WD,SAAgCwI,EAAwBpK,GACtD,OAAIA,EAAMC,+BACD,CAAEE,OAAQiK,EAAUjK,QAEtB,IACT,IAAC,IAyWH,SAASoI,EAAwBI,EAAc0B,EAAkBzK,GAE/D,OAAO0K,EAAe,CAAC1K,EAAM+I,GAAO0B,EAAS1B,KAAQ,EACvD,CArdSjJ,EAAgB6K,iBAAGvI,EACnBtC,EAAS8K,UAAGC,EACZ/K,EAAcgL,eAAGC,EACjBjL,EAAAkL,aAAe,CACpBhE,SAAU,MACVE,UAAW,GACXD,OAAQ,CAAEiC,KAAM,EAAGD,UAAW,GAC9BlF,UAAW,IACXe,UAAW,IACXgB,YAAahG,EAAO6K,iBAAiBM,YACrC/E,YAAapG,EAAO6K,iBAAiBO,YACrC3E,mBAAmB,EACnB/F,mBAAmB,EACnBiE,SAAS,EACTgB,MAAM,EACNsB,cAAejH,EAAOgL,eAAeK,OACrCrE,yBAAyB,EACzBK,SAAS,EACTvE,gBAAiBwI,EACjBpG,gBAAiBoG,EACjBlK,eAAgBkK,EAChB9J,eAAgB8J,EAChB9K,0BAA0B,EAC1BiH,yBAAyB,EACzB5E,uBAAuB,EACvBiB,oBAAoB,EACpB+B,sCAAsC,EACtC8B,sBAAsB,GA4b1B3H,EAAOuL,YAAcC"}
|
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { PureComponent, ReactElement } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Manager, Modifier, Popper, Reference } from \"react-popper\";\nimport { isFunction } from \"lodash-es\";\nimport { chainFunctions, 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 { VibeComponentProps } from \"../../types\";\nimport * as PopperJS from \"@popperjs/core\";\nimport styles from \"./Dialog.module.scss\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport { DialogAnimationType, DialogPosition, DialogTriggerEvent } from \"./Dialog.types\";\nimport LayerContext from \"../LayerProvider/LayerContext\";\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 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 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 // 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\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 getContainer() {\n const { containerSelector } = this.props;\n const containerElement = document.querySelector(containerSelector);\n if (!containerElement || !(containerElement instanceof Element)) {\n const { layerRef } = this.context;\n if (layerRef?.current) {\n return layerRef.current;\n }\n return document.body;\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 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 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 return (\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={ref}\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 </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","onMouseEnter","bind","onMouseLeave","onMouseDown","onClick","onFocus","onBlur","isShown","onEsc","onClickOutside","onDialogEnter","onDialogLeave","getContainer","onContentClick","onKeyDown","closeDialogOnEscape","onContextMenu","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","containerElement","querySelector","containerSelector","Element","layerRef","context","current","body","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","zIndex","hideWhenReferenceHidden","disableContainerScroll","observeContentResize","overrideDataTestId","getTestId","ComponentDefaultTestId","DIALOG","id","animationTypeCalculated","contentRendered","isFunction","React","Manager","createElement","Reference","_ref","ref","Refable","className","cx","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","DialogContent","styleObject","hasTooltip","nextProps","instance","chainFunctions","hideShowTriggers","positions","DialogPositionEnum","animationTypes","AnimationTypeEnum","defaultProps","MOUSE_ENTER","MOUSE_LEAVE","EXPAND","NOOP","contextType","LayerContext"],"mappings":"u/BAuMqBA,IAAAA,WAAOC,GAkC1B,SAAAD,EAAYE,GAAkB,IAAAC,EA2BJ,OA3BIC,OAAAJ,IAC5BG,EAAAE,EAAAL,KAAAA,GAAME,KACDI,MAAQ,CACXC,+BAAgCL,EAAMM,yBACtCC,OAAQP,EAAMQ,mBAIhBP,EAAKQ,aAAeR,EAAKQ,aAAaC,KAAIT,GAC1CA,EAAKU,aAAeV,EAAKU,aAAaD,KAAIT,GAC1CA,EAAKW,YAAcX,EAAKW,YAAYF,KAAIT,GACxCA,EAAKY,QAAUZ,EAAKY,QAAQH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AwBI,EAAc0B,EAAkBzK,GAE/D,OAAO0K,EAAe,CAAC1K,EAAM+I,GAAO0B,EAAS1B,KAAQ,EACvD,CA7dSjJ,EAAgB6K,iBAAGvI,EACnBtC,EAAS8K,UAAGC,EACZ/K,EAAcgL,eAAGC,EACjBjL,EAAAkL,aAAe,CACpBhE,SAAU,MACVE,UAAW,GACXD,OAAQ,CAAEiC,KAAM,EAAGD,UAAW,GAC9BjF,UAAW,IACXc,UAAW,IACXgB,YAAahG,EAAO6K,iBAAiBM,YACrC/E,YAAapG,EAAO6K,iBAAiBO,YACrC3E,mBAAmB,EACnB/F,mBAAmB,EACnBkE,SAAS,EACTe,MAAM,EACNsB,cAAejH,EAAOgL,eAAeK,OACrCrE,yBAAyB,EACzBK,SAAS,EACTvE,gBAAiBwI,EACjBpG,gBAAiBoG,EACjBlK,eAAgBkK,EAChB9J,eAAgB8J,EAChB9K,0BAA0B,EAC1BiH,yBAAyB,EACzB5E,uBAAuB,EACvBkB,oBAAoB,EACpB8B,sCAAsC,EACtC8B,sBAAsB,GAoc1B3H,EAAOuL,YAAcC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{defineProperty as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{getTestId as r,ComponentDefaultTestId as i}from"../../tests/testIds.js";import s from"classnames";import o from"react";import{DirectionType as e}from"./DividerConstants.js";import{getStyle as a}from"../../helpers/typesciptCssModulesHelper.js";import{
|
|
1
|
+
import{defineProperty as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{getTestId as r,ComponentDefaultTestId as i}from"../../tests/testIds.js";import s from"classnames";import o from"react";import{DirectionType as e}from"./DividerConstants.js";import{getStyle as a}from"../../helpers/typesciptCssModulesHelper.js";import{withStaticPropsWithoutForwardRef as m}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import d from"./Divider.module.scss.js";var p=m((function(e){var m=e.className,p=void 0===m?void 0:m,l=e.withoutMargin,n=void 0!==l&&l,c=e.direction,v=void 0===c?"horizontal":c,f=e.id;return o.createElement("div",{id:f,"data-testid":e["data-testid"]||r(i.DIVIDER,f),className:s(d.divider,p,a(d,v),t({},d.withoutMargin,n))})}),{directions:e});export{p as default};
|
|
2
2
|
//# sourceMappingURL=Divider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Divider.js","sources":["../../../../../src/components/Divider/Divider.tsx"],"sourcesContent":["import { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport cx from \"classnames\";\nimport React from \"react\";\nimport { DirectionType as DirectionTypeEnum } from \"./DividerConstants\";\nimport { DividerDirection } from \"./Divider.types\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport {
|
|
1
|
+
{"version":3,"file":"Divider.js","sources":["../../../../../src/components/Divider/Divider.tsx"],"sourcesContent":["import { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport cx from \"classnames\";\nimport React from \"react\";\nimport { DirectionType as DirectionTypeEnum } from \"./DividerConstants\";\nimport { DividerDirection } from \"./Divider.types\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport { VibeComponentProps, withStaticPropsWithoutForwardRef } from \"../../types\";\nimport styles from \"./Divider.module.scss\";\n\nexport interface DividerProps extends VibeComponentProps {\n /**\n * The direction of the divider.\n */\n direction?: DividerDirection;\n /**\n * If true, removes margin from the divider.\n */\n withoutMargin?: boolean;\n}\n\nconst Divider = ({\n className = undefined,\n withoutMargin = false,\n direction = \"horizontal\",\n id,\n \"data-testid\": dataTestId\n}: DividerProps) => {\n return (\n <div\n id={id}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.DIVIDER, id)}\n className={cx(styles.divider, className, getStyle(styles, direction), {\n [styles.withoutMargin]: withoutMargin\n })}\n />\n );\n};\n\ninterface DividerStaticProps {\n directions: typeof DirectionTypeEnum;\n}\n\nexport default withStaticPropsWithoutForwardRef<DividerProps, DividerStaticProps>(Divider, {\n directions: DirectionTypeEnum\n});\n"],"names":["withStaticPropsWithoutForwardRef","_ref","_ref$className","className","undefined","_ref$withoutMargin","withoutMargin","_ref$direction","direction","id","React","createElement","getTestId","ComponentDefaultTestId","DIVIDER","cx","styles","divider","getStyle","_defineProperty","directions","DirectionTypeEnum"],"mappings":"2eAoBA,IAsBeA,EAAAA,GAtBC,SAAHC,GAMM,IAAAC,EAAAD,EALjBE,UAAAA,OAAYC,IAAHF,OAAGE,EAASF,EAAAG,EAAAJ,EACrBK,cAAAA,OAAgB,IAAHD,GAAQA,EAAAE,EAAAN,EACrBO,UAAAA,OAAY,IAAHD,EAAG,aAAYA,EACxBE,EAAER,EAAFQ,GAGA,OACEC,EAAAC,cAAA,MAAA,CACEF,GAAIA,EACS,cALQR,EAAzB,gBAK+BW,EAAUC,EAAuBC,QAASL,GACrEN,UAAWY,EAAGC,EAAOC,QAASd,EAAWe,EAASF,EAAQR,GAAUW,EAAA,CAAA,EACjEH,EAAOV,cAAgBA,KAIhC,GAM2F,CACzFc,WAAYC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{slicedToArray as e,defineProperty as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import o,{useMemo as r,useCallback as i,cloneElement as l}from"react";import a from"react-dom";import n from"classnames";import{useA11yDialog as s}from"./a11yDialog.js";import d from"./LegacyModalContent/LegacyModalContent.js";import m from"./LegacyModalHeader/LegacyModalHeader.js";import c from"./useBodyScrollLock.js";import u from"./useShowHideModal.js";import{ModalWidth as f,validateTitleProp as p,isModalHeader as v,isModalContent as y,isModalFooter as g}from"./ModalHelper.js";import{NOOP as j}from"../../utils/function-utils.js";import{
|
|
1
|
+
import{slicedToArray as e,defineProperty as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import o,{useMemo as r,useCallback as i,cloneElement as l}from"react";import a from"react-dom";import n from"classnames";import{useA11yDialog as s}from"./a11yDialog.js";import d from"./LegacyModalContent/LegacyModalContent.js";import m from"./LegacyModalHeader/LegacyModalHeader.js";import c from"./useBodyScrollLock.js";import u from"./useShowHideModal.js";import{ModalWidth as f,validateTitleProp as p,isModalHeader as v,isModalContent as y,isModalFooter as g}from"./ModalHelper.js";import{NOOP as j}from"../../utils/function-utils.js";import{withStaticPropsWithoutForwardRef as h}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import{getTestId as L}from"../../tests/testIds.js";import{ComponentDefaultTestId as M}from"../../tests/constants.js";import w from"./LegacyModal.module.scss.js";import E from"../LayerProvider/LayerProvider.js";import{isClient as C}from"../../utils/ssr-utils.js";var A=h((function(f){var h=f.classNames,A=void 0===h?{container:"",overlay:"",modal:""}:h,b=f.id,D=f.show,O=f.title,P=void 0===O?"":O,H=f.description,S=void 0===H?"":H,B=f.onClose,N=void 0===B?j:B,x=f.alertDialog,_=void 0!==x&&x,k=f.children,z=f.triggerElement,I=f.width,R=void 0===I?"default":I,T=f.closeButtonAriaLabel,V=void 0===T?"Close":T,Y=f.contentSpacing,$=void 0!==Y&&Y,q=f.zIndex,F=void 0===q?1e4:q,G=f.unmountOnClose,J=void 0===G||G,K=f["data-testid"],Q=r((function(){return k?o.Children.toArray(k):[]}),[k]);p(P,Q);var U=s({id:b,alertDialog:_}),W=e(U,2),X=W[0],Z=W[1],ee=i((function(){_||null==N||N()}),[_,N]);c({instance:X});var te=u({instance:X,show:D,triggerElement:z,onClose:N,alertDialog:_}).shouldShow,oe=r((function(){var e=Z.title.id,t=Q.find(v);return t?l(t,{id:e,closeModal:N}):o.createElement(m,{title:P,description:S,closeModal:N,id:e,closeButtonAriaLabel:V})}),[Z.title,Q,P,S,N,V]),re=r((function(){return Q.find(y)||o.createElement(d,null,Q.filter((function(e){return!v(e)&&!g(e)})))}),[Q]),ie=r((function(){return Q.find(g)||null}),[Q]),le="default"!==R&&"full-width"!==R,ae=o.createElement(E,{layerRef:{current:null==X?void 0:X.$el}},o.createElement("div",Object.assign({},Z.container,{className:n(w.container,A.container),"data-testid":K||L(M.MODAL,b),style:{"--monday-modal-z-index":F}}),o.createElement("div",{onClick:ee,className:n(w.overlay,A.overlay),"data-testid":M.MODAL_OVERLAY}),o.createElement("div",Object.assign({},Z.dialog,{className:n(w.dialog,A.modal,t(t(t({},w.default,"default"===R),w.full,"full-width"===R),w.spacing,$)),style:{width:le?R:null}}),oe,re,ie)));return J&&!te?null:C()?a.createPortal(ae,document.body):null}),{width:f});export{A as default};
|
|
2
2
|
//# sourceMappingURL=LegacyModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegacyModal.js","sources":["../../../../../src/components/LegacyModal/LegacyModal.tsx"],"sourcesContent":["import React, { cloneElement, ReactElement, useCallback, useMemo } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport cx from \"classnames\";\nimport { useA11yDialog } from \"./a11yDialog\";\nimport ModalContent from \"./LegacyModalContent/LegacyModalContent\";\nimport ModalHeader from \"./LegacyModalHeader/LegacyModalHeader\";\nimport useBodyScrollLock from \"./useBodyScrollLock\";\nimport useShowHideModal from \"./useShowHideModal\";\nimport {\n isModalContent,\n isModalFooter,\n isModalHeader,\n ModalWidth as ModalWidthEnum,\n validateTitleProp\n} from \"./ModalHelper\";\nimport { NOOP } from \"../../utils/function-utils\";\nimport {
|
|
1
|
+
{"version":3,"file":"LegacyModal.js","sources":["../../../../../src/components/LegacyModal/LegacyModal.tsx"],"sourcesContent":["import React, { cloneElement, ReactElement, useCallback, useMemo } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport cx from \"classnames\";\nimport { useA11yDialog } from \"./a11yDialog\";\nimport ModalContent from \"./LegacyModalContent/LegacyModalContent\";\nimport ModalHeader from \"./LegacyModalHeader/LegacyModalHeader\";\nimport useBodyScrollLock from \"./useBodyScrollLock\";\nimport useShowHideModal from \"./useShowHideModal\";\nimport {\n isModalContent,\n isModalFooter,\n isModalHeader,\n ModalWidth as ModalWidthEnum,\n validateTitleProp\n} from \"./ModalHelper\";\nimport { NOOP } from \"../../utils/function-utils\";\nimport { withStaticPropsWithoutForwardRef } from \"../../types\";\nimport { getTestId } from \"../../tests/test-ids-utils\";\nimport { ComponentDefaultTestId } from \"../../tests/constants\";\nimport styles from \"./LegacyModal.module.scss\";\nimport { ModalWidth } from \"./LegacyModal.types\";\nimport LayerProvider from \"../LayerProvider/LayerProvider\";\nimport { isClient } from \"../../utils/ssr-utils\";\n\nexport interface LegacyModalProps {\n /**\n * Id of the modal, used internally and for accessibility\n */\n id?: string;\n \"data-testid\"?: string;\n /**\n * Show/hide the Dialog\n */\n show: boolean;\n /**\n * Heading for the modal, mandatory when ModalHeader isn't provided in children\n */\n title?: string;\n /**\n * Description for the modal title\n */\n description?: string;\n /**\n * Called when the modal is closed (by close button/click outside/esc key)\n */\n onClose: () => void;\n /**\n * Makes the dialog behave like a modal (preventing closing on click outside of\n * ESC key)..\n */\n alertDialog?: boolean;\n /**\n * Used for the fromOrigin animation\n */\n triggerElement?: Element;\n /**\n * Set the modal's width. Can be one of the presets or any custom size\n */\n width?: ModalWidth | string;\n /**\n * Aria label for the close button\n */\n closeButtonAriaLabel?: string;\n /**\n * Add gaps between parts of the modal\n */\n contentSpacing?: boolean;\n /**\n * classNames for specific parts of the dialog\n */\n classNames?: {\n container?: string;\n overlay?: string;\n modal?: string;\n };\n /**\n * Dialog content\n */\n children?: ReactElement | ReactElement[];\n /**\n * z-index attribute of the container\n */\n zIndex?: number;\n /**\n * When `false`, the modal will remain in the DOM when closed\n */\n unmountOnClose?: boolean;\n}\n\nconst Modal = ({\n classNames = { container: \"\", overlay: \"\", modal: \"\" },\n id,\n show,\n title = \"\",\n description = \"\",\n onClose = NOOP,\n alertDialog = false,\n children,\n triggerElement,\n width = \"default\",\n closeButtonAriaLabel = \"Close\",\n contentSpacing = false,\n zIndex = 10000,\n unmountOnClose = true,\n \"data-testid\": dataTestId\n}: LegacyModalProps) => {\n const childrenArray: ReactElement[] = useMemo(\n () => (children ? (React.Children.toArray(children) as ReactElement[]) : []),\n [children]\n );\n validateTitleProp(title, childrenArray);\n\n const [instance, attr] = useA11yDialog({\n id,\n alertDialog\n });\n\n const closeIfNotAlertType = useCallback(() => {\n if (!alertDialog) {\n onClose?.();\n }\n }, [alertDialog, onClose]);\n\n // lock body scroll when modal is open\n useBodyScrollLock({ instance });\n\n // show/hide and animate the modal\n const { shouldShow } = useShowHideModal({\n instance,\n show,\n triggerElement,\n onClose,\n alertDialog\n });\n\n const header = useMemo(() => {\n const { id } = attr.title;\n const header = childrenArray.find(isModalHeader);\n if (header) {\n return cloneElement(header, { id, closeModal: onClose });\n }\n return (\n <ModalHeader\n title={title}\n description={description}\n closeModal={onClose}\n id={id}\n closeButtonAriaLabel={closeButtonAriaLabel}\n />\n );\n }, [attr.title, childrenArray, title, description, onClose, closeButtonAriaLabel]);\n\n const content = useMemo(() => {\n return (\n childrenArray.find(isModalContent) || (\n <ModalContent>{childrenArray.filter(child => !isModalHeader(child) && !isModalFooter(child))}</ModalContent>\n )\n );\n }, [childrenArray]);\n\n const footer = useMemo(() => {\n return childrenArray.find(isModalFooter) || null;\n }, [childrenArray]);\n\n const customWidth = width !== \"default\" && width !== \"full-width\";\n\n const dialog = (\n <LayerProvider layerRef={{ current: instance?.$el }}>\n <div\n {...attr.container}\n className={cx(styles.container, classNames.container)}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.MODAL, id)}\n style={{ \"--monday-modal-z-index\": zIndex }}\n >\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n <div\n onClick={closeIfNotAlertType}\n className={cx(styles.overlay, classNames.overlay)}\n data-testid={ComponentDefaultTestId.MODAL_OVERLAY}\n />\n <div\n {...attr.dialog}\n className={cx(styles.dialog, classNames.modal, {\n [styles.default]: width === \"default\",\n [styles.full]: width === \"full-width\",\n [styles.spacing]: contentSpacing\n })}\n style={{ width: customWidth ? width : null }}\n >\n {header}\n {content}\n {footer}\n </div>\n </div>\n </LayerProvider>\n );\n\n if (unmountOnClose && !shouldShow) {\n return null;\n }\n return isClient() ? ReactDOM.createPortal(dialog, document.body) : null;\n};\n\ninterface LegacyModalStaticProps {\n width: typeof ModalWidthEnum;\n}\n\nexport default withStaticPropsWithoutForwardRef<LegacyModalProps, LegacyModalStaticProps>(Modal, {\n width: ModalWidthEnum\n});\n"],"names":["withStaticPropsWithoutForwardRef","_ref","_ref$classNames","classNames","container","overlay","modal","id","show","_ref$title","title","_ref$description","description","_ref$onClose","onClose","NOOP","_ref$alertDialog","alertDialog","children","triggerElement","_ref$width","width","_ref$closeButtonAriaL","closeButtonAriaLabel","_ref$contentSpacing","contentSpacing","_ref$zIndex","zIndex","_ref$unmountOnClose","unmountOnClose","dataTestId","childrenArray","useMemo","React","Children","toArray","validateTitleProp","_useA11yDialog","useA11yDialog","_useA11yDialog2","_slicedToArray","instance","attr","closeIfNotAlertType","useCallback","useBodyScrollLock","shouldShow","useShowHideModal","header","find","isModalHeader","cloneElement","closeModal","createElement","ModalHeader","content","isModalContent","ModalContent","filter","child","isModalFooter","footer","customWidth","dialog","LayerProvider","layerRef","current","$el","Object","assign","className","cx","styles","getTestId","ComponentDefaultTestId","MODAL","style","onClick","MODAL_OVERLAY","_defineProperty","default","full","spacing","isClient","ReactDOM","createPortal","document","body","ModalWidthEnum"],"mappings":"4/BAyFA,IAsHeA,EAAAA,GAtHD,SAAHC,GAgBY,IAAAC,EAAAD,EAfrBE,WAAAA,OAAa,IAAHD,EAAG,CAAEE,UAAW,GAAIC,QAAS,GAAIC,MAAO,IAAIJ,EACtDK,EAAEN,EAAFM,GACAC,EAAIP,EAAJO,KAAIC,EAAAR,EACJS,MAAAA,OAAQ,IAAHD,EAAG,GAAEA,EAAAE,EAAAV,EACVW,YAAAA,OAAc,IAAHD,EAAG,GAAEA,EAAAE,EAAAZ,EAChBa,QAAAA,OAAUC,IAAHF,EAAGE,EAAIF,EAAAG,EAAAf,EACdgB,YAAAA,OAAc,IAAHD,GAAQA,EACnBE,EAAQjB,EAARiB,SACAC,EAAclB,EAAdkB,eAAcC,EAAAnB,EACdoB,MAAAA,OAAQ,IAAHD,EA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EAAckB,KAAKW,IAAkB,IAC9C,GAAG,CAAC7B,IAEE+B,GAAwB,YAAVzC,GAAiC,eAAVA,EAErC0C,GACJ9B,gBAAC+B,EAAa,CAACC,SAAU,CAAEC,QAASzB,eAAAA,EAAU0B,MAC5ClC,EAAAoB,cAAA,MAAAe,OAAAC,OAAA,CAAA,EACM3B,EAAKtC,UAAS,CAClBkE,UAAWC,EAAGC,EAAOpE,UAAWD,EAAWC,WAAU,cACxC0B,GAAc2C,EAAUC,EAAuBC,MAAOpE,GACnEqE,MAAO,CAAE,yBAA0BjD,KAGnCM,EACEoB,cAAA,MAAA,CAAAwB,QAASlC,GACT2B,UAAWC,EAAGC,EAAOnE,QAASF,EAAWE,uBAC5BqE,EAAuBI,gBAEtC7C,EAAAoB,cAAA,MAAAe,OAAAC,OAAA,CAAA,EACM3B,EAAKqB,OAAM,CACfO,UAAWC,EAAGC,EAAOT,OAAQ5D,EAAWG,MAAKyE,EAAAA,EAAAA,KAC1CP,EAAOQ,QAAoB,YAAV3D,GACjBmD,EAAOS,KAAiB,eAAV5D,GACdmD,EAAOU,QAAUzD,IAEpBmD,MAAO,CAAEvD,MAAOyC,GAAczC,EAAQ,QAErC2B,GACAO,GACAM,MAMT,OAAIhC,IAAmBiB,GACd,KAEFqC,IAAaC,EAASC,aAAatB,GAAQuB,SAASC,MAAQ,IACrE,GAMiG,CAC/FlE,MAAOmE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"classnames";import t,{useRef as o}from"react";import{getTestId as s,ComponentDefaultTestId as n}from"../../../tests/testIds.js";import i from"../../Button/Button.js";import r from"../../Tooltip/Tooltip.js";import l from"../../../hooks/useMergeRef.js";import m from"../MenuItem/hooks/useMenuItemMouseEvents.js";import u from"../MenuItem/hooks/useMenuItemKeyboardEvents.js";import{
|
|
1
|
+
import e from"classnames";import t,{useRef as o}from"react";import{getTestId as s,ComponentDefaultTestId as n}from"../../../tests/testIds.js";import i from"../../Button/Button.js";import r from"../../Tooltip/Tooltip.js";import l from"../../../hooks/useMergeRef.js";import m from"../MenuItem/hooks/useMenuItemMouseEvents.js";import u from"../MenuItem/hooks/useMenuItemKeyboardEvents.js";import{withStaticPropsWithoutForwardRef as a}from"../../../types/withStaticProps.js";import"../../../utils/colors-vars-map.js";import d from"../../Text/Text.js";import c from"./MenuItemButton.module.scss.js";import{TooltipPositions as p}from"../../Tooltip/TooltipConstants.js";var I=function(a){var p=a.className,I=a.kind,v=void 0===I?"primary":I,f=a.leftIcon,M=void 0===f?null:f,h=a.rightIcon,b=void 0===h?null:h,x=a.disabled,j=void 0!==x&&x,k=a.disableReason,E=a.index,C=a.activeItemIndex,S=void 0===C?-1:C,y=a.onClick,T=a.tooltipPosition,B=void 0===T?"right":T,O=a.tooltipShowDelay,N=void 0===O?300:O,g=a.children,A=a.resetOpenSubMenuIndex,w=a.setSubMenuIsOpenByIndex,D=a.setActiveItemIndex,R=a.menuRef,P=a.closeMenu,U=a.useDocumentEventListeners,L=a.id,_=a["data-testid"],z=o(null),K=o(null),q=l(z,K),F=j&&k,G=k,H=S===E,J=m({ref:z,resetOpenSubMenuIndex:A,setSubMenuIsOpenByIndex:w,isActive:H,setActiveItemIndex:D,index:E,hasChildren:!1}),Q=u({onClick:y,disabled:j,isActive:H,index:E,setActiveItemIndex:D,hasChildren:!1,shouldShowSubMenu:!1,setSubMenuIsOpenByIndex:w,menuRef:R,isMouseEnter:J,closeMenu:P,useDocumentEventListeners:U}).onClickCallback;return t.createElement(r,{content:F?G:null,position:B,showDelay:N},t.createElement(d,{type:"text2",element:"li","data-testid":_||s(n.MENU_ITEM_BUTTON,L),id:L,className:e(c.itemButton,p),ref:q,role:"menuitem","aria-current":H},t.createElement(i,{className:c.buttonComponent,active:H,disabled:j,leftIcon:M,rightIcon:b,onClick:Q,kind:v,size:"small",blurOnMouseUp:!1},t.createElement("div",{className:c.content},g))))};Object.assign(I,{isSelectable:!0,isMenuChild:!0});var v=a(I,{kinds:i.kinds,tooltipPositions:p});export{v as default};
|
|
2
2
|
//# sourceMappingURL=MenuItemButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItemButton.js","sources":["../../../../../../src/components/Menu/MenuItemButton/MenuItemButton.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { useRef } from \"react\";\nimport { ComponentDefaultTestId, getTestId } from \"../../../tests/test-ids-utils\";\nimport Button from \"../../Button/Button\";\nimport Tooltip from \"../../Tooltip/Tooltip\";\nimport { ButtonType } from \"../../Button\";\nimport useMergeRef from \"../../../hooks/useMergeRef\";\nimport useMenuItemMouseEvents from \"../MenuItem/hooks/useMenuItemMouseEvents\";\nimport useMenuItemKeyboardEvents from \"../MenuItem/hooks/useMenuItemKeyboardEvents\";\nimport { SubIcon, VibeComponentProps,
|
|
1
|
+
{"version":3,"file":"MenuItemButton.js","sources":["../../../../../../src/components/Menu/MenuItemButton/MenuItemButton.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { useRef } from \"react\";\nimport { ComponentDefaultTestId, getTestId } from \"../../../tests/test-ids-utils\";\nimport Button from \"../../Button/Button\";\nimport Tooltip from \"../../Tooltip/Tooltip\";\nimport { ButtonType } from \"../../Button\";\nimport useMergeRef from \"../../../hooks/useMergeRef\";\nimport useMenuItemMouseEvents from \"../MenuItem/hooks/useMenuItemMouseEvents\";\nimport useMenuItemKeyboardEvents from \"../MenuItem/hooks/useMenuItemKeyboardEvents\";\nimport { SubIcon, VibeComponentProps, ElementContent, withStaticPropsWithoutForwardRef } from \"../../../types\";\nimport Text from \"../../Text/Text\";\nimport styles from \"./MenuItemButton.module.scss\";\nimport { TooltipPositions } from \"../../Tooltip\";\nimport { TooltipPositions as TooltipPositionsEnum } from \"../../Tooltip/TooltipConstants\";\n\nexport interface MenuItemButtonProps extends VibeComponentProps {\n /**\n * The style variant of the button.\n */\n kind?: ButtonType;\n /**\n * Icon displayed on the left side of the button.\n */\n leftIcon?: SubIcon;\n /**\n * Icon displayed on the right side of the button.\n */\n rightIcon?: SubIcon;\n /**\n * The index of the menu item in the menu.\n */\n index?: number;\n /**\n * The index of the currently active menu item.\n */\n activeItemIndex?: number;\n /**\n * If true, the button is disabled.\n */\n disabled?: boolean;\n /**\n * The reason why the button is disabled, displayed as a tooltip.\n */\n disableReason?: string;\n /**\n * Callback fired when the button is clicked.\n */\n onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;\n /**\n * The position of the tooltip.\n */\n tooltipPosition?: TooltipPositions;\n /**\n * The delay in milliseconds before the tooltip appears.\n */\n tooltipShowDelay?: number;\n /**\n * Callback to reset the open submenu index.\n */\n resetOpenSubMenuIndex?: () => void;\n /**\n * Callback to open or close a submenu by index.\n */\n setSubMenuIsOpenByIndex?: (index: number, isOpen: boolean) => void;\n /**\n * Callback to set the active item index.\n */\n setActiveItemIndex?: (index: number) => void;\n /**\n * Reference to the menu container.\n */\n menuRef?: React.RefObject<HTMLElement>;\n /**\n * Function to close the menu.\n */\n closeMenu?: () => void;\n /**\n * If true, event listeners are added at the document level.\n */\n useDocumentEventListeners?: boolean;\n /**\n * The content of the button.\n */\n children?: ElementContent | ElementContent[];\n}\n\nconst MenuItemButton = ({\n className,\n kind = \"primary\",\n leftIcon = null,\n rightIcon = null,\n disabled = false,\n disableReason,\n index,\n activeItemIndex = -1,\n onClick,\n tooltipPosition = \"right\",\n tooltipShowDelay = 300,\n children,\n resetOpenSubMenuIndex,\n setSubMenuIsOpenByIndex,\n setActiveItemIndex,\n menuRef,\n closeMenu,\n useDocumentEventListeners,\n id,\n \"data-testid\": dataTestId\n}: MenuItemButtonProps) => {\n const ref = useRef(null);\n const referenceElementRef = useRef(null);\n const mergedRef = useMergeRef(ref, referenceElementRef);\n\n const shouldShowTooltip = disabled && disableReason;\n const tooltipContent = disableReason;\n\n const isActive = activeItemIndex === index;\n\n const isMouseEnter = useMenuItemMouseEvents({\n ref,\n resetOpenSubMenuIndex,\n setSubMenuIsOpenByIndex,\n isActive,\n setActiveItemIndex,\n index,\n hasChildren: false\n });\n\n const { onClickCallback } = useMenuItemKeyboardEvents({\n onClick,\n disabled,\n isActive,\n index,\n setActiveItemIndex,\n hasChildren: false,\n shouldShowSubMenu: false,\n setSubMenuIsOpenByIndex,\n menuRef,\n isMouseEnter,\n closeMenu,\n useDocumentEventListeners\n });\n\n return (\n <Tooltip\n content={shouldShowTooltip ? tooltipContent : null}\n position={tooltipPosition}\n showDelay={tooltipShowDelay}\n >\n <Text\n type=\"text2\"\n element=\"li\"\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.MENU_ITEM_BUTTON, id)}\n id={id}\n className={cx(styles.itemButton, className)}\n ref={mergedRef}\n role=\"menuitem\"\n aria-current={isActive}\n >\n <Button\n className={styles.buttonComponent}\n active={isActive}\n disabled={disabled}\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n onClick={onClickCallback}\n kind={kind}\n size=\"small\"\n blurOnMouseUp={false}\n >\n <div className={styles.content}>{children}</div>\n </Button>\n </Text>\n </Tooltip>\n );\n};\n\nObject.assign(MenuItemButton, {\n isSelectable: true,\n isMenuChild: true\n});\n\ninterface MenuItemButtonStaticProps {\n kinds: typeof Button.kinds;\n tooltipPositions: typeof TooltipPositionsEnum;\n}\n\nexport default withStaticPropsWithoutForwardRef<MenuItemButtonProps, MenuItemButtonStaticProps>(MenuItemButton, {\n kinds: Button.kinds,\n tooltipPositions: TooltipPositionsEnum\n});\n"],"names":["MenuItemButton","_ref","className","_ref$kind","kind","_ref$leftIcon","leftIcon","_ref$rightIcon","rightIcon","_ref$disabled","disabled","disableReason","index","_ref$activeItemIndex","activeItemIndex","onClick","_ref$tooltipPosition","tooltipPosition","_ref$tooltipShowDelay","tooltipShowDelay","children","resetOpenSubMenuIndex","setSubMenuIsOpenByIndex","setActiveItemIndex","menuRef","closeMenu","useDocumentEventListeners","id","dataTestId","ref","useRef","referenceElementRef","mergedRef","useMergeRef","shouldShowTooltip","tooltipContent","isActive","isMouseEnter","useMenuItemMouseEvents","hasChildren","onClickCallback","useMenuItemKeyboardEvents","shouldShowSubMenu","React","Tooltip","content","position","showDelay","createElement","Text","type","element","getTestId","ComponentDefaultTestId","MENU_ITEM_BUTTON","cx","styles","itemButton","role","Button","buttonComponent","active","size","blurOnMouseUp","Object","assign","isSelectable","isMenuChild","withStaticPropsWithoutForwardRef","kinds","tooltipPositions","TooltipPositionsEnum"],"mappings":"upBAsFA,IAAMA,EAAiB,SAAHC,GAqBM,IApBxBC,EAASD,EAATC,UAASC,EAAAF,EACTG,KAAAA,OAAO,IAAHD,EAAG,UAASA,EAAAE,EAAAJ,EAChBK,SAAAA,OAAW,IAAHD,EAAG,KAAIA,EAAAE,EAAAN,EACfO,UAAAA,OAAY,IAAHD,EAAG,KAAIA,EAAAE,EAAAR,EAChBS,SAAAA,OAAW,IAAHD,GAAQA,EAChBE,EAAaV,EAAbU,cACAC,EAAKX,EAALW,MAAKC,EAAAZ,EACLa,gBAAAA,OAAe,IAAAD,GAAI,EAACA,EACpBE,EAAOd,EAAPc,QAAOC,EAAAf,EACPgB,gBAAAA,OAAkB,IAAHD,EAAG,QAAOA,EAAAE,EAAAjB,EACzBkB,iBAAAA,OAAmB,IAAHD,EAAG,IAAGA,EACtBE,EAAQnB,EAARmB,SACAC,EAAqBpB,EAArBoB,sBACAC,EAAuBrB,EAAvBqB,wBACAC,EAAkBtB,EAAlBsB,mBACAC,EAAOvB,EAAPuB,QACAC,EAASxB,EAATwB,UACAC,EAAyBzB,EAAzByB,0BACAC,EAAE1B,EAAF0B,GACeC,EAAU3B,EAAzB,eAEM4B,EAAMC,EAAO,MACbC,EAAsBD,EAAO,MAC7BE,EAAYC,EAAYJ,EAAKE,GAE7BG,EAAoBxB,GAAYC,EAChCwB,EAAiBxB,EAEjByB,EAAWtB,IAAoBF,EAE/ByB,EAAeC,EAAuB,CAC1CT,IAAAA,EACAR,sBAAAA,EACAC,wBAAAA,EACAc,SAAAA,EACAb,mBAAAA,EACAX,MAAAA,EACA2B,aAAa,IAGPC,EAAoBC,EAA0B,CACpD1B,QAAAA,EACAL,SAAAA,EACA0B,SAAAA,EACAxB,MAAAA,EACAW,mBAAAA,EACAgB,aAAa,EACbG,mBAAmB,EACnBpB,wBAAAA,EACAE,QAAAA,EACAa,aAAAA,EACAZ,UAAAA,EACAC,0BAAAA,IAZMc,gBAeR,OACEG,gBAACC,EAAO,CACNC,QAASX,EAAoBC,EAAiB,KAC9CW,SAAU7B,EACV8B,UAAW5B,GAEXwB,EAACK,cAAAC,GACCC,KAAK,QACLC,QAAQ,KAAI,cACCvB,GAAcwB,EAAUC,EAAuBC,iBAAkB3B,GAC9EA,GAAIA,EACJzB,UAAWqD,EAAGC,EAAOC,WAAYvD,GACjC2B,IAAKG,EACL0B,KAAK,0BACStB,GAEdO,EAAAK,cAACW,EACC,CAAAzD,UAAWsD,EAAOI,gBAClBC,OAAQzB,EACR1B,SAAUA,EACVJ,SAAUA,EACVE,UAAWA,EACXO,QAASyB,EACTpC,KAAMA,EACN0D,KAAK,QACLC,eAAe,GAEfpB,EAAAK,cAAA,MAAA,CAAK9C,UAAWsD,EAAOX,SAAUzB,KAK3C,EAEA4C,OAAOC,OAAOjE,EAAgB,CAC5BkE,cAAc,EACdC,aAAa,IAQf,IAAeC,EAAAA,EAAiFpE,EAAgB,CAC9GqE,MAAOV,EAAOU,MACdC,iBAAkBC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"react";import s from"classnames";import{camelCase as o}from"lodash-es";import{getStyle as e}from"../../../helpers/typesciptCssModulesHelper.js";import{getTestId as i,ComponentDefaultTestId as r}from"../../../tests/testIds.js";import a from"../../Text/Text.js";import{MenuTitleCaptionPosition as m}from"./MenuTitleConstants.js";import{
|
|
1
|
+
import t from"react";import s from"classnames";import{camelCase as o}from"lodash-es";import{getStyle as e}from"../../../helpers/typesciptCssModulesHelper.js";import{getTestId as i,ComponentDefaultTestId as r}from"../../../tests/testIds.js";import a from"../../Text/Text.js";import{MenuTitleCaptionPosition as m}from"./MenuTitleConstants.js";import{withStaticPropsWithoutForwardRef as p}from"../../../types/withStaticProps.js";import"../../../utils/colors-vars-map.js";import n from"./MenuTitle.module.scss.js";var l=function(m){var p=m.caption,l=void 0===p?"":p,c=m.captionPosition,d=void 0===c?"bottom":c,f=m.id,u=m["data-testid"];return t.createElement(a,{color:"secondary",type:"text2",className:s(n.title,m.className),"data-testid":u||i(r.MENU_TITLE,f)},function(){if(l)return t.createElement("label",{className:s(n.titleCaption,e(n,o("title__caption--"+d))),id:f,"data-testid":u||i(r.MENU_TITLE_CAPTION,f)},l)}())};Object.assign(l,{isMenuChild:!0});var c=p(l,{positions:m,captionPositions:m});export{c as default};
|
|
2
2
|
//# sourceMappingURL=MenuTitle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuTitle.js","sources":["../../../../../../src/components/Menu/MenuTitle/MenuTitle.tsx"],"sourcesContent":["import React from \"react\";\nimport cx from \"classnames\";\nimport { camelCase } from \"lodash-es\";\nimport { getStyle } from \"../../../helpers/typesciptCssModulesHelper\";\nimport { ComponentDefaultTestId, getTestId } from \"../../../tests/test-ids-utils\";\nimport Text from \"../../Text/Text\";\nimport { MenuTitleCaptionPosition as MenuTitleCaptionPositionEnum } from \"./MenuTitleConstants\";\nimport { MenuTitleCaptionPosition } from \"./MenuTitle.type\";\nimport { VibeComponentProps,
|
|
1
|
+
{"version":3,"file":"MenuTitle.js","sources":["../../../../../../src/components/Menu/MenuTitle/MenuTitle.tsx"],"sourcesContent":["import React from \"react\";\nimport cx from \"classnames\";\nimport { camelCase } from \"lodash-es\";\nimport { getStyle } from \"../../../helpers/typesciptCssModulesHelper\";\nimport { ComponentDefaultTestId, getTestId } from \"../../../tests/test-ids-utils\";\nimport Text from \"../../Text/Text\";\nimport { MenuTitleCaptionPosition as MenuTitleCaptionPositionEnum } from \"./MenuTitleConstants\";\nimport { MenuTitleCaptionPosition } from \"./MenuTitle.type\";\nimport { VibeComponentProps, withStaticPropsWithoutForwardRef } from \"../../../types\";\nimport styles from \"./MenuTitle.module.scss\";\n\nexport interface MenuTitleProps extends VibeComponentProps {\n /**\n * The caption text displayed alongside the title.\n */\n caption?: string | React.ReactNode;\n /**\n * The position of the caption relative to the title.\n */\n captionPosition?: MenuTitleCaptionPosition;\n}\n\nconst MenuTitle = ({\n className,\n caption = \"\",\n captionPosition = \"bottom\",\n id,\n \"data-testid\": dataTestId\n}: MenuTitleProps) => {\n const renderCaptionIfNeeded = () => {\n if (caption) {\n return (\n <label\n className={cx(styles.titleCaption, getStyle(styles, camelCase(\"title__caption--\" + captionPosition)))}\n id={id}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.MENU_TITLE_CAPTION, id)}\n >\n {caption}\n </label>\n );\n }\n };\n return (\n <Text\n color=\"secondary\"\n type=\"text2\"\n className={cx(styles.title, className)}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.MENU_TITLE, id)}\n >\n {renderCaptionIfNeeded()}\n </Text>\n );\n};\n\nObject.assign(MenuTitle, {\n isMenuChild: true\n});\n\ninterface MenuTitleStaticProps {\n positions: typeof MenuTitleCaptionPositionEnum;\n captionPositions: typeof MenuTitleCaptionPositionEnum;\n}\n\nexport default withStaticPropsWithoutForwardRef<MenuTitleProps, MenuTitleStaticProps>(MenuTitle, {\n positions: MenuTitleCaptionPositionEnum,\n captionPositions: MenuTitleCaptionPositionEnum\n});\n"],"names":["MenuTitle","_ref","_ref$caption","caption","_ref$captionPosition","captionPosition","id","dataTestId","React","createElement","Text","color","type","className","cx","styles","title","getTestId","ComponentDefaultTestId","MENU_TITLE","titleCaption","getStyle","camelCase","MENU_TITLE_CAPTION","renderCaptionIfNeeded","Object","assign","isMenuChild","withStaticPropsWithoutForwardRef","positions","MenuTitleCaptionPositionEnum","captionPositions"],"mappings":"8fAsBA,IAAMA,EAAY,SAAHC,GAMM,IALVC,EAAAD,EACTE,QAAAA,OAAU,IAAHD,EAAG,GAAEA,EAAAE,EAAAH,EACZI,gBAAAA,OAAkB,IAAHD,EAAG,SAAQA,EAC1BE,EAAEL,EAAFK,GACeC,EAAUN,EAAzB,eAeA,OACEO,EAACC,cAAAC,EACC,CAAAC,MAAM,YACNC,KAAK,QACLC,UAAWC,EAAGC,EAAOC,MAvBhBf,EAATY,WAwBiB,cAAAN,GAAcU,EAAUC,EAAuBC,WAAYb,IAlB9C,WAC5B,GAAIH,EACF,OACEK,EACEC,cAAA,QAAA,CAAAI,UAAWC,EAAGC,EAAOK,aAAcC,EAASN,EAAQO,EAAU,mBAAqBjB,KACnFC,GAAIA,EACS,cAAAC,GAAcU,EAAUC,EAAuBK,mBAAoBjB,IAE/EH,GAYJqB,GAGP,EAEAC,OAAOC,OAAO1B,EAAW,CACvB2B,aAAa,IAQf,IAAeC,EAAAA,EAAuE5B,EAAW,CAC/F6B,UAAWC,EACXC,iBAAkBD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{defineProperty as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import{camelCase as s}from"lodash-es";import{getTestId as r,ComponentDefaultTestId as i}from"../../tests/testIds.js";import l from"classnames";import{SkeletonType as o,SKELETON_SIZES as a,TextSkeletonSize as m,SKELETON_CUSTOM_SIZE as p}from"./SkeletonConstants.js";import{getStyle as d}from"../../helpers/typesciptCssModulesHelper.js";import{
|
|
1
|
+
import{defineProperty as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import{camelCase as s}from"lodash-es";import{getTestId as r,ComponentDefaultTestId as i}from"../../tests/testIds.js";import l from"classnames";import{SkeletonType as o,SKELETON_SIZES as a,TextSkeletonSize as m,SKELETON_CUSTOM_SIZE as p}from"./SkeletonConstants.js";import{getStyle as d}from"../../helpers/typesciptCssModulesHelper.js";import{withStaticPropsWithoutForwardRef as c}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import n from"./Skeleton.module.scss.js";var u=c((function(a){var c=a.type,u=void 0===c?"rectangle":c,f=a.size,h=void 0===f?"custom":f,v=a.className,j=a.wrapperClassName,y=a.width,g=a.height,N=a.fullWidth,w=void 0!==N&&N,E=a.id,S=a["data-testid"],b=Object.values(o).includes(u)?u:"rectangle",k=Object.values(m).includes(h)?h:p;return t.createElement("div",{id:E,className:l(n.skeleton,j,e({},n.fullWidth,w)),"data-testid":S||r(i.SKELETON,E)},t.createElement("div",{className:l(n[b],d(n,s(b+"-"+k)),v,e({},n.fullWidth,w)),style:{width:y,height:g}}))}),{types:o,sizes:a});export{u as default};
|
|
2
2
|
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.js","sources":["../../../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import React from \"react\";\nimport { camelCase } from \"lodash-es\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport cx from \"classnames\";\nimport {\n SKELETON_SIZES,\n SkeletonType as SkeletonTypeEnum,\n SKELETON_CUSTOM_SIZE,\n TextSkeletonSize as TextSkeletonSizeEnum\n} from \"./SkeletonConstants\";\n\nimport { SkeletonType, SkeletonSizeType } from \"./Skelton.types\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport {
|
|
1
|
+
{"version":3,"file":"Skeleton.js","sources":["../../../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import React from \"react\";\nimport { camelCase } from \"lodash-es\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport cx from \"classnames\";\nimport {\n SKELETON_SIZES,\n SkeletonType as SkeletonTypeEnum,\n SKELETON_CUSTOM_SIZE,\n TextSkeletonSize as TextSkeletonSizeEnum\n} from \"./SkeletonConstants\";\n\nimport { SkeletonType, SkeletonSizeType } from \"./Skelton.types\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport { VibeComponentProps, withStaticPropsWithoutForwardRef } from \"../../types\";\nimport styles from \"./Skeleton.module.scss\";\n\nexport interface SkeletonProps extends VibeComponentProps {\n /**\n * The type of skeleton.\n */\n type?: SkeletonType;\n /**\n * The predefined size of the skeleton.\n */\n size?: SkeletonSizeType;\n /**\n * The width of the skeleton in pixels.\n */\n width?: number;\n /**\n * The height of the skeleton in pixels.\n */\n height?: number;\n /**\n * Class name applied to the wrapper element.\n */\n wrapperClassName?: string;\n /**\n * If true, the skeleton will take up the full width of its container.\n */\n fullWidth?: boolean;\n}\n\nconst Skeleton = ({\n type = \"rectangle\",\n size = \"custom\",\n className,\n wrapperClassName,\n width,\n height,\n fullWidth = false,\n id,\n \"data-testid\": dataTestId\n}: SkeletonProps) => {\n const skeletonType = (Object.values(SkeletonTypeEnum) as string[]).includes(type) ? type : \"rectangle\";\n\n // Skeleton has sizes only for text type, other types support only custom size\n const skeletonSize = (Object.values(TextSkeletonSizeEnum) as string[]).includes(size) ? size : SKELETON_CUSTOM_SIZE;\n\n return (\n <div\n id={id}\n className={cx(styles.skeleton, wrapperClassName, { [styles.fullWidth]: fullWidth })}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.SKELETON, id)}\n >\n <div\n className={cx(styles[skeletonType], getStyle(styles, camelCase(skeletonType + \"-\" + skeletonSize)), className, {\n [styles.fullWidth]: fullWidth\n })}\n style={{ width, height }}\n />\n </div>\n );\n};\n\ninterface SkeletonStaticProps {\n types: typeof SkeletonTypeEnum;\n sizes: typeof SKELETON_SIZES;\n}\n\nexport default withStaticPropsWithoutForwardRef<SkeletonProps, SkeletonStaticProps>(Skeleton, {\n types: SkeletonTypeEnum,\n sizes: SKELETON_SIZES\n});\n"],"names":["withStaticPropsWithoutForwardRef","_ref","_ref$type","type","_ref$size","size","className","wrapperClassName","width","height","_ref$fullWidth","fullWidth","id","dataTestId","skeletonType","Object","values","SkeletonTypeEnum","includes","skeletonSize","TextSkeletonSizeEnum","SKELETON_CUSTOM_SIZE","React","createElement","cx","styles","skeleton","_defineProperty","getTestId","ComponentDefaultTestId","SKELETON","getStyle","camelCase","style","types","sizes","SKELETON_SIZES"],"mappings":"slBA2CA,IAqCeA,EAAAA,GArCE,SAAHC,GAUM,IAAAC,EAAAD,EATlBE,KAAAA,OAAO,IAAHD,EAAG,YAAWA,EAAAE,EAAAH,EAClBI,KAAAA,OAAO,IAAHD,EAAG,SAAQA,EACfE,EAASL,EAATK,UACAC,EAAgBN,EAAhBM,iBACAC,EAAKP,EAALO,MACAC,EAAMR,EAANQ,OAAMC,EAAAT,EACNU,UAAAA,OAAY,IAAHD,GAAQA,EACjBE,EAAEX,EAAFW,GACeC,EAAUZ,EAAzB,eAEMa,EAAgBC,OAAOC,OAAOC,GAA+BC,SAASf,GAAQA,EAAO,YAGrFgB,EAAgBJ,OAAOC,OAAOI,GAAmCF,SAASb,GAAQA,EAAOgB,EAE/F,OACEC,EACEC,cAAA,MAAA,CAAAX,GAAIA,EACJN,UAAWkB,EAAGC,EAAOC,SAAUnB,EAAgBoB,KAAKF,EAAOd,UAAYA,IAC1D,cAAAE,GAAce,EAAUC,EAAuBC,SAAUlB,IAEtEU,EACEC,cAAA,MAAA,CAAAjB,UAAWkB,EAAGC,EAAOX,GAAeiB,EAASN,EAAQO,EAAUlB,EAAe,IAAMK,IAAgBb,EAASqB,EAC1GF,CAAAA,EAAAA,EAAOd,UAAYA,IAEtBsB,MAAO,CAAEzB,MAAAA,EAAOC,OAAAA,KAIxB,GAO8F,CAC5FyB,MAAOjB,EACPkB,MAAOC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{slicedToArray as r}from"../../../_virtual/_rollupPluginBabelHelpers.js";import s from"react";import{InfixKind as o}from"./SliderConstants.js";import{useSliderInfixComponent as i}from"./SliderInfixHooks.js";import t from"classnames";import{getStyle as e}from"../../helpers/typesciptCssModulesHelper.js";import{
|
|
1
|
+
import{slicedToArray as r}from"../../../_virtual/_rollupPluginBabelHelpers.js";import s from"react";import{InfixKind as o}from"./SliderConstants.js";import{useSliderInfixComponent as i}from"./SliderInfixHooks.js";import t from"classnames";import{getStyle as e}from"../../helpers/typesciptCssModulesHelper.js";import{withStaticPropsWithoutForwardRef as m}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import l from"./SliderInfix.module.scss.js";var p=m((function o(m){var p=m.kind,a=void 0===p?o.kinds.PREFIX:p,n=i(a),f=r(n,4),d=f[1],c=f[2],u=f[3];return f[0]&&s.createElement("div",{className:t(l.infix,e(l,a),d.map((function(r){return e(l,r)}))),style:u},c)}),{kinds:o});export{p as default};
|
|
2
2
|
//# sourceMappingURL=SliderInfix.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderInfix.js","sources":["../../../../../src/components/Slider/SliderInfix.tsx"],"sourcesContent":["import React, { FC } from \"react\";\nimport { InfixKind as InfixKindEnum } from \"./SliderConstants\";\nimport { useSliderInfixComponent } from \"./SliderInfixHooks\";\nimport cx from \"classnames\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport {
|
|
1
|
+
{"version":3,"file":"SliderInfix.js","sources":["../../../../../src/components/Slider/SliderInfix.tsx"],"sourcesContent":["import React, { FC } from \"react\";\nimport { InfixKind as InfixKindEnum } from \"./SliderConstants\";\nimport { useSliderInfixComponent } from \"./SliderInfixHooks\";\nimport cx from \"classnames\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport { VibeComponentProps, withStaticPropsWithoutForwardRef } from \"../../types\";\nimport styles from \"./SliderInfix.module.scss\";\nimport { InfixKind } from \"./Slider.types\";\n\nexport interface SliderInfixProps extends VibeComponentProps {\n /**\n * Specifies the type of infix (prefix or postfix).\n */\n kind?: InfixKind;\n}\n\nconst SliderInfix: FC<SliderInfixProps> & { kinds?: typeof InfixKindEnum } = ({ kind = SliderInfix.kinds.PREFIX }) => {\n const [isShow, modificators, InfixComponent, inlineStyle] = useSliderInfixComponent(kind);\n return (\n isShow && (\n <div\n className={cx(\n styles.infix,\n getStyle(styles, kind),\n modificators.map(m => getStyle(styles, m))\n )}\n style={inlineStyle}\n >\n {InfixComponent}\n </div>\n )\n );\n};\n\nexport default withStaticPropsWithoutForwardRef<SliderInfixProps, { kinds: typeof InfixKindEnum }>(SliderInfix, {\n kinds: InfixKindEnum\n});\n"],"names":["withStaticPropsWithoutForwardRef","SliderInfix","_ref","_ref$kind","kind","kinds","PREFIX","_useSliderInfixCompon","useSliderInfixComponent","_useSliderInfixCompon2","_slicedToArray","modificators","InfixComponent","inlineStyle","React","className","cx","styles","infix","getStyle","map","m","style","InfixKindEnum"],"mappings":"0dAgBA,IAkBeA,EAAAA,GAlB8D,SAAvEC,EAAWC,GAAoG,IAAAC,EAAAD,EAArCE,KAAAA,OAAOH,IAAHE,EAAGF,EAAYI,MAAMC,OAAMH,EAC7GI,EAA4DC,EAAwBJ,GAAKK,EAAAC,EAAAH,EAAA,GAA1EI,EAAYF,EAAA,GAAEG,EAAcH,EAAA,GAAEI,EAAWJ,EAAA,GACxD,OADaA,EAAA,IAGTK,uBACEC,UAAWC,EACTC,EAAOC,MACPC,EAASF,EAAQb,GACjBO,EAAaS,KAAI,SAAAC,GAAC,OAAIF,EAASF,EAAQI,EAAE,KAE3CC,MAAOT,GAEND,EAIT,GAEgH,CAC9GP,MAAOkB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{slicedToArray as o,defineProperty as e,toConsumableArray as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{__rest as i}from"../../../_virtual/_tslib.js";import{camelCase as n}from"lodash-es";import{getStyle as a}from"../../helpers/typesciptCssModulesHelper.js";import{getTestId as r,ComponentDefaultTestId as s}from"../../tests/testIds.js";import l from"classnames";import d,{useState as c,useRef as m,useCallback as u,useMemo as g}from"react";import{SplitButtonSecondaryContentPosition as p,ENTER_KEYS as f,DEFAULT_DIALOG_SHOW_TRIGGER as D,DEFAULT_DIALOG_HIDE_TRIGGER as v,DIALOG_MOVE_BY as y,SECONDARY_BUTTON_ARIA_LABEL as C,SECONDARY_BUTTON_WRAPPER_CLASSNAME as T}from"./SplitButtonConstants.js";import{
|
|
1
|
+
import{slicedToArray as o,defineProperty as e,toConsumableArray as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{__rest as i}from"../../../_virtual/_tslib.js";import{camelCase as n}from"lodash-es";import{getStyle as a}from"../../helpers/typesciptCssModulesHelper.js";import{getTestId as r,ComponentDefaultTestId as s}from"../../tests/testIds.js";import l from"classnames";import d,{useState as c,useRef as m,useCallback as u,useMemo as g}from"react";import{SplitButtonSecondaryContentPosition as p,ENTER_KEYS as f,DEFAULT_DIALOG_SHOW_TRIGGER as D,DEFAULT_DIALOG_HIDE_TRIGGER as v,DIALOG_MOVE_BY as y,SECONDARY_BUTTON_ARIA_LABEL as C,SECONDARY_BUTTON_WRAPPER_CLASSNAME as T}from"./SplitButtonConstants.js";import{withStaticPropsWithoutForwardRef as S}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import{HideShowEvent as N,AnimationType as b}from"../Dialog/DialogConstants.js";import{NOOP as h}from"../../utils/function-utils.js";import{isInsideClass as k}from"../../utils/dom-utils.js";import P from"../../hooks/useKeyEvent/index.js";import j from"../../hooks/useEventListener/index.js";import I from"../Button/Button.js";import B from"../Dialog/Dialog.js";import O from"../DialogContentContainer/DialogContentContainer.js";import E from"./SplitButton.module.scss.js";import{ComponentVibeId as _}from"../../tests/constants.js";import z from"../../../icons/dist/react/DropdownChevronDown.js";var w=function(p){var S=p.secondaryDialogContent,w=p.onSecondaryDialogDidShow,L=void 0===w?h:w,A=p.onSecondaryDialogDidHide,x=void 0===A?h:A,R=p.shouldCloseOnClickInsideDialog,H=p.zIndex,U=void 0===H?null:H,M=p.secondaryDialogClassName,F=p.secondaryDialogPosition,K=void 0===F?"bottom-start":F,W=p.dialogContainerSelector,Y=p.dialogPaddingSize,V=void 0===Y?"medium":Y,X=p.disabled,q=p.loading,G=p.kind,J=p.color,Q=p.className,Z=p.leftIcon,$=p.rightIcon,oo=p.onClick,eo=p.children,to=p.marginLeft,io=p.marginRight,no=p.active,ao=p.id,ro=p["data-testid"],so=i(p,["secondaryDialogContent","onSecondaryDialogDidShow","onSecondaryDialogDidHide","shouldCloseOnClickInsideDialog","zIndex","secondaryDialogClassName","secondaryDialogPosition","dialogContainerSelector","dialogPaddingSize","disabled","success","loading","kind","color","className","leftIcon","rightIcon","onClick","children","marginLeft","marginRight","active","id","data-testid"]),lo=c(!1),co=o(lo,2),mo=co[0],uo=co[1],go=c(!1),po=o(go,2),fo=po[0],Do=po[1],vo=c(!1),yo=o(vo,2),Co=yo[0],To=yo[1],So=m(null),No=m(null),bo=u((function(){return Do(!0)}),[Do]),ho=u((function(){return Do(!1)}),[Do]),ko=u((function(o){return!X&&!k(o.target,T)}),[X]),Po=u((function(o){ko(o)&&To(!0)}),[To,ko]),jo=u((function(){return To(!1)}),[To]),Io=u((function(o){ko(o)&&To(!0)}),[To,ko]),Bo=u((function(){uo(!0),L()}),[uo,L]),Oo=u((function(o,e){uo(!1),x(),"esckey"===e&&No.current.focus()}),[uo,x]);j({eventName:"mouseenter",callback:bo,ref:So}),j({eventName:"mouseleave",callback:ho,ref:So}),j({eventName:"mousedown",callback:Po,ref:So}),j({eventName:"mouseup",callback:jo,ref:So}),j({eventName:"transitionend",callback:jo,ref:So}),P({keys:f,ref:So,callback:Io});var Eo=g((function(){return l(E.button,a(E,n("kind-"+G)),a(E,n("color-"+J)),e(e(e(e(e({},E.mainActive,no),E.active,Co),E.splitContentOpen,mo),E.hovered,fo),E.disabled,X),Q)}),[Q,G,J,no,Co,mo,fo,X]),_o=g((function(){return X?[]:D}),[X]),zo=g((function(){return R?[].concat(t(v),[N.CONTENT_CLICK]):v}),[R]),wo=u((function(){var o="function"==typeof S?S():S;return d.createElement(O,{type:O.types.POPOVER,size:V},o)}),[S,V]),Lo=g((function(){return"bottom"===K?"":"bottom-start"===K?"bottom":"top"}),[K]);return d.createElement("div",{className:Eo,ref:So,id:ao,"data-testid":ro||r(s.SPLIT_BUTTON,ao),"data-vibe":_.SPLIT_BUTTON},d.createElement(I,Object.assign({},so,{preventClickAnimation:!0,leftIcon:Z,rightIcon:$,rightFlat:!0,color:J,kind:G,active:no,onClick:oo,className:E.mainButton,marginLeft:to,onFocus:bo,onBlur:ho,disabled:X,loading:q,"data-testid":r(s.SPLIT_BUTTON_PRIMARY_BUTTON,ao)}),eo),d.createElement("div",{className:E.secondaryButtonWrapper},d.createElement(B,{wrapperClassName:M,zIndex:U,content:wo,position:K,containerSelector:W,startingEdge:Lo,animationType:b.EXPAND,moveBy:y,onDialogDidShow:Bo,onDialogDidHide:Oo,showTrigger:_o,hideTrigger:zo},d.createElement(I,Object.assign({},so,{ref:No,preventClickAnimation:!0,leftFlat:!0,noSidePadding:!0,color:J,kind:G,className:E.secondaryButton,active:mo,marginRight:io,onFocus:bo,onBlur:ho,disabled:X,ariaLabel:C,ariaHasPopup:!0,ariaExpanded:mo,"data-testid":r(s.SPLIT_BUTTON_SECONDARY_BUTTON,ao)}),d.createElement("div",{className:E.secondaryButtonIconWrapper},d.createElement(z,{"aria-hidden":"true"}))))))};w.defaultProps=Object.assign(Object.assign({},I.defaultProps),{onSecondaryDialogDidShow:h,onSecondaryDialogDidHide:h,zIndex:null,secondaryDialogClassName:"",secondaryDialogPosition:p.BOTTOM_START,dialogPaddingSize:O.sizes.MEDIUM});var L=S(w,{secondaryPositions:p,secondaryDialogPositions:p,sizes:I.sizes,colors:I.colors,kinds:I.kinds,inputTags:I.inputTags,dialogPaddingSizes:O.sizes});export{L as default};
|
|
2
2
|
//# sourceMappingURL=SplitButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitButton.js","sources":["../../../../../src/components/SplitButton/SplitButton.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\nimport { camelCase } from \"lodash-es\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport cx from \"classnames\";\n// Libraries import\nimport React, { ReactElement, useCallback, useMemo, useRef, useState } from \"react\";\n// Constants import\nimport {\n DEFAULT_DIALOG_HIDE_TRIGGER,\n DEFAULT_DIALOG_SHOW_TRIGGER,\n DIALOG_MOVE_BY,\n ENTER_KEYS,\n SECONDARY_BUTTON_ARIA_LABEL,\n SECONDARY_BUTTON_WRAPPER_CLASSNAME,\n SplitButtonSecondaryContentPosition,\n SplitButtonSecondaryContentPositionType\n} from \"./SplitButtonConstants\";\nimport { withStaticProps } from \"../../types\";\nimport { AnimationType, DialogPosition, HideShowEvent } from \"../Dialog/DialogConstants\";\n// Utils import\nimport { NOOP } from \"../../utils/function-utils\";\nimport { isInsideClass } from \"../../utils/dom-utils\";\n// Hooks import\nimport useKeyEvent from \"../../hooks/useKeyEvent\";\nimport useEventListener from \"../../hooks/useEventListener\";\n// Components import\nimport Button, { ButtonProps } from \"../Button/Button\";\nimport Dialog, { DialogEvent } from \"../Dialog/Dialog\";\nimport { DropdownChevronDown } from \"@vibe/icons\";\nimport DialogContentContainer from \"../DialogContentContainer/DialogContentContainer\";\nimport styles from \"./SplitButton.module.scss\";\nimport { DialogSize, DialogTriggerEvent } from \"../Dialog\";\nimport { ComponentVibeId } from \"../../tests/constants\";\n\nexport interface SplitButtonProps extends ButtonProps {\n /**\n * The element or renderer that is displayed inside the dialog opened by clicking the secondary button.\n */\n secondaryDialogContent?: ReactElement | (() => string | ReactElement);\n /**\n * Callback fired when the secondary dialog is shown.\n */\n onSecondaryDialogDidShow?: () => void;\n /**\n * Callback fired when the secondary dialog is hidden.\n */\n onSecondaryDialogDidHide?: () => void;\n /**\n * The z-index applied to the secondary dialog.\n */\n zIndex?: number;\n /**\n * Class name applied to the wrapper of the secondary dialog.\n */\n secondaryDialogClassName?: string;\n /**\n * The position of the secondary dialog.\n */\n secondaryDialogPosition?: SplitButtonSecondaryContentPositionType;\n /**\n * The padding size inside the secondary dialog.\n */\n dialogPaddingSize?: DialogSize;\n /**\n * The CSS selector of the container where the dialog should be rendered.\n */\n dialogContainerSelector?: string;\n /**\n * If true, clicking inside the dialog will close it.\n */\n shouldCloseOnClickInsideDialog?: boolean;\n}\n\nconst SplitButton = ({\n secondaryDialogContent,\n onSecondaryDialogDidShow = NOOP,\n onSecondaryDialogDidHide = NOOP,\n shouldCloseOnClickInsideDialog,\n zIndex = null,\n secondaryDialogClassName,\n secondaryDialogPosition = \"bottom-start\",\n dialogContainerSelector,\n dialogPaddingSize = \"medium\",\n disabled,\n // success mode not working right now, need to fix it in different pr\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n success,\n loading,\n kind,\n color,\n className,\n leftIcon,\n rightIcon,\n onClick,\n children,\n marginLeft,\n marginRight,\n active,\n id,\n \"data-testid\": dataTestId,\n ...buttonProps\n}: SplitButtonProps) => {\n // State //\n const [isDialogOpen, setDialogOpen] = useState(false);\n const [isHovered, setIsHover] = useState(false);\n const [isActive, setIsActive] = useState(false);\n\n // Refs //\n const ref = useRef(null);\n const secondaryButtonRef = useRef(null);\n\n // Callbacks //\n const setHovered = useCallback(() => setIsHover(true), [setIsHover]);\n const setNotHovered = useCallback(() => setIsHover(false), [setIsHover]);\n\n const shouldSetActive = useCallback(\n (e: React.KeyboardEvent<HTMLElement>) => {\n if (disabled) return false;\n return !isInsideClass(e.target as HTMLElement, SECONDARY_BUTTON_WRAPPER_CLASSNAME);\n },\n [disabled]\n );\n\n const setActive = useCallback(\n (e: React.KeyboardEvent<HTMLElement>) => {\n if (!shouldSetActive(e)) return;\n setIsActive(true);\n },\n [setIsActive, shouldSetActive]\n );\n const setNotActive = useCallback(() => setIsActive(false), [setIsActive]);\n const setActiveOnEnter = useCallback(\n (e: React.KeyboardEvent<HTMLElement>) => {\n if (!shouldSetActive(e)) return;\n setIsActive(true);\n },\n [setIsActive, shouldSetActive]\n );\n\n const showDialog = useCallback(() => {\n setDialogOpen(true);\n onSecondaryDialogDidShow();\n }, [setDialogOpen, onSecondaryDialogDidShow]);\n\n const hideDialog = useCallback(\n (_: DialogEvent, eventName: DialogTriggerEvent) => {\n setDialogOpen(false);\n onSecondaryDialogDidHide();\n if (eventName === \"esckey\") {\n secondaryButtonRef.current.focus();\n }\n },\n [setDialogOpen, onSecondaryDialogDidHide]\n );\n\n // Event listeners //\n\n // Used to set both buttons as hovered no matter what button was hovered\n useEventListener({ eventName: \"mouseenter\", callback: setHovered, ref });\n useEventListener({ eventName: \"mouseleave\", callback: setNotHovered, ref });\n\n useEventListener({ eventName: \"mousedown\", callback: setActive, ref });\n useEventListener({ eventName: \"mouseup\", callback: setNotActive, ref });\n\n // Used to finish active transition if clicked on enter\n useEventListener({ eventName: \"transitionend\", callback: setNotActive, ref });\n\n // Key events\n useKeyEvent({ keys: ENTER_KEYS, ref, callback: setActiveOnEnter });\n\n const classNames = useMemo(\n () =>\n cx(\n styles.button,\n getStyle(styles, camelCase(\"kind-\" + kind)),\n getStyle(styles, camelCase(\"color-\" + color)),\n {\n [styles.mainActive]: active,\n [styles.active]: isActive,\n [styles.splitContentOpen]: isDialogOpen,\n [styles.hovered]: isHovered,\n [styles.disabled]: disabled\n },\n className\n ),\n [className, kind, color, active, isActive, isDialogOpen, isHovered, disabled]\n );\n\n const dialogShowTrigger = useMemo(() => (disabled ? [] : DEFAULT_DIALOG_SHOW_TRIGGER), [disabled]);\n\n const dialogHideTrigger = useMemo(() => {\n if (shouldCloseOnClickInsideDialog) return [...DEFAULT_DIALOG_HIDE_TRIGGER, HideShowEvent.CONTENT_CLICK];\n return DEFAULT_DIALOG_HIDE_TRIGGER;\n }, [shouldCloseOnClickInsideDialog]);\n\n const actionsContent = useCallback(() => {\n const content = typeof secondaryDialogContent === \"function\" ? secondaryDialogContent() : secondaryDialogContent;\n return (\n <DialogContentContainer type={DialogContentContainer.types.POPOVER} size={dialogPaddingSize}>\n {content}\n </DialogContentContainer>\n );\n }, [secondaryDialogContent, dialogPaddingSize]);\n\n const animationEdgePosition = useMemo(() => {\n if (secondaryDialogPosition === \"bottom\") {\n return \"\";\n }\n if (secondaryDialogPosition === \"bottom-start\") {\n return \"bottom\";\n }\n\n return \"top\";\n }, [secondaryDialogPosition]);\n\n return (\n <div\n className={classNames}\n ref={ref}\n id={id}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.SPLIT_BUTTON, id)}\n data-vibe={ComponentVibeId.SPLIT_BUTTON}\n >\n <Button\n {\n ...buttonProps /* We are enriching button with other props so we must use spreading */\n }\n preventClickAnimation\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n rightFlat\n color={color}\n kind={kind}\n active={active}\n onClick={onClick}\n className={styles.mainButton}\n marginLeft={marginLeft}\n onFocus={setHovered}\n onBlur={setNotHovered}\n disabled={disabled}\n loading={loading}\n data-testid={getTestId(ComponentDefaultTestId.SPLIT_BUTTON_PRIMARY_BUTTON, id)}\n >\n {children}\n </Button>\n <div className={styles.secondaryButtonWrapper}>\n <Dialog\n wrapperClassName={secondaryDialogClassName}\n zIndex={zIndex}\n content={actionsContent}\n position={secondaryDialogPosition as DialogPosition}\n containerSelector={dialogContainerSelector}\n startingEdge={animationEdgePosition}\n animationType={AnimationType.EXPAND}\n moveBy={DIALOG_MOVE_BY}\n onDialogDidShow={showDialog}\n onDialogDidHide={hideDialog}\n showTrigger={dialogShowTrigger}\n hideTrigger={dialogHideTrigger}\n >\n <Button\n {...buttonProps}\n ref={secondaryButtonRef}\n preventClickAnimation\n leftFlat\n noSidePadding\n color={color}\n kind={kind}\n className={styles.secondaryButton}\n active={isDialogOpen}\n marginRight={marginRight}\n onFocus={setHovered}\n onBlur={setNotHovered}\n disabled={disabled}\n ariaLabel={SECONDARY_BUTTON_ARIA_LABEL}\n ariaHasPopup\n ariaExpanded={isDialogOpen}\n data-testid={getTestId(ComponentDefaultTestId.SPLIT_BUTTON_SECONDARY_BUTTON, id)}\n >\n <div className={styles.secondaryButtonIconWrapper}>\n <DropdownChevronDown aria-hidden=\"true\" />\n </div>\n </Button>\n </Dialog>\n </div>\n </div>\n );\n};\n\nSplitButton.defaultProps = {\n ...Button.defaultProps,\n onSecondaryDialogDidShow: NOOP,\n onSecondaryDialogDidHide: NOOP,\n zIndex: null,\n secondaryDialogClassName: \"\",\n secondaryDialogPosition: SplitButtonSecondaryContentPosition.BOTTOM_START,\n dialogPaddingSize: DialogContentContainer.sizes.MEDIUM\n};\n\ninterface SplitButtonStaticProps {\n secondaryPositions: typeof SplitButtonSecondaryContentPosition;\n secondaryDialogPositions: typeof SplitButtonSecondaryContentPosition;\n sizes: typeof Button.sizes;\n colors: typeof Button.colors;\n kinds: typeof Button.kinds;\n inputTags: typeof Button.inputTags;\n dialogPaddingSizes: typeof DialogContentContainer.sizes;\n}\n\nexport default withStaticProps<SplitButtonProps, SplitButtonStaticProps>(SplitButton, {\n secondaryPositions: SplitButtonSecondaryContentPosition,\n secondaryDialogPositions: SplitButtonSecondaryContentPosition,\n sizes: Button.sizes,\n colors: Button.colors,\n kinds: Button.kinds,\n inputTags: Button.inputTags,\n dialogPaddingSizes: DialogContentContainer.sizes\n});\n"],"names":["SplitButton","_a","secondaryDialogContent","_a$onSecondaryDialogD","onSecondaryDialogDidShow","NOOP","_a$onSecondaryDialogD2","onSecondaryDialogDidHide","shouldCloseOnClickInsideDialog","_a$zIndex","zIndex","secondaryDialogClassName","_a$secondaryDialogPos","secondaryDialogPosition","dialogContainerSelector","_a$dialogPaddingSize","dialogPaddingSize","disabled","loading","kind","color","className","leftIcon","rightIcon","onClick","children","marginLeft","marginRight","active","id","dataTestId","buttonProps","__rest","_useState","useState","_useState2","_slicedToArray","isDialogOpen","setDialogOpen","_useState3","_useState4","isHovered","setIsHover","_useState5","_useState6","isActive","setIsActive","ref","useRef","secondaryButtonRef","setHovered","useCallback","setNotHovered","shouldSetActive","e","isInsideClass","target","SECONDARY_BUTTON_WRAPPER_CLASSNAME","setActive","setNotActive","setActiveOnEnter","showDialog","hideDialog","_","eventName","current","focus","useEventListener","callback","useKeyEvent","keys","ENTER_KEYS","classNames","useMemo","cx","styles","button","getStyle","camelCase","_defineProperty","mainActive","splitContentOpen","hovered","dialogShowTrigger","DEFAULT_DIALOG_SHOW_TRIGGER","dialogHideTrigger","concat","_toConsumableArray","DEFAULT_DIALOG_HIDE_TRIGGER","HideShowEvent","CONTENT_CLICK","actionsContent","content","React","createElement","DialogContentContainer","type","types","POPOVER","size","animationEdgePosition","getTestId","ComponentDefaultTestId","SPLIT_BUTTON","ComponentVibeId","Button","Object","assign","preventClickAnimation","rightFlat","mainButton","onFocus","onBlur","SPLIT_BUTTON_PRIMARY_BUTTON","secondaryButtonWrapper","Dialog","wrapperClassName","position","containerSelector","startingEdge","animationType","AnimationType","EXPAND","moveBy","DIALOG_MOVE_BY","onDialogDidShow","onDialogDidHide","showTrigger","hideTrigger","leftFlat","noSidePadding","secondaryButton","ariaLabel","SECONDARY_BUTTON_ARIA_LABEL","ariaHasPopup","ariaExpanded","SPLIT_BUTTON_SECONDARY_BUTTON","secondaryButtonIconWrapper","DropdownChevronDown","defaultProps","SplitButtonSecondaryContentPosition","BOTTOM_START","sizes","MEDIUM","withStaticProps","secondaryPositions","secondaryDialogPositions","colors","kinds","inputTags","dialogPaddingSizes"],"mappings":"44CA0EA,IAAMA,EAAc,SAACC,GAAA,IACnBC,EA2BiBD,EA3BjBC,uBAAsBC,EA2BLF,EA1BjBG,yBAAAA,OAA2BC,IAAHF,EAAGE,EAAIF,EAAAG,EA0BdL,EAzBjBM,yBAAAA,OAA2BF,IAAHC,EAAGD,EAAIC,EAC/BE,EAwBiBP,EAxBjBO,+BAA8BC,EAwBbR,EAvBjBS,OAAAA,OAAS,IAAHD,EAAG,KAAIA,EACbE,EAsBiBV,EAtBjBU,yBAAwBC,EAsBPX,EArBjBY,wBAAAA,OAA0B,IAAHD,EAAG,eAAcA,EACxCE,EAoBiBb,EApBjBa,wBAAuBC,EAoBNd,EAnBjBe,kBAAAA,OAAoB,IAAHD,EAAG,SAAQA,EAC5BE,EAkBiBhB,EAlBjBgB,SAIAC,EAciBjB,EAdjBiB,QACAC,EAaiBlB,EAbjBkB,KACAC,EAYiBnB,EAZjBmB,MACAC,EAWiBpB,EAXjBoB,UACAC,EAUiBrB,EAVjBq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AC7D7H,kBAAmB+E,EAAuB+C,MAAMC,SAalD,IAAeC,EAAAA,EAA0DhJ,EAAa,CACpFiJ,mBAAoBL,EACpBM,yBAA0BN,EAC1BE,MAAOrC,EAAOqC,MACdK,OAAQ1C,EAAO0C,OACfC,MAAO3C,EAAO2C,MACdC,UAAW5C,EAAO4C,UAClBC,mBAAoBvD,EAAuB+C"}
|
|
1
|
+
{"version":3,"file":"SplitButton.js","sources":["../../../../../src/components/SplitButton/SplitButton.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\nimport { camelCase } from \"lodash-es\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport cx from \"classnames\";\n// Libraries import\nimport React, { ReactElement, useCallback, useMemo, useRef, useState } from \"react\";\n// Constants import\nimport {\n DEFAULT_DIALOG_HIDE_TRIGGER,\n DEFAULT_DIALOG_SHOW_TRIGGER,\n DIALOG_MOVE_BY,\n ENTER_KEYS,\n SECONDARY_BUTTON_ARIA_LABEL,\n SECONDARY_BUTTON_WRAPPER_CLASSNAME,\n SplitButtonSecondaryContentPosition,\n SplitButtonSecondaryContentPositionType\n} from \"./SplitButtonConstants\";\nimport { withStaticPropsWithoutForwardRef } from \"../../types\";\nimport { AnimationType, DialogPosition, HideShowEvent } from \"../Dialog/DialogConstants\";\n// Utils import\nimport { NOOP } from \"../../utils/function-utils\";\nimport { isInsideClass } from \"../../utils/dom-utils\";\n// Hooks import\nimport useKeyEvent from \"../../hooks/useKeyEvent\";\nimport useEventListener from \"../../hooks/useEventListener\";\n// Components import\nimport Button, { ButtonProps } from \"../Button/Button\";\nimport Dialog, { DialogEvent } from \"../Dialog/Dialog\";\nimport { DropdownChevronDown } from \"@vibe/icons\";\nimport DialogContentContainer from \"../DialogContentContainer/DialogContentContainer\";\nimport styles from \"./SplitButton.module.scss\";\nimport { DialogSize, DialogTriggerEvent } from \"../Dialog\";\nimport { ComponentVibeId } from \"../../tests/constants\";\n\nexport interface SplitButtonProps extends ButtonProps {\n /**\n * The element or renderer that is displayed inside the dialog opened by clicking the secondary button.\n */\n secondaryDialogContent?: ReactElement | (() => string | ReactElement);\n /**\n * Callback fired when the secondary dialog is shown.\n */\n onSecondaryDialogDidShow?: () => void;\n /**\n * Callback fired when the secondary dialog is hidden.\n */\n onSecondaryDialogDidHide?: () => void;\n /**\n * The z-index applied to the secondary dialog.\n */\n zIndex?: number;\n /**\n * Class name applied to the wrapper of the secondary dialog.\n */\n secondaryDialogClassName?: string;\n /**\n * The position of the secondary dialog.\n */\n secondaryDialogPosition?: SplitButtonSecondaryContentPositionType;\n /**\n * The padding size inside the secondary dialog.\n */\n dialogPaddingSize?: DialogSize;\n /**\n * The CSS selector of the container where the dialog should be rendered.\n */\n dialogContainerSelector?: string;\n /**\n * If true, clicking inside the dialog will close it.\n */\n shouldCloseOnClickInsideDialog?: boolean;\n}\n\nconst SplitButton = ({\n secondaryDialogContent,\n onSecondaryDialogDidShow = NOOP,\n onSecondaryDialogDidHide = NOOP,\n shouldCloseOnClickInsideDialog,\n zIndex = null,\n secondaryDialogClassName,\n secondaryDialogPosition = \"bottom-start\",\n dialogContainerSelector,\n dialogPaddingSize = \"medium\",\n disabled,\n // success mode not working right now, need to fix it in different pr\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n success,\n loading,\n kind,\n color,\n className,\n leftIcon,\n rightIcon,\n onClick,\n children,\n marginLeft,\n marginRight,\n active,\n id,\n \"data-testid\": dataTestId,\n ...buttonProps\n}: SplitButtonProps) => {\n // State //\n const [isDialogOpen, setDialogOpen] = useState(false);\n const [isHovered, setIsHover] = useState(false);\n const [isActive, setIsActive] = useState(false);\n\n // Refs //\n const ref = useRef(null);\n const secondaryButtonRef = useRef(null);\n\n // Callbacks //\n const setHovered = useCallback(() => setIsHover(true), [setIsHover]);\n const setNotHovered = useCallback(() => setIsHover(false), [setIsHover]);\n\n const shouldSetActive = useCallback(\n (e: React.KeyboardEvent<HTMLElement>) => {\n if (disabled) return false;\n return !isInsideClass(e.target as HTMLElement, SECONDARY_BUTTON_WRAPPER_CLASSNAME);\n },\n [disabled]\n );\n\n const setActive = useCallback(\n (e: React.KeyboardEvent<HTMLElement>) => {\n if (!shouldSetActive(e)) return;\n setIsActive(true);\n },\n [setIsActive, shouldSetActive]\n );\n const setNotActive = useCallback(() => setIsActive(false), [setIsActive]);\n const setActiveOnEnter = useCallback(\n (e: React.KeyboardEvent<HTMLElement>) => {\n if (!shouldSetActive(e)) return;\n setIsActive(true);\n },\n [setIsActive, shouldSetActive]\n );\n\n const showDialog = useCallback(() => {\n setDialogOpen(true);\n onSecondaryDialogDidShow();\n }, [setDialogOpen, onSecondaryDialogDidShow]);\n\n const hideDialog = useCallback(\n (_: DialogEvent, eventName: DialogTriggerEvent) => {\n setDialogOpen(false);\n onSecondaryDialogDidHide();\n if (eventName === \"esckey\") {\n secondaryButtonRef.current.focus();\n }\n },\n [setDialogOpen, onSecondaryDialogDidHide]\n );\n\n // Event listeners //\n\n // Used to set both buttons as hovered no matter what button was hovered\n useEventListener({ eventName: \"mouseenter\", callback: setHovered, ref });\n useEventListener({ eventName: \"mouseleave\", callback: setNotHovered, ref });\n\n useEventListener({ eventName: \"mousedown\", callback: setActive, ref });\n useEventListener({ eventName: \"mouseup\", callback: setNotActive, ref });\n\n // Used to finish active transition if clicked on enter\n useEventListener({ eventName: \"transitionend\", callback: setNotActive, ref });\n\n // Key events\n useKeyEvent({ keys: ENTER_KEYS, ref, callback: setActiveOnEnter });\n\n const classNames = useMemo(\n () =>\n cx(\n styles.button,\n getStyle(styles, camelCase(\"kind-\" + kind)),\n getStyle(styles, camelCase(\"color-\" + color)),\n {\n [styles.mainActive]: active,\n [styles.active]: isActive,\n [styles.splitContentOpen]: isDialogOpen,\n [styles.hovered]: isHovered,\n [styles.disabled]: disabled\n },\n className\n ),\n [className, kind, color, active, isActive, isDialogOpen, isHovered, disabled]\n );\n\n const dialogShowTrigger = useMemo(() => (disabled ? [] : DEFAULT_DIALOG_SHOW_TRIGGER), [disabled]);\n\n const dialogHideTrigger = useMemo(() => {\n if (shouldCloseOnClickInsideDialog) return [...DEFAULT_DIALOG_HIDE_TRIGGER, HideShowEvent.CONTENT_CLICK];\n return DEFAULT_DIALOG_HIDE_TRIGGER;\n }, [shouldCloseOnClickInsideDialog]);\n\n const actionsContent = useCallback(() => {\n const content = typeof secondaryDialogContent === \"function\" ? secondaryDialogContent() : secondaryDialogContent;\n return (\n <DialogContentContainer type={DialogContentContainer.types.POPOVER} size={dialogPaddingSize}>\n {content}\n </DialogContentContainer>\n );\n }, [secondaryDialogContent, dialogPaddingSize]);\n\n const animationEdgePosition = useMemo(() => {\n if (secondaryDialogPosition === \"bottom\") {\n return \"\";\n }\n if (secondaryDialogPosition === \"bottom-start\") {\n return \"bottom\";\n }\n\n return \"top\";\n }, [secondaryDialogPosition]);\n\n return (\n <div\n className={classNames}\n ref={ref}\n id={id}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.SPLIT_BUTTON, id)}\n data-vibe={ComponentVibeId.SPLIT_BUTTON}\n >\n <Button\n {\n ...buttonProps /* We are enriching button with other props so we must use spreading */\n }\n preventClickAnimation\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n rightFlat\n color={color}\n kind={kind}\n active={active}\n onClick={onClick}\n className={styles.mainButton}\n marginLeft={marginLeft}\n onFocus={setHovered}\n onBlur={setNotHovered}\n disabled={disabled}\n loading={loading}\n data-testid={getTestId(ComponentDefaultTestId.SPLIT_BUTTON_PRIMARY_BUTTON, id)}\n >\n {children}\n </Button>\n <div className={styles.secondaryButtonWrapper}>\n <Dialog\n wrapperClassName={secondaryDialogClassName}\n zIndex={zIndex}\n content={actionsContent}\n position={secondaryDialogPosition as DialogPosition}\n containerSelector={dialogContainerSelector}\n startingEdge={animationEdgePosition}\n animationType={AnimationType.EXPAND}\n moveBy={DIALOG_MOVE_BY}\n onDialogDidShow={showDialog}\n onDialogDidHide={hideDialog}\n showTrigger={dialogShowTrigger}\n hideTrigger={dialogHideTrigger}\n >\n <Button\n {...buttonProps}\n ref={secondaryButtonRef}\n preventClickAnimation\n leftFlat\n noSidePadding\n color={color}\n kind={kind}\n className={styles.secondaryButton}\n active={isDialogOpen}\n marginRight={marginRight}\n onFocus={setHovered}\n onBlur={setNotHovered}\n disabled={disabled}\n ariaLabel={SECONDARY_BUTTON_ARIA_LABEL}\n ariaHasPopup\n ariaExpanded={isDialogOpen}\n data-testid={getTestId(ComponentDefaultTestId.SPLIT_BUTTON_SECONDARY_BUTTON, id)}\n >\n <div className={styles.secondaryButtonIconWrapper}>\n <DropdownChevronDown aria-hidden=\"true\" />\n </div>\n </Button>\n </Dialog>\n </div>\n </div>\n );\n};\n\nSplitButton.defaultProps = {\n ...Button.defaultProps,\n onSecondaryDialogDidShow: NOOP,\n onSecondaryDialogDidHide: NOOP,\n zIndex: null,\n secondaryDialogClassName: \"\",\n secondaryDialogPosition: SplitButtonSecondaryContentPosition.BOTTOM_START,\n dialogPaddingSize: DialogContentContainer.sizes.MEDIUM\n};\n\ninterface SplitButtonStaticProps {\n secondaryPositions: typeof SplitButtonSecondaryContentPosition;\n secondaryDialogPositions: typeof SplitButtonSecondaryContentPosition;\n sizes: typeof Button.sizes;\n colors: typeof Button.colors;\n kinds: typeof Button.kinds;\n inputTags: typeof Button.inputTags;\n dialogPaddingSizes: typeof DialogContentContainer.sizes;\n}\n\nexport default withStaticPropsWithoutForwardRef<SplitButtonProps, SplitButtonStaticProps>(SplitButton, {\n secondaryPositions: SplitButtonSecondaryContentPosition,\n secondaryDialogPositions: SplitButtonSecondaryContentPosition,\n sizes: Button.sizes,\n colors: Button.colors,\n kinds: Button.kinds,\n inputTags: Button.inputTags,\n dialogPaddingSizes: DialogContentContainer.sizes\n});\n"],"names":["SplitButton","_a","secondaryDialogContent","_a$onSecondaryDialogD","onSecondaryDialogDidShow","NOOP","_a$onSecondaryDialogD2","onSecondaryDialogDidHide","shouldCloseOnClickInsideDialog","_a$zIndex","zIndex","secondaryDialogClassName","_a$secondaryDialogPos","secondaryDialogPosition","dialogContainerSelector","_a$dialogPaddingSize","dialogPaddingSize","disabled","loading","kind","color","className","leftIcon","rightIcon","onClick","children","marginLeft","marginRight","active","id","dataTestId","buttonProps","__rest","_useState","useState","_useState2","_slicedToArray","isDialogOpen","setDialogOpen","_useState3","_useState4","isHovered","setIsHover","_useState5","_useState6","isActive","setIsActive","ref","useRef","secondaryButtonRef","setHovered","useCallback","setNotHovered","shouldSetActive","e","isInsideClass","target","SECONDARY_BUTTON_WRAPPER_CLASSNAME","setActive","setNotActive","setActiveOnEnter","showDialog","hideDialog","_","eventName","current","focus","useEventListener","callback","useKeyEvent","keys","ENTER_KEYS","classNames","useMemo","cx","styles","button","getStyle","camelCase","_defineProperty","mainActive","splitContentOpen","hovered","dialogShowTrigger","DEFAULT_DIALOG_SHOW_TRIGGER","dialogHideTrigger","concat","_toConsumableArray","DEFAULT_DIALOG_HIDE_TRIGGER","HideShowEvent","CONTENT_CLICK","actionsContent","content","React","createElement","DialogContentContainer","type","types","POPOVER","size","animationEdgePosition","getTestId","ComponentDefaultTestId","SPLIT_BUTTON","ComponentVibeId","Button","Object","assign","preventClickAnimation","rightFlat","mainButton","onFocus","onBlur","SPLIT_BUTTON_PRIMARY_BUTTON","secondaryButtonWrapper","Dialog","wrapperClassName","position","containerSelector","startingEdge","animationType","AnimationType","EXPAND","moveBy","DIALOG_MOVE_BY","onDialogDidShow","onDialogDidHide","showTrigger","hideTrigger","leftFlat","noSidePadding","secondaryButton","ariaLabel","SECONDARY_BUTTON_ARIA_LABEL","ariaHasPopup","ariaExpanded","SPLIT_BUTTON_SECONDARY_BUTTON","secondaryButtonIconWrapper","DropdownChevronDown","defaultProps","SplitButtonSecondaryContentPosition","BOTTOM_START","sizes","MEDIUM","withStaticPropsWithoutForwardRef","secondaryPositions","secondaryDialogPositions","colors","kinds","inputTags","dialogPaddingSizes"],"mappings":"65CA0EA,IAAMA,EAAc,SAAC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,EAAMC,OAAAC,OAAA,CAAA,EACD5E,GAAW,CACfgB,IAAKE,GACL2D,uBAAqB,EACrBqB,UAAQ,EACRC,eACA,EAAA9G,MAAOA,EACPD,KAAMA,EACNE,UAAWsD,EAAOwD,gBAClBvG,OAAQS,GACRV,YAAaA,GACboF,QAAS7D,GACT8D,OAAQ5D,GACRnC,SAAUA,EACVmH,UAAWC,EACXC,cACA,EAAAC,aAAclG,GAAY,cACbgE,EAAUC,EAAuBkC,8BAA+B3G,MAE7EgE,EAAAC,cAAA,MAAA,CAAKzE,UAAWsD,EAAO8D,4BACrB5C,EAACC,cAAA4C,EAAgC,CAAA,cAAA,aAO/C,EAEA1I,EAAY2I,aAAYjC,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EACnBF,EAAOkC,cACV,CAAAvI,yBAA0BC,EAC1BE,yBAA0BF,EAC1BK,OAAQ,KACRC,yBAA0B,GAC1BE,wBAAyB+H,EAAoCC,aAC7D7H,kBAAmB+E,EAAuB+C,MAAMC,SAalD,IAAeC,EAAAA,EAA2EhJ,EAAa,CACrGiJ,mBAAoBL,EACpBM,yBAA0BN,EAC1BE,MAAOrC,EAAOqC,MACdK,OAAQ1C,EAAO0C,OACfC,MAAO3C,EAAO2C,MACdC,UAAW5C,EAAO4C,UAClBC,mBAAoBvD,EAAuB+C"}
|
package/dist/mocked_classnames/src/components/Table/TableContainer/TableContainer.module.scss.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={tableContainer:"tableContainer",menuContainer:"menuContainer"};!function(e){const n="s_id-
|
|
1
|
+
var e={tableContainer:"tableContainer",menuContainer:"menuContainer"};!function(e){const n="s_id-c61f3446ce1a_3_50_0";if("undefined"!=typeof document){const t=document.head||document.getElementsByTagName("head")[0];if(t.querySelector("#"+n))return;const i=document.createElement("style");i.id=n,t.firstChild?t.insertBefore(i,t.firstChild):t.appendChild(i),i.appendChild(document.createTextNode(e))}else globalThis.injectedStyles&&(globalThis.injectedStyles[n]=e)}(".tableContainer {\n width: 100%;\n height: 100%;\n position: relative;\n}\n.tableContainer .menuContainer {\n --cell-width: 40px;\n position: absolute;\n overflow: hidden;\n left: calc(1px - var(--cell-width));\n width: var(--cell-width);\n height: 100%;\n}");export{e as default};
|
|
2
2
|
//# sourceMappingURL=TableContainer.module.scss.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{forwardRef as t,useCallback as n}from"react";import o from"classnames";import{getTestId as r}from"../../../tests/testIds.js";import{ComponentDefaultTestId as u}from"../../../tests/constants.js";import s from"./TableRowMenu.module.scss.js";import m from"../../MenuButton/MenuButton.js";import i from"../../Menu/Menu/Menu.js";import"../../Menu/MenuItem/MenuItem.js";import"../../Menu/MenuItemButton/MenuItemButton.js";import"../../Menu/MenuDivider/MenuDivider.js";import"../../Menu/MenuTitle/MenuTitle.js";import"../../Menu/MenuGridItem/MenuGridItem.js";import{createPortal as a}from"react-dom";import{useTable as M}from"../context/TableContext/TableContext.js";import{getStyle as l}from"../../../helpers/typesciptCssModulesHelper.js";import{useTableRowMenu as d}from"../context/TableRowMenuContext/TableRowMenuContext.js";import{useTableContainer as p}from"../context/TableContainerContext/TableContainerContext.js";var c=t((function(t,c){var f=t.rowId,j=t.className,T=t.id,
|
|
1
|
+
import e,{forwardRef as t,useCallback as n}from"react";import o from"classnames";import{getTestId as r}from"../../../tests/testIds.js";import{ComponentDefaultTestId as u}from"../../../tests/constants.js";import s from"./TableRowMenu.module.scss.js";import m from"../../MenuButton/MenuButton.js";import i from"../../Menu/Menu/Menu.js";import"../../Menu/MenuItem/MenuItem.js";import"../../Menu/MenuItemButton/MenuItemButton.js";import"../../Menu/MenuDivider/MenuDivider.js";import"../../Menu/MenuTitle/MenuTitle.js";import"../../Menu/MenuGridItem/MenuGridItem.js";import{createPortal as a}from"react-dom";import{useTable as M}from"../context/TableContext/TableContext.js";import{getStyle as l}from"../../../helpers/typesciptCssModulesHelper.js";import{useTableRowMenu as d}from"../context/TableRowMenuContext/TableRowMenuContext.js";import{useTableContainer as p}from"../context/TableContainerContext/TableContainerContext.js";var c=t((function(t,c){var f=t.rowId,j=t.className,T=t.id,x=t["data-testid"],C=t.children,b=p().menuContainerRef,w=M().size,v=d(),I=v.hoveredRowId,R=v.setTableMenuHidden,E=v.setTableMenuShown,B=v.menuButtonPosition,h=v.onMouseOverRowMenu,N=v.onMouseLeaveRowMenu,H=n((function(){R()}),[R]),L=n((function(){E()}),[E]);return b.current&&I&&I===f?e.createElement(e.Fragment,null,a(e.createElement("div",{className:o(s.rowMenuContainer,l(s,w)),style:{top:B},onMouseEnter:h,onMouseLeave:N},e.createElement(m,{id:T,ref:c,className:o(s.tableMenu,j),size:"xs",onMenuHide:H,onMenuShow:L,"data-testid":x||r(u.TABLE_ROW_MENU,T)},e.createElement(i,null,C))),b.current)):null}));export{c as default};
|
|
2
2
|
//# sourceMappingURL=TableRowMenu.js.map
|