@veeqo/ui 14.7.0 → 14.7.1-beta-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/AnimatedDropdown/AnimatedDropdown.cjs +22 -5
- package/dist/components/AnimatedDropdown/AnimatedDropdown.cjs.map +1 -1
- package/dist/components/AnimatedDropdown/AnimatedDropdown.js +22 -5
- package/dist/components/AnimatedDropdown/AnimatedDropdown.js.map +1 -1
- package/dist/components/AnimatedDropdown/AnimatedDropdown.module.scss.cjs +9 -0
- package/dist/components/AnimatedDropdown/AnimatedDropdown.module.scss.cjs.map +1 -0
- package/dist/components/AnimatedDropdown/AnimatedDropdown.module.scss.js +7 -0
- package/dist/components/AnimatedDropdown/AnimatedDropdown.module.scss.js.map +1 -0
- package/dist/components/AnimatedDropdown/components/BasicDropdown.cjs +5 -3
- package/dist/components/AnimatedDropdown/components/BasicDropdown.cjs.map +1 -1
- package/dist/components/AnimatedDropdown/components/BasicDropdown.js +5 -3
- package/dist/components/AnimatedDropdown/components/BasicDropdown.js.map +1 -1
- package/dist/components/AnimatedDropdown/components/BasicDropdown.module.scss.cjs +9 -0
- package/dist/components/AnimatedDropdown/components/BasicDropdown.module.scss.cjs.map +1 -0
- package/dist/components/AnimatedDropdown/components/BasicDropdown.module.scss.js +7 -0
- package/dist/components/AnimatedDropdown/components/BasicDropdown.module.scss.js.map +1 -0
- package/dist/components/Button/Button.cjs +30 -16
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.d.ts +8 -0
- package/dist/components/Button/Button.js +30 -16
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.module.scss.cjs +9 -0
- package/dist/components/Button/Button.module.scss.cjs.map +1 -0
- package/dist/components/Button/Button.module.scss.js +7 -0
- package/dist/components/Button/Button.module.scss.js.map +1 -0
- package/dist/components/Button/types.d.ts +9 -1
- package/dist/components/Choice/Choice.cjs +2 -1
- package/dist/components/Choice/Choice.cjs.map +1 -1
- package/dist/components/Choice/Choice.js +2 -1
- package/dist/components/Choice/Choice.js.map +1 -1
- package/dist/components/Choice/components/BlockTooltip.cjs +16 -0
- package/dist/components/Choice/components/BlockTooltip.cjs.map +1 -0
- package/dist/components/Choice/components/BlockTooltip.d.ts +3 -0
- package/dist/components/Choice/components/BlockTooltip.js +10 -0
- package/dist/components/Choice/components/BlockTooltip.js.map +1 -0
- package/dist/components/Choice/components/BlockTooltip.module.scss.cjs +9 -0
- package/dist/components/Choice/components/BlockTooltip.module.scss.cjs.map +1 -0
- package/dist/components/Choice/components/BlockTooltip.module.scss.js +7 -0
- package/dist/components/Choice/components/BlockTooltip.module.scss.js.map +1 -0
- package/dist/components/Choice/components/styled.cjs +0 -3
- package/dist/components/Choice/components/styled.cjs.map +1 -1
- package/dist/components/Choice/components/styled.d.ts +0 -1
- package/dist/components/Choice/components/styled.js +1 -3
- package/dist/components/Choice/components/styled.js.map +1 -1
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.cjs +3 -0
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.cjs.map +1 -1
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.js +3 -0
- package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.js.map +1 -1
- package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBodyCell.cjs +3 -0
- package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBodyCell.cjs.map +1 -1
- package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBodyCell.js +3 -0
- package/dist/components/DataGrid/components/Body/LoadingBody/LoadingBodyCell.js.map +1 -1
- package/dist/components/DataGrid/components/GridContainer/GridContainer.cjs +3 -0
- package/dist/components/DataGrid/components/GridContainer/GridContainer.cjs.map +1 -1
- package/dist/components/DataGrid/components/GridContainer/GridContainer.js +3 -0
- package/dist/components/DataGrid/components/GridContainer/GridContainer.js.map +1 -1
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.cjs +3 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.cjs.map +1 -1
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.js +3 -0
- package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.js.map +1 -1
- package/dist/components/Dropdown/Dropdown.module.scss.cjs +9 -0
- package/dist/components/Dropdown/Dropdown.module.scss.cjs.map +1 -0
- package/dist/components/Dropdown/Dropdown.module.scss.js +7 -0
- package/dist/components/Dropdown/Dropdown.module.scss.js.map +1 -0
- package/dist/components/Dropdown/DropdownPopover.cjs +4 -2
- package/dist/components/Dropdown/DropdownPopover.cjs.map +1 -1
- package/dist/components/Dropdown/DropdownPopover.js +5 -3
- package/dist/components/Dropdown/DropdownPopover.js.map +1 -1
- package/dist/components/FilterTag/styled.cjs +2 -1
- package/dist/components/FilterTag/styled.cjs.map +1 -1
- package/dist/components/FilterTag/styled.js +2 -1
- package/dist/components/FilterTag/styled.js.map +1 -1
- package/dist/components/Image/Image.cjs +16 -5
- package/dist/components/Image/Image.cjs.map +1 -1
- package/dist/components/Image/Image.js +16 -5
- package/dist/components/Image/Image.js.map +1 -1
- package/dist/components/Image/Image.module.scss.cjs +9 -0
- package/dist/components/Image/Image.module.scss.cjs.map +1 -0
- package/dist/components/Image/Image.module.scss.js +7 -0
- package/dist/components/Image/Image.module.scss.js.map +1 -0
- package/dist/components/Modal/Modal.cjs +28 -3
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.js +28 -3
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/Modal.module.scss.cjs +9 -0
- package/dist/components/Modal/Modal.module.scss.cjs.map +1 -0
- package/dist/components/Modal/Modal.module.scss.js +7 -0
- package/dist/components/Modal/Modal.module.scss.js.map +1 -0
- package/dist/components/Modal/components/Dialog/Dialog.cjs +35 -2
- package/dist/components/Modal/components/Dialog/Dialog.cjs.map +1 -1
- package/dist/components/Modal/components/Dialog/Dialog.d.ts +13 -5
- package/dist/components/Modal/components/Dialog/Dialog.js +35 -2
- package/dist/components/Modal/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Pagination/styled.d.ts +4 -0
- package/dist/components/Popover/Popover.cjs +7 -4
- package/dist/components/Popover/Popover.cjs.map +1 -1
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/components/Popover/Popover.js +7 -4
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/Popover/Popover.module.scss.cjs +9 -0
- package/dist/components/Popover/Popover.module.scss.cjs.map +1 -0
- package/dist/components/Popover/Popover.module.scss.js +7 -0
- package/dist/components/Popover/Popover.module.scss.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.cjs +16 -12
- package/dist/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +16 -12
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.module.scss.cjs +9 -0
- package/dist/components/Tooltip/Tooltip.module.scss.cjs.map +1 -0
- package/dist/components/Tooltip/Tooltip.module.scss.js +7 -0
- package/dist/components/Tooltip/Tooltip.module.scss.js.map +1 -0
- package/dist/components/Tooltip/components/TooltipPopover.cjs +13 -10
- package/dist/components/Tooltip/components/TooltipPopover.cjs.map +1 -1
- package/dist/components/Tooltip/components/TooltipPopover.d.ts +1 -1
- package/dist/components/Tooltip/components/TooltipPopover.js +13 -10
- package/dist/components/Tooltip/components/TooltipPopover.js.map +1 -1
- package/dist/components/Tooltip/components/types.d.ts +7 -12
- package/dist/components/Tooltip/types.cjs.map +1 -1
- package/dist/components/Tooltip/types.d.ts +3 -1
- package/dist/components/Tooltip/types.js.map +1 -1
- package/dist/components/VideoModal/styled.d.ts +4 -0
- package/dist/hoc/withLabels/BlockTooltip.cjs +16 -0
- package/dist/hoc/withLabels/BlockTooltip.cjs.map +1 -0
- package/dist/hoc/withLabels/BlockTooltip.d.ts +3 -0
- package/dist/hoc/withLabels/BlockTooltip.js +10 -0
- package/dist/hoc/withLabels/BlockTooltip.js.map +1 -0
- package/dist/hoc/withLabels/BlockTooltip.module.scss.cjs +9 -0
- package/dist/hoc/withLabels/BlockTooltip.module.scss.cjs.map +1 -0
- package/dist/hoc/withLabels/BlockTooltip.module.scss.js +7 -0
- package/dist/hoc/withLabels/BlockTooltip.module.scss.js.map +1 -0
- package/dist/hoc/withLabels/withLabels.cjs +2 -2
- package/dist/hoc/withLabels/withLabels.cjs.map +1 -1
- package/dist/hoc/withLabels/withLabels.js +1 -1
- package/dist/hoc/withLabels/withLabels.js.map +1 -1
- package/dist/theme/index.js +1 -1
- package/package.json +1 -1
- package/dist/components/AnimatedDropdown/components/styled.cjs +0 -13
- package/dist/components/AnimatedDropdown/components/styled.cjs.map +0 -1
- package/dist/components/AnimatedDropdown/components/styled.d.ts +0 -2
- package/dist/components/AnimatedDropdown/components/styled.js +0 -7
- package/dist/components/AnimatedDropdown/components/styled.js.map +0 -1
- package/dist/components/AnimatedDropdown/styled.cjs +0 -19
- package/dist/components/AnimatedDropdown/styled.cjs.map +0 -1
- package/dist/components/AnimatedDropdown/styled.d.ts +0 -11
- package/dist/components/AnimatedDropdown/styled.js +0 -11
- package/dist/components/AnimatedDropdown/styled.js.map +0 -1
- package/dist/components/Button/components/styled.cjs +0 -72
- package/dist/components/Button/components/styled.cjs.map +0 -1
- package/dist/components/Button/components/styled.d.ts +0 -20
- package/dist/components/Button/components/styled.js +0 -58
- package/dist/components/Button/components/styled.js.map +0 -1
- package/dist/components/Dropdown/styled.cjs +0 -15
- package/dist/components/Dropdown/styled.cjs.map +0 -1
- package/dist/components/Dropdown/styled.d.ts +0 -11
- package/dist/components/Dropdown/styled.js +0 -9
- package/dist/components/Dropdown/styled.js.map +0 -1
- package/dist/components/Image/components/styled.cjs +0 -18
- package/dist/components/Image/components/styled.cjs.map +0 -1
- package/dist/components/Image/components/styled.d.ts +0 -6
- package/dist/components/Image/components/styled.js +0 -9
- package/dist/components/Image/components/styled.js.map +0 -1
- package/dist/components/Modal/components/Dialog/constants.cjs +0 -53
- package/dist/components/Modal/components/Dialog/constants.cjs.map +0 -1
- package/dist/components/Modal/components/Dialog/constants.d.ts +0 -44
- package/dist/components/Modal/components/Dialog/constants.js +0 -49
- package/dist/components/Modal/components/Dialog/constants.js.map +0 -1
- package/dist/components/Modal/components/Dialog/styled.cjs +0 -47
- package/dist/components/Modal/components/Dialog/styled.cjs.map +0 -1
- package/dist/components/Modal/components/Dialog/styled.d.ts +0 -6
- package/dist/components/Modal/components/Dialog/styled.js +0 -41
- package/dist/components/Modal/components/Dialog/styled.js.map +0 -1
- package/dist/components/Modal/components/Dialog/styles/baseStyles.cjs +0 -13
- package/dist/components/Modal/components/Dialog/styles/baseStyles.cjs.map +0 -1
- package/dist/components/Modal/components/Dialog/styles/baseStyles.d.ts +0 -4
- package/dist/components/Modal/components/Dialog/styles/baseStyles.js +0 -11
- package/dist/components/Modal/components/Dialog/styles/baseStyles.js.map +0 -1
- package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.cjs +0 -17
- package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.cjs.map +0 -1
- package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.d.ts +0 -6
- package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.js +0 -13
- package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.js.map +0 -1
- package/dist/components/Modal/components/styled.cjs +0 -21
- package/dist/components/Modal/components/styled.cjs.map +0 -1
- package/dist/components/Modal/components/styled.d.ts +0 -5
- package/dist/components/Modal/components/styled.js +0 -14
- package/dist/components/Modal/components/styled.js.map +0 -1
- package/dist/components/Popover/styled.cjs +0 -14
- package/dist/components/Popover/styled.cjs.map +0 -1
- package/dist/components/Popover/styled.d.ts +0 -5
- package/dist/components/Popover/styled.js +0 -7
- package/dist/components/Popover/styled.js.map +0 -1
- package/dist/components/Tooltip/components/styled.cjs +0 -25
- package/dist/components/Tooltip/components/styled.cjs.map +0 -1
- package/dist/components/Tooltip/components/styled.d.ts +0 -19
- package/dist/components/Tooltip/components/styled.js +0 -16
- package/dist/components/Tooltip/components/styled.js.map +0 -1
- package/dist/hoc/withLabels/styled.cjs +0 -17
- package/dist/hoc/withLabels/styled.cjs.map +0 -1
- package/dist/hoc/withLabels/styled.d.ts +0 -1
- package/dist/hoc/withLabels/styled.js +0 -11
- package/dist/hoc/withLabels/styled.js.map +0 -1
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
import React__default, { useRef, useState, useEffect } from 'react';
|
|
2
2
|
import { AnimatePresence } from 'framer-motion';
|
|
3
|
-
import { NonScrollableBody, MainSection } from './components/styled.js';
|
|
4
3
|
import { isSideDraw, hasHeaderSlot, hasFooterSlot } from './types.js';
|
|
5
4
|
import { Dialog } from './components/Dialog/Dialog.js';
|
|
5
|
+
import { buildClassnames } from '../../utils/buildClassnames.js';
|
|
6
|
+
import 'uid/secure';
|
|
6
7
|
import { useIsOverflowing } from '../../hooks/useIsOverflowing.js';
|
|
7
8
|
import { Button } from '../Button/Button.js';
|
|
8
9
|
import { Card } from '../Card/Card.js';
|
|
9
10
|
import { CardHeader } from '../CardHeader/CardHeader.js';
|
|
10
11
|
import { Stack } from '../Stack/Stack.js';
|
|
11
12
|
import { preventDefaultEventOnESC } from './utils.js';
|
|
13
|
+
import modalStyles from './Modal.module.scss.js';
|
|
12
14
|
|
|
13
15
|
/* eslint-disable react/destructuring-assignment */
|
|
16
|
+
/**
|
|
17
|
+
* Manages body scroll-lock as a component mounted inside AnimatePresence.
|
|
18
|
+
* Reference-counted so multiple simultaneous modals don't conflict:
|
|
19
|
+
* the class only removes when the last modal unmounts.
|
|
20
|
+
*/
|
|
21
|
+
let scrollLockCount = 0;
|
|
22
|
+
const ScrollLock = () => {
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
scrollLockCount += 1;
|
|
25
|
+
document.body.classList.add('veeqo-modal-open');
|
|
26
|
+
return () => {
|
|
27
|
+
scrollLockCount -= 1;
|
|
28
|
+
if (scrollLockCount === 0) {
|
|
29
|
+
document.body.classList.remove('veeqo-modal-open');
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
14
35
|
const Modal = (props) => {
|
|
15
36
|
const { shouldShow, showHeaderCloseButton = true, preventClose = false, displayMode = 'modal', fullBleed = false, variant = 'base', onClose: parentOnClose, children, ...rest } = props;
|
|
16
37
|
const modalRef = useRef(null);
|
|
@@ -49,11 +70,15 @@ const Modal = (props) => {
|
|
|
49
70
|
handleClose();
|
|
50
71
|
};
|
|
51
72
|
return (React__default.createElement(AnimatePresence, null, shouldShow && (React__default.createElement("div", { "data-testid": "dialog-wrapper", style: { position: 'absolute' } },
|
|
52
|
-
React__default.createElement(
|
|
73
|
+
React__default.createElement(ScrollLock, null),
|
|
53
74
|
React__default.createElement(Dialog, { "data-dialog-type": "modal", displayMode: displayMode, variant: variant, ref: modalRef, onClose: handleClose, onKeyDown: preventClose ? preventDefaultEventOnESC : handleKeyDown, onClick: handleBackdropClick, ...rest, "aria-describedby": "modal_title", appearance: (isSideDraw(props) && props.appearance) || 'primary' },
|
|
54
75
|
React__default.createElement(Card.Surface, null,
|
|
55
76
|
hasHeaderSlot(props) ? (props.headerSlot) : (React__default.createElement(CardHeader, { id: "modal_title", headerVariant: "headingLarge", title: props.headerTitle, subtitle: props.headerSubtitle, ...(showHeaderCloseButton && { onClickClose: handleClose }) })),
|
|
56
|
-
React__default.createElement(
|
|
77
|
+
React__default.createElement("section", { onScroll: onScroll, ref: setMainSectionRef, className: buildClassnames([
|
|
78
|
+
modalStyles.mainSection,
|
|
79
|
+
fullBleed && modalStyles.fullBleed,
|
|
80
|
+
isContentOverflowing && modalStyles.scrollable,
|
|
81
|
+
]) }, children),
|
|
57
82
|
hasFooterSlot(props) && props.footerSlot,
|
|
58
83
|
!hasFooterSlot(props) && (props.leftActions || props.rightActions) && (React__default.createElement(Card.Footer, null,
|
|
59
84
|
React__default.createElement(Stack, { direction: "horizontal", alignX: props.leftActions ? 'between' : 'end' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["/* eslint-disable react/destructuring-assignment */\nimport React, { useEffect, useRef, useState } from 'react';\nimport { AnimatePresence } from 'framer-motion';\n\nimport { MainSection, NonScrollableBody } from './components/styled';\nimport { ModalProps, hasFooterSlot, hasHeaderSlot, isSideDraw } from './types';\nimport { Dialog } from './components/Dialog/Dialog';\n\nimport { useIsOverflowing } from '../../hooks/useIsOverflowing';\nimport { Button } from '../Button';\nimport { Card } from '../Card';\nimport { CardHeader } from '../CardHeader';\nimport { Stack } from '../Stack';\nimport { preventDefaultEventOnESC } from './utils';\n\nexport const Modal = (props: ModalProps) => {\n const {\n shouldShow,\n showHeaderCloseButton = true,\n preventClose = false,\n displayMode = 'modal',\n fullBleed = false,\n variant = 'base',\n onClose: parentOnClose,\n children,\n ...rest\n } = props;\n\n const modalRef = useRef<HTMLDialogElement | null>(null);\n const [mainSectionRef, setMainSectionRef] = useState<HTMLElement | null>(null);\n\n useEffect(() => {\n if (shouldShow) {\n modalRef.current?.removeAttribute('open'); // Allows for conditional rendering.\n modalRef.current?.showModal();\n }\n }, [shouldShow]);\n\n const { isOverflowing: isContentOverflowing, onScroll } = useIsOverflowing(mainSectionRef);\n\n const handleClose = () => {\n if (preventClose) return;\n\n const result = parentOnClose();\n if (result === false) return; // Otherwise close on void, or true.\n\n modalRef.current?.close();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDialogElement>) => {\n if (e.key === 'Escape') {\n e.preventDefault(); // Prevent default ESC behavior\n\n // Don't close if this is the top level and there are other dialogs open\n const openDialogs = document.querySelectorAll('dialog[open]');\n if (openDialogs.length > 1 && modalRef.current === openDialogs[0]) return;\n\n handleClose();\n }\n };\n\n const handleBackdropClick = async (e: React.MouseEvent<HTMLDialogElement>) => {\n if (displayMode === 'modal') return;\n if (e.target === modalRef.current) handleClose();\n };\n\n return (\n <AnimatePresence>\n {shouldShow && (\n <div data-testid=\"dialog-wrapper\" style={{ position: 'absolute' }}>\n <NonScrollableBody />\n <Dialog\n data-dialog-type=\"modal\"\n displayMode={displayMode}\n variant={variant}\n ref={modalRef}\n onClose={handleClose}\n onKeyDown={preventClose ? preventDefaultEventOnESC : handleKeyDown}\n onClick={handleBackdropClick}\n {...rest}\n aria-describedby=\"modal_title\"\n appearance={(isSideDraw(props) && props.appearance) || 'primary'}\n >\n <Card.Surface>\n {hasHeaderSlot(props) ? (\n props.headerSlot\n ) : (\n <CardHeader\n id=\"modal_title\"\n headerVariant=\"headingLarge\"\n title={props.headerTitle}\n subtitle={props.headerSubtitle}\n {...(showHeaderCloseButton && { onClickClose: handleClose })}\n />\n )}\n\n <MainSection\n onScroll={onScroll}\n ref={setMainSectionRef}\n isScrollable={isContentOverflowing}\n fullBleed={fullBleed}\n >\n {children}\n </MainSection>\n\n {hasFooterSlot(props) && props.footerSlot}\n\n {!hasFooterSlot(props) && (props.leftActions || props.rightActions) && (\n <Card.Footer>\n <Stack direction=\"horizontal\" alignX={props.leftActions ? 'between' : 'end'}>\n {props.leftActions && (\n <Stack\n direction=\"horizontal\"\n alignX=\"start\"\n data-testid=\"left-actions-container\"\n >\n {props.leftActions.map(({ label, ...actionProps }) => (\n <Button key={label} type=\"button\" {...actionProps}>\n {label}\n </Button>\n ))}\n </Stack>\n )}\n {props.rightActions && (\n <Stack\n direction=\"horizontal\"\n alignX=\"end\"\n data-testid=\"right-actions-container\"\n >\n {props.rightActions.map(({ label, ...actionProps }) => (\n <Button key={label} type=\"button\" {...actionProps}>\n {label}\n </Button>\n ))}\n </Stack>\n )}\n </Stack>\n </Card.Footer>\n )}\n </Card.Surface>\n </Dialog>\n </div>\n )}\n </AnimatePresence>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;AAAA;AAeO,MAAM,KAAK,GAAG,CAAC,KAAiB,KAAI;AACzC,IAAA,MAAM,EACJ,UAA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AAM,EAAC,KAAK,EAAA,aAAA,EACA,yBAAyB,EAAA,EAEpC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,MAChDA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAC,QAAQ,EAAA,GAAK,WAAW,EAAA,EAC9C,KAAK,CACC,CACV,CAAC,CACI,CACT,CACK,CACI,CACf,CACY,CACR,CACL,CACP,CACe;AAEtB;;;;"}
|
|
1
|
+
{"version":3,"file":"Modal.js","sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["/* eslint-disable react/destructuring-assignment */\nimport React, { useEffect, useRef, useState } from 'react';\nimport { AnimatePresence } from 'framer-motion';\n\nimport { ModalProps, hasFooterSlot, hasHeaderSlot, isSideDraw } from './types';\nimport { Dialog } from './components/Dialog/Dialog';\n\nimport { buildClassnames } from '../../utils';\nimport { useIsOverflowing } from '../../hooks/useIsOverflowing';\nimport { Button } from '../Button';\nimport { Card } from '../Card';\nimport { CardHeader } from '../CardHeader';\nimport { Stack } from '../Stack';\nimport { preventDefaultEventOnESC } from './utils';\nimport modalStyles from './Modal.module.scss';\n\n/**\n * Manages body scroll-lock as a component mounted inside AnimatePresence.\n * Reference-counted so multiple simultaneous modals don't conflict:\n * the class only removes when the last modal unmounts.\n */\nlet scrollLockCount = 0;\n\nconst ScrollLock = () => {\n useEffect(() => {\n scrollLockCount += 1;\n document.body.classList.add('veeqo-modal-open');\n return () => {\n scrollLockCount -= 1;\n if (scrollLockCount === 0) {\n document.body.classList.remove('veeqo-modal-open');\n }\n };\n }, []);\n return null;\n};\n\nexport const Modal = (props: ModalProps) => {\n const {\n shouldShow,\n showHeaderCloseButton = true,\n preventClose = false,\n displayMode = 'modal',\n fullBleed = false,\n variant = 'base',\n onClose: parentOnClose,\n children,\n ...rest\n } = props;\n\n const modalRef = useRef<HTMLDialogElement | null>(null);\n const [mainSectionRef, setMainSectionRef] = useState<HTMLElement | null>(null);\n\n useEffect(() => {\n if (shouldShow) {\n modalRef.current?.removeAttribute('open'); // Allows for conditional rendering.\n modalRef.current?.showModal();\n }\n }, [shouldShow]);\n\n const { isOverflowing: isContentOverflowing, onScroll } = useIsOverflowing(mainSectionRef);\n\n const handleClose = () => {\n if (preventClose) return;\n\n const result = parentOnClose();\n if (result === false) return; // Otherwise close on void, or true.\n\n modalRef.current?.close();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDialogElement>) => {\n if (e.key === 'Escape') {\n e.preventDefault(); // Prevent default ESC behavior\n\n // Don't close if this is the top level and there are other dialogs open\n const openDialogs = document.querySelectorAll('dialog[open]');\n if (openDialogs.length > 1 && modalRef.current === openDialogs[0]) return;\n\n handleClose();\n }\n };\n\n const handleBackdropClick = async (e: React.MouseEvent<HTMLDialogElement>) => {\n if (displayMode === 'modal') return;\n if (e.target === modalRef.current) handleClose();\n };\n\n return (\n <AnimatePresence>\n {shouldShow && (\n <div data-testid=\"dialog-wrapper\" style={{ position: 'absolute' }}>\n <ScrollLock />\n <Dialog\n data-dialog-type=\"modal\"\n displayMode={displayMode}\n variant={variant}\n ref={modalRef}\n onClose={handleClose}\n onKeyDown={preventClose ? preventDefaultEventOnESC : handleKeyDown}\n onClick={handleBackdropClick}\n {...rest}\n aria-describedby=\"modal_title\"\n appearance={(isSideDraw(props) && props.appearance) || 'primary'}\n >\n <Card.Surface>\n {hasHeaderSlot(props) ? (\n props.headerSlot\n ) : (\n <CardHeader\n id=\"modal_title\"\n headerVariant=\"headingLarge\"\n title={props.headerTitle}\n subtitle={props.headerSubtitle}\n {...(showHeaderCloseButton && { onClickClose: handleClose })}\n />\n )}\n\n <section\n onScroll={onScroll}\n ref={setMainSectionRef}\n className={buildClassnames([\n modalStyles.mainSection,\n fullBleed && modalStyles.fullBleed,\n isContentOverflowing && modalStyles.scrollable,\n ])}\n >\n {children}\n </section>\n\n {hasFooterSlot(props) && props.footerSlot}\n\n {!hasFooterSlot(props) && (props.leftActions || props.rightActions) && (\n <Card.Footer>\n <Stack direction=\"horizontal\" alignX={props.leftActions ? 'between' : 'end'}>\n {props.leftActions && (\n <Stack\n direction=\"horizontal\"\n alignX=\"start\"\n data-testid=\"left-actions-container\"\n >\n {props.leftActions.map(({ label, ...actionProps }) => (\n <Button key={label} type=\"button\" {...actionProps}>\n {label}\n </Button>\n ))}\n </Stack>\n )}\n {props.rightActions && (\n <Stack\n direction=\"horizontal\"\n alignX=\"end\"\n data-testid=\"right-actions-container\"\n >\n {props.rightActions.map(({ label, ...actionProps }) => (\n <Button key={label} type=\"button\" {...actionProps}>\n {label}\n </Button>\n ))}\n </Stack>\n )}\n </Stack>\n </Card.Footer>\n )}\n </Card.Surface>\n </Dialog>\n </div>\n )}\n </AnimatePresence>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;AAAA;AAgBA;;;;AAIG;AACH,IAAI,eAAe,GAAG,CAAC;AAEvB,MAAM,UAAU,GAAG,MAAK;IACtB,SAAS,CAAC,MAAK;QACb,eAAe,IAAI,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC;AAC/C,QAAA,OAAO,MAAK;YACV,eAAe,IAAI,CAAC;YACpB,IAAI,eAAe,KAAK,CAAC,EAAE;gBACzB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC;AACnD,YAAA;AACH,QAAA,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;AACN,IAAA,OAAO,IAAI;AACb,CAAC;AAEM,MAAM,KAAK,GAAG,CAAC,KAAiB,KAAI;AACzC,IAAA,MAAM,EACJ,UAAU,EACV,qBAAqB,GAAG,IAAI,EAC5B,YAAY,GAAG,KAAK,EACpB,WAAW,GAAG,OAAO,EACrB,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,MAAM,EAChB,OAAO,EAAE,aAAa,EACtB,QAAQ,EACR,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C,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,MAChDA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAC,QAAQ,EAAA,GAAK,WAAW,EAAA,EAC9C,KAAK,CACC,CACV,CAAC,CACI,CACT,CACK,CACI,CACf,CACY,CACR,CACL,CACP,CACe;AAEtB;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
|
+
|
|
5
|
+
___$insertStyle("/* Scroll-lock: prevents body scrolling when modal is open.\n The class persists through AnimatePresence exit animations because\n it's managed by the ScrollLock component mounted inside AnimatePresence. */\nbody.veeqo-modal-open {\n overflow: hidden;\n scrollbar-gutter: stable;\n}\n\n@keyframes _fadeIn_6h63u_1 {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n._dialog_6h63u_17 {\n padding: 0;\n border: none;\n border-radius: var(--sizes-sm);\n box-shadow: var(--shadows-lg);\n z-index: var(--layers-modal);\n /* Targets Card.Surface: the sole direct child of dialog.\n Wave 3 (Card migration) can update to CSS Module class reference. */\n /* Targets Card.Footer */\n}\n._dialog_6h63u_17::backdrop {\n animation: _fadeIn_6h63u_1 0.25s ease forwards;\n background-color: rgba(55, 66, 77, 0.5);\n width: 100%;\n height: 100%;\n}\n._dialog_6h63u_17 > :first-child {\n display: flex;\n flex-direction: column;\n}\n._dialog_6h63u_17 > :first-child ._mainSection_6h63u_37 {\n padding-bottom: var(--sizes-md);\n}\n._dialog_6h63u_17 > :first-child footer {\n margin-top: 0;\n}\n\n._secondaryAppearance_6h63u_44::backdrop {\n animation: none;\n opacity: 0;\n}\n\n/* ---------- MainSection ---------- */\n._mainSection_6h63u_37 {\n flex: 1;\n overflow-y: auto;\n}\n\n._mainSection_6h63u_37:not(._fullBleed_6h63u_55) {\n padding: 0 var(--sizes-md);\n}\n\n/* Scrollable shadow on Card.Footer when content overflows */\n._mainSection_6h63u_37._scrollable_6h63u_60 + footer {\n box-shadow: 0px 10px 15px 0px var(--colors-neutral-ink-dark);\n}\n\n/* ---------- Modal display mode ---------- */\n._modal_6h63u_65 {\n min-width: 464px;\n /* Critical for framer-motion exit animations: prevents HTML dialog from\n hiding via UA stylesheet when 'open' attribute is removed. */\n}\n._modal_6h63u_65:not([open]) {\n display: block;\n position: fixed;\n inset: 0;\n transform: translate(-50%, -50%);\n}\n\n/* ---------- Side drawer shared base ---------- */\n._leftDrawer_6h63u_78,\n._rightDrawer_6h63u_79 {\n height: 100%;\n max-height: 100%;\n min-width: 320px;\n width: 400px;\n margin: 0;\n position: fixed;\n transform: none;\n border-radius: 0;\n overflow: visible;\n /* Critical for framer-motion exit animations */\n}\n._leftDrawer_6h63u_78 > :first-child,\n._rightDrawer_6h63u_79 > :first-child {\n border-radius: 0;\n height: 100%;\n}\n._leftDrawer_6h63u_78:not([open]),\n._rightDrawer_6h63u_79:not([open]) {\n display: block;\n}\n\n._leftDrawer_6h63u_78 {\n inset: 0 auto 0 0;\n}\n\n._rightDrawer_6h63u_79 {\n inset: 0 0 0 auto;\n}\n\n/* ---------- Variant-specific responsive widths ---------- */\n/* Values hardcoded from constants.ts (heightMap, widthMap, fullScreenBreakpointMap) */\n._xs-variant_6h63u_111 {\n /* fullScreenBreakpointMap['xs'] = 640px (breakpoints.mobile) */\n}\n._xs-variant_6h63u_111 > :first-child {\n max-height: 84vh;\n}\n@media (width <= 640px) {\n ._xs-variant_6h63u_111 {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n }\n ._xs-variant_6h63u_111, ._xs-variant_6h63u_111 > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n}\n@media (width >= 641px) and (width <= 720px) {\n ._xs-variant_6h63u_111 {\n max-width: 60vw;\n }\n}\n@media (width >= 720px) and (width <= 960px) {\n ._xs-variant_6h63u_111 {\n max-width: 48vw;\n }\n}\n@media (width >= 960px) and (width <= 1280px) {\n ._xs-variant_6h63u_111 {\n max-width: 36vw;\n }\n}\n@media (width >= 1280px) {\n ._xs-variant_6h63u_111 {\n max-width: 32vw;\n }\n}\n\n._sm-variant_6h63u_152 {\n /* fullScreenBreakpointMap['sm'] = 640px (breakpoints.mobile) */\n}\n._sm-variant_6h63u_152 > :first-child {\n max-height: 72vh;\n}\n@media (width <= 640px) {\n ._sm-variant_6h63u_152 {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n }\n ._sm-variant_6h63u_152, ._sm-variant_6h63u_152 > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n}\n@media (width >= 641px) and (width <= 720px) {\n ._sm-variant_6h63u_152 {\n max-width: 72vw;\n }\n}\n@media (width >= 720px) and (width <= 960px) {\n ._sm-variant_6h63u_152 {\n max-width: 56vw;\n }\n}\n@media (width >= 960px) and (width <= 1280px) {\n ._sm-variant_6h63u_152 {\n max-width: 44vw;\n }\n}\n@media (width >= 1280px) {\n ._sm-variant_6h63u_152 {\n max-width: 40vw;\n }\n}\n\n._base-variant_6h63u_193 {\n /* fullScreenBreakpointMap['base'] = 720px (breakpoints.tablet) */\n}\n._base-variant_6h63u_193 > :first-child {\n max-height: 84vh;\n}\n@media (width <= 720px) {\n ._base-variant_6h63u_193 {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n }\n ._base-variant_6h63u_193, ._base-variant_6h63u_193 > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n}\n@media (width >= 720px) and (width <= 960px) {\n ._base-variant_6h63u_193 {\n max-width: 88vw;\n }\n}\n@media (width >= 960px) and (width <= 1280px) {\n ._base-variant_6h63u_193 {\n max-width: 72vw;\n }\n}\n@media (width >= 1280px) {\n ._base-variant_6h63u_193 {\n max-width: 52vw;\n }\n}\n\n._lg-variant_6h63u_229 {\n /* fullScreenBreakpointMap['lg'] = 960px (breakpoints.lgTablet) */\n}\n._lg-variant_6h63u_229 > :first-child {\n max-height: 96vh;\n}\n@media (width <= 960px) {\n ._lg-variant_6h63u_229 {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n }\n ._lg-variant_6h63u_229, ._lg-variant_6h63u_229 > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n}\n@media (width >= 960px) and (width <= 1280px) {\n ._lg-variant_6h63u_229 {\n max-width: 88vw;\n }\n}\n@media (width >= 1280px) {\n ._lg-variant_6h63u_229 {\n max-width: 80vw;\n }\n}");
|
|
6
|
+
var modalStyles = {"dialog":"_dialog_6h63u_17","fadeIn":"_fadeIn_6h63u_1","mainSection":"_mainSection_6h63u_37","secondaryAppearance":"_secondaryAppearance_6h63u_44","fullBleed":"_fullBleed_6h63u_55","scrollable":"_scrollable_6h63u_60","modal":"_modal_6h63u_65","leftDrawer":"_leftDrawer_6h63u_78","rightDrawer":"_rightDrawer_6h63u_79","xs-variant":"_xs-variant_6h63u_111","sm-variant":"_sm-variant_6h63u_152","base-variant":"_base-variant_6h63u_193","lg-variant":"_lg-variant_6h63u_229"};
|
|
7
|
+
|
|
8
|
+
module.exports = modalStyles;
|
|
9
|
+
//# sourceMappingURL=Modal.module.scss.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.module.scss.cjs","sources":["../../../src/components/Modal/Modal.module.scss"],"sourcesContent":["/* Scroll-lock: prevents body scrolling when modal is open.\n The class persists through AnimatePresence exit animations because\n it's managed by the ScrollLock component mounted inside AnimatePresence. */\n:global(body.veeqo-modal-open) {\n overflow: hidden;\n scrollbar-gutter: stable;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n.dialog {\n padding: 0;\n border: none;\n border-radius: var(--sizes-sm);\n box-shadow: var(--shadows-lg);\n z-index: var(--layers-modal);\n\n &::backdrop {\n animation: fadeIn 0.25s ease forwards;\n background-color: rgba(55, 66, 77, 0.5);\n width: 100%;\n height: 100%;\n }\n\n /* Targets Card.Surface: the sole direct child of dialog.\n Wave 3 (Card migration) can update to CSS Module class reference. */\n & > :first-child {\n display: flex;\n flex-direction: column;\n }\n\n & > :first-child .mainSection {\n padding-bottom: var(--sizes-md);\n }\n\n /* Targets Card.Footer */\n & > :first-child footer {\n margin-top: 0;\n }\n}\n\n.secondaryAppearance {\n &::backdrop {\n animation: none;\n opacity: 0;\n }\n}\n\n/* ---------- MainSection ---------- */\n\n.mainSection {\n flex: 1;\n overflow-y: auto;\n}\n\n.mainSection:not(.fullBleed) {\n padding: 0 var(--sizes-md);\n}\n\n/* Scrollable shadow on Card.Footer when content overflows */\n.mainSection.scrollable + footer {\n box-shadow: 0px 10px 15px 0px var(--colors-neutral-ink-dark);\n}\n\n/* ---------- Modal display mode ---------- */\n\n.modal {\n min-width: 464px;\n\n /* Critical for framer-motion exit animations: prevents HTML dialog from\n hiding via UA stylesheet when 'open' attribute is removed. */\n &:not([open]) {\n display: block;\n position: fixed;\n inset: 0;\n transform: translate(-50%, -50%);\n }\n}\n\n/* ---------- Side drawer shared base ---------- */\n\n.leftDrawer,\n.rightDrawer {\n height: 100%;\n max-height: 100%;\n min-width: 320px;\n width: 400px;\n margin: 0;\n position: fixed;\n transform: none;\n border-radius: 0;\n overflow: visible;\n\n & > :first-child {\n border-radius: 0;\n height: 100%;\n }\n\n /* Critical for framer-motion exit animations */\n &:not([open]) {\n display: block;\n }\n}\n\n.leftDrawer {\n inset: 0 auto 0 0;\n}\n\n.rightDrawer {\n inset: 0 0 0 auto;\n}\n\n/* ---------- Variant-specific responsive widths ---------- */\n/* Values hardcoded from constants.ts (heightMap, widthMap, fullScreenBreakpointMap) */\n\n.xs-variant {\n & > :first-child {\n max-height: 84vh;\n }\n\n /* fullScreenBreakpointMap['xs'] = 640px (breakpoints.mobile) */\n @media (width <= 640px) {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n\n &,\n & > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n }\n\n @media (width >= 641px) and (width <= 720px) {\n max-width: 60vw;\n }\n\n @media (width >= 720px) and (width <= 960px) {\n max-width: 48vw;\n }\n\n @media (width >= 960px) and (width <= 1280px) {\n max-width: 36vw;\n }\n\n @media (width >= 1280px) {\n max-width: 32vw;\n }\n}\n\n.sm-variant {\n & > :first-child {\n max-height: 72vh;\n }\n\n /* fullScreenBreakpointMap['sm'] = 640px (breakpoints.mobile) */\n @media (width <= 640px) {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n\n &,\n & > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n }\n\n @media (width >= 641px) and (width <= 720px) {\n max-width: 72vw;\n }\n\n @media (width >= 720px) and (width <= 960px) {\n max-width: 56vw;\n }\n\n @media (width >= 960px) and (width <= 1280px) {\n max-width: 44vw;\n }\n\n @media (width >= 1280px) {\n max-width: 40vw;\n }\n}\n\n.base-variant {\n & > :first-child {\n max-height: 84vh;\n }\n\n /* fullScreenBreakpointMap['base'] = 720px (breakpoints.tablet) */\n @media (width <= 720px) {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n\n &,\n & > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n }\n\n @media (width >= 720px) and (width <= 960px) {\n max-width: 88vw;\n }\n\n @media (width >= 960px) and (width <= 1280px) {\n max-width: 72vw;\n }\n\n @media (width >= 1280px) {\n max-width: 52vw;\n }\n}\n\n.lg-variant {\n & > :first-child {\n max-height: 96vh;\n }\n\n /* fullScreenBreakpointMap['lg'] = 960px (breakpoints.lgTablet) */\n @media (width <= 960px) {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n\n &,\n & > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n }\n\n @media (width >= 960px) and (width <= 1280px) {\n max-width: 88vw;\n }\n\n @media (width >= 1280px) {\n max-width: 80vw;\n }\n}\n"],"names":[],"mappings":";;;;AAAA,eAAA,CAAA,4yLAAA;AAAA,kBAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,aAAA,CAAA,uBAAA,CAAA,qBAAA,CAAA,+BAAA,CAAA,WAAA,CAAA,qBAAA,CAAA,YAAA,CAAA,sBAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,YAAA,CAAA,sBAAA,CAAA,aAAA,CAAA,uBAAA,CAAA,YAAA,CAAA,uBAAA,CAAA,YAAA,CAAA,uBAAA,CAAA,cAAA,CAAA,yBAAA,CAAA,YAAA,CAAA,uBAAA;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import insertStyle from '../../_virtual/____insertStyle.js';
|
|
2
|
+
|
|
3
|
+
insertStyle("/* Scroll-lock: prevents body scrolling when modal is open.\n The class persists through AnimatePresence exit animations because\n it's managed by the ScrollLock component mounted inside AnimatePresence. */\nbody.veeqo-modal-open {\n overflow: hidden;\n scrollbar-gutter: stable;\n}\n\n@keyframes _fadeIn_6h63u_1 {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n._dialog_6h63u_17 {\n padding: 0;\n border: none;\n border-radius: var(--sizes-sm);\n box-shadow: var(--shadows-lg);\n z-index: var(--layers-modal);\n /* Targets Card.Surface: the sole direct child of dialog.\n Wave 3 (Card migration) can update to CSS Module class reference. */\n /* Targets Card.Footer */\n}\n._dialog_6h63u_17::backdrop {\n animation: _fadeIn_6h63u_1 0.25s ease forwards;\n background-color: rgba(55, 66, 77, 0.5);\n width: 100%;\n height: 100%;\n}\n._dialog_6h63u_17 > :first-child {\n display: flex;\n flex-direction: column;\n}\n._dialog_6h63u_17 > :first-child ._mainSection_6h63u_37 {\n padding-bottom: var(--sizes-md);\n}\n._dialog_6h63u_17 > :first-child footer {\n margin-top: 0;\n}\n\n._secondaryAppearance_6h63u_44::backdrop {\n animation: none;\n opacity: 0;\n}\n\n/* ---------- MainSection ---------- */\n._mainSection_6h63u_37 {\n flex: 1;\n overflow-y: auto;\n}\n\n._mainSection_6h63u_37:not(._fullBleed_6h63u_55) {\n padding: 0 var(--sizes-md);\n}\n\n/* Scrollable shadow on Card.Footer when content overflows */\n._mainSection_6h63u_37._scrollable_6h63u_60 + footer {\n box-shadow: 0px 10px 15px 0px var(--colors-neutral-ink-dark);\n}\n\n/* ---------- Modal display mode ---------- */\n._modal_6h63u_65 {\n min-width: 464px;\n /* Critical for framer-motion exit animations: prevents HTML dialog from\n hiding via UA stylesheet when 'open' attribute is removed. */\n}\n._modal_6h63u_65:not([open]) {\n display: block;\n position: fixed;\n inset: 0;\n transform: translate(-50%, -50%);\n}\n\n/* ---------- Side drawer shared base ---------- */\n._leftDrawer_6h63u_78,\n._rightDrawer_6h63u_79 {\n height: 100%;\n max-height: 100%;\n min-width: 320px;\n width: 400px;\n margin: 0;\n position: fixed;\n transform: none;\n border-radius: 0;\n overflow: visible;\n /* Critical for framer-motion exit animations */\n}\n._leftDrawer_6h63u_78 > :first-child,\n._rightDrawer_6h63u_79 > :first-child {\n border-radius: 0;\n height: 100%;\n}\n._leftDrawer_6h63u_78:not([open]),\n._rightDrawer_6h63u_79:not([open]) {\n display: block;\n}\n\n._leftDrawer_6h63u_78 {\n inset: 0 auto 0 0;\n}\n\n._rightDrawer_6h63u_79 {\n inset: 0 0 0 auto;\n}\n\n/* ---------- Variant-specific responsive widths ---------- */\n/* Values hardcoded from constants.ts (heightMap, widthMap, fullScreenBreakpointMap) */\n._xs-variant_6h63u_111 {\n /* fullScreenBreakpointMap['xs'] = 640px (breakpoints.mobile) */\n}\n._xs-variant_6h63u_111 > :first-child {\n max-height: 84vh;\n}\n@media (width <= 640px) {\n ._xs-variant_6h63u_111 {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n }\n ._xs-variant_6h63u_111, ._xs-variant_6h63u_111 > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n}\n@media (width >= 641px) and (width <= 720px) {\n ._xs-variant_6h63u_111 {\n max-width: 60vw;\n }\n}\n@media (width >= 720px) and (width <= 960px) {\n ._xs-variant_6h63u_111 {\n max-width: 48vw;\n }\n}\n@media (width >= 960px) and (width <= 1280px) {\n ._xs-variant_6h63u_111 {\n max-width: 36vw;\n }\n}\n@media (width >= 1280px) {\n ._xs-variant_6h63u_111 {\n max-width: 32vw;\n }\n}\n\n._sm-variant_6h63u_152 {\n /* fullScreenBreakpointMap['sm'] = 640px (breakpoints.mobile) */\n}\n._sm-variant_6h63u_152 > :first-child {\n max-height: 72vh;\n}\n@media (width <= 640px) {\n ._sm-variant_6h63u_152 {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n }\n ._sm-variant_6h63u_152, ._sm-variant_6h63u_152 > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n}\n@media (width >= 641px) and (width <= 720px) {\n ._sm-variant_6h63u_152 {\n max-width: 72vw;\n }\n}\n@media (width >= 720px) and (width <= 960px) {\n ._sm-variant_6h63u_152 {\n max-width: 56vw;\n }\n}\n@media (width >= 960px) and (width <= 1280px) {\n ._sm-variant_6h63u_152 {\n max-width: 44vw;\n }\n}\n@media (width >= 1280px) {\n ._sm-variant_6h63u_152 {\n max-width: 40vw;\n }\n}\n\n._base-variant_6h63u_193 {\n /* fullScreenBreakpointMap['base'] = 720px (breakpoints.tablet) */\n}\n._base-variant_6h63u_193 > :first-child {\n max-height: 84vh;\n}\n@media (width <= 720px) {\n ._base-variant_6h63u_193 {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n }\n ._base-variant_6h63u_193, ._base-variant_6h63u_193 > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n}\n@media (width >= 720px) and (width <= 960px) {\n ._base-variant_6h63u_193 {\n max-width: 88vw;\n }\n}\n@media (width >= 960px) and (width <= 1280px) {\n ._base-variant_6h63u_193 {\n max-width: 72vw;\n }\n}\n@media (width >= 1280px) {\n ._base-variant_6h63u_193 {\n max-width: 52vw;\n }\n}\n\n._lg-variant_6h63u_229 {\n /* fullScreenBreakpointMap['lg'] = 960px (breakpoints.lgTablet) */\n}\n._lg-variant_6h63u_229 > :first-child {\n max-height: 96vh;\n}\n@media (width <= 960px) {\n ._lg-variant_6h63u_229 {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n }\n ._lg-variant_6h63u_229, ._lg-variant_6h63u_229 > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n}\n@media (width >= 960px) and (width <= 1280px) {\n ._lg-variant_6h63u_229 {\n max-width: 88vw;\n }\n}\n@media (width >= 1280px) {\n ._lg-variant_6h63u_229 {\n max-width: 80vw;\n }\n}");
|
|
4
|
+
var modalStyles = {"dialog":"_dialog_6h63u_17","fadeIn":"_fadeIn_6h63u_1","mainSection":"_mainSection_6h63u_37","secondaryAppearance":"_secondaryAppearance_6h63u_44","fullBleed":"_fullBleed_6h63u_55","scrollable":"_scrollable_6h63u_60","modal":"_modal_6h63u_65","leftDrawer":"_leftDrawer_6h63u_78","rightDrawer":"_rightDrawer_6h63u_79","xs-variant":"_xs-variant_6h63u_111","sm-variant":"_sm-variant_6h63u_152","base-variant":"_base-variant_6h63u_193","lg-variant":"_lg-variant_6h63u_229"};
|
|
5
|
+
|
|
6
|
+
export { modalStyles as default };
|
|
7
|
+
//# sourceMappingURL=Modal.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.module.scss.js","sources":["../../../src/components/Modal/Modal.module.scss"],"sourcesContent":["/* Scroll-lock: prevents body scrolling when modal is open.\n The class persists through AnimatePresence exit animations because\n it's managed by the ScrollLock component mounted inside AnimatePresence. */\n:global(body.veeqo-modal-open) {\n overflow: hidden;\n scrollbar-gutter: stable;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n.dialog {\n padding: 0;\n border: none;\n border-radius: var(--sizes-sm);\n box-shadow: var(--shadows-lg);\n z-index: var(--layers-modal);\n\n &::backdrop {\n animation: fadeIn 0.25s ease forwards;\n background-color: rgba(55, 66, 77, 0.5);\n width: 100%;\n height: 100%;\n }\n\n /* Targets Card.Surface: the sole direct child of dialog.\n Wave 3 (Card migration) can update to CSS Module class reference. */\n & > :first-child {\n display: flex;\n flex-direction: column;\n }\n\n & > :first-child .mainSection {\n padding-bottom: var(--sizes-md);\n }\n\n /* Targets Card.Footer */\n & > :first-child footer {\n margin-top: 0;\n }\n}\n\n.secondaryAppearance {\n &::backdrop {\n animation: none;\n opacity: 0;\n }\n}\n\n/* ---------- MainSection ---------- */\n\n.mainSection {\n flex: 1;\n overflow-y: auto;\n}\n\n.mainSection:not(.fullBleed) {\n padding: 0 var(--sizes-md);\n}\n\n/* Scrollable shadow on Card.Footer when content overflows */\n.mainSection.scrollable + footer {\n box-shadow: 0px 10px 15px 0px var(--colors-neutral-ink-dark);\n}\n\n/* ---------- Modal display mode ---------- */\n\n.modal {\n min-width: 464px;\n\n /* Critical for framer-motion exit animations: prevents HTML dialog from\n hiding via UA stylesheet when 'open' attribute is removed. */\n &:not([open]) {\n display: block;\n position: fixed;\n inset: 0;\n transform: translate(-50%, -50%);\n }\n}\n\n/* ---------- Side drawer shared base ---------- */\n\n.leftDrawer,\n.rightDrawer {\n height: 100%;\n max-height: 100%;\n min-width: 320px;\n width: 400px;\n margin: 0;\n position: fixed;\n transform: none;\n border-radius: 0;\n overflow: visible;\n\n & > :first-child {\n border-radius: 0;\n height: 100%;\n }\n\n /* Critical for framer-motion exit animations */\n &:not([open]) {\n display: block;\n }\n}\n\n.leftDrawer {\n inset: 0 auto 0 0;\n}\n\n.rightDrawer {\n inset: 0 0 0 auto;\n}\n\n/* ---------- Variant-specific responsive widths ---------- */\n/* Values hardcoded from constants.ts (heightMap, widthMap, fullScreenBreakpointMap) */\n\n.xs-variant {\n & > :first-child {\n max-height: 84vh;\n }\n\n /* fullScreenBreakpointMap['xs'] = 640px (breakpoints.mobile) */\n @media (width <= 640px) {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n\n &,\n & > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n }\n\n @media (width >= 641px) and (width <= 720px) {\n max-width: 60vw;\n }\n\n @media (width >= 720px) and (width <= 960px) {\n max-width: 48vw;\n }\n\n @media (width >= 960px) and (width <= 1280px) {\n max-width: 36vw;\n }\n\n @media (width >= 1280px) {\n max-width: 32vw;\n }\n}\n\n.sm-variant {\n & > :first-child {\n max-height: 72vh;\n }\n\n /* fullScreenBreakpointMap['sm'] = 640px (breakpoints.mobile) */\n @media (width <= 640px) {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n\n &,\n & > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n }\n\n @media (width >= 641px) and (width <= 720px) {\n max-width: 72vw;\n }\n\n @media (width >= 720px) and (width <= 960px) {\n max-width: 56vw;\n }\n\n @media (width >= 960px) and (width <= 1280px) {\n max-width: 44vw;\n }\n\n @media (width >= 1280px) {\n max-width: 40vw;\n }\n}\n\n.base-variant {\n & > :first-child {\n max-height: 84vh;\n }\n\n /* fullScreenBreakpointMap['base'] = 720px (breakpoints.tablet) */\n @media (width <= 720px) {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n\n &,\n & > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n }\n\n @media (width >= 720px) and (width <= 960px) {\n max-width: 88vw;\n }\n\n @media (width >= 960px) and (width <= 1280px) {\n max-width: 72vw;\n }\n\n @media (width >= 1280px) {\n max-width: 52vw;\n }\n}\n\n.lg-variant {\n & > :first-child {\n max-height: 96vh;\n }\n\n /* fullScreenBreakpointMap['lg'] = 960px (breakpoints.lgTablet) */\n @media (width <= 960px) {\n margin: 0;\n width: 100%;\n max-width: 100vw;\n max-height: 100vh;\n\n &,\n & > :first-child {\n border-radius: 0;\n height: 100%;\n width: 100%;\n max-height: unset;\n }\n }\n\n @media (width >= 960px) and (width <= 1280px) {\n max-width: 88vw;\n }\n\n @media (width >= 1280px) {\n max-width: 80vw;\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AAAAA,WAAA,CAAA,4yLAAA;AAAA,kBAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,aAAA,CAAA,uBAAA,CAAA,qBAAA,CAAA,+BAAA,CAAA,WAAA,CAAA,qBAAA,CAAA,YAAA,CAAA,sBAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,YAAA,CAAA,sBAAA,CAAA,aAAA,CAAA,uBAAA,CAAA,YAAA,CAAA,uBAAA,CAAA,YAAA,CAAA,uBAAA,CAAA,cAAA,CAAA,yBAAA,CAAA,YAAA,CAAA,uBAAA;;;;"}
|
|
@@ -1,13 +1,46 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var
|
|
4
|
+
var framerMotion = require('framer-motion');
|
|
5
|
+
var buildClassnames = require('../../../../utils/buildClassnames.cjs');
|
|
6
|
+
require('uid/secure');
|
|
7
|
+
var Modal_module = require('../../Modal.module.scss.cjs');
|
|
5
8
|
|
|
6
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
7
10
|
|
|
8
11
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
// Animation configurations
|
|
14
|
+
const animations = {
|
|
15
|
+
leftDrawer: {
|
|
16
|
+
initial: { opacity: 0, x: -300, bounce: 0 },
|
|
17
|
+
exit: { opacity: 0, x: -300, bounce: 0 },
|
|
18
|
+
animate: { opacity: 1, x: 0, bounce: 0 },
|
|
19
|
+
},
|
|
20
|
+
rightDrawer: {
|
|
21
|
+
initial: { opacity: 0, x: 300, bounce: 0 },
|
|
22
|
+
exit: { opacity: 0, x: 300, bounce: 0 },
|
|
23
|
+
animate: { opacity: 1, x: 0, bounce: 0 },
|
|
24
|
+
},
|
|
25
|
+
modal: {
|
|
26
|
+
initial: { opacity: 0, y: -50, bounce: 0 },
|
|
27
|
+
exit: { opacity: 0, y: -50, bounce: 0 },
|
|
28
|
+
animate: { opacity: 1, y: 0, bounce: 0 },
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const Dialog = React__default.default.forwardRef(({ variant, displayMode, appearance, className, children, onClose, ...rest }, ref) => {
|
|
32
|
+
// framer-motion's type definitions for motion.dialog omit the standard
|
|
33
|
+
// HTML dialog onClose handler. Cast through a focused type to pass it
|
|
34
|
+
// safely to the underlying DOM element.
|
|
35
|
+
const closeHandler = { onClose };
|
|
36
|
+
return (React__default.default.createElement(framerMotion.motion.dialog, { ref: ref, className: buildClassnames.buildClassnames([
|
|
37
|
+
Modal_module.dialog,
|
|
38
|
+
Modal_module[displayMode],
|
|
39
|
+
Modal_module[`${variant}-variant`],
|
|
40
|
+
appearance === 'secondary' && Modal_module.secondaryAppearance,
|
|
41
|
+
className,
|
|
42
|
+
]), initial: animations[displayMode].initial, animate: animations[displayMode].animate, exit: animations[displayMode].exit, transition: { type: 'tween', duration: 0.25 }, ...closeHandler, ...rest }, children));
|
|
43
|
+
});
|
|
11
44
|
|
|
12
45
|
exports.Dialog = Dialog;
|
|
13
46
|
//# sourceMappingURL=Dialog.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.cjs","sources":["../../../../../src/components/Modal/components/Dialog/Dialog.tsx"],"sourcesContent":["import React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"Dialog.cjs","sources":["../../../../../src/components/Modal/components/Dialog/Dialog.tsx"],"sourcesContent":["import React from 'react';\nimport { motion } from 'framer-motion';\nimport { ModalAppearance, ModalTypes, ModalVariants } from '../../types';\nimport { buildClassnames } from '../../../../utils';\nimport modalStyles from '../../Modal.module.scss';\n\n// Animation configurations\nconst animations = {\n leftDrawer: {\n initial: { opacity: 0, x: -300, bounce: 0 },\n exit: { opacity: 0, x: -300, bounce: 0 },\n animate: { opacity: 1, x: 0, bounce: 0 },\n },\n rightDrawer: {\n initial: { opacity: 0, x: 300, bounce: 0 },\n exit: { opacity: 0, x: 300, bounce: 0 },\n animate: { opacity: 1, x: 0, bounce: 0 },\n },\n modal: {\n initial: { opacity: 0, y: -50, bounce: 0 },\n exit: { opacity: 0, y: -50, bounce: 0 },\n animate: { opacity: 1, y: 0, bounce: 0 },\n },\n};\n\ntype DialogProps = {\n variant: ModalVariants;\n displayMode: ModalTypes;\n appearance?: ModalAppearance;\n className?: string;\n children?: React.ReactNode;\n onClose?: () => void;\n onKeyDown?: React.KeyboardEventHandler<HTMLDialogElement>;\n onClick?: React.MouseEventHandler<HTMLDialogElement>;\n style?: React.CSSProperties;\n [key: `data-${string}`]: string | undefined;\n [key: `aria-${string}`]: string | undefined;\n};\n\nexport const Dialog = React.forwardRef<HTMLDialogElement, DialogProps>(\n ({ variant, displayMode, appearance, className, children, onClose, ...rest }, ref) => {\n // framer-motion's type definitions for motion.dialog omit the standard\n // HTML dialog onClose handler. Cast through a focused type to pass it\n // safely to the underlying DOM element.\n const closeHandler = { onClose } as Pick<\n React.DialogHTMLAttributes<HTMLDialogElement>,\n 'onClose'\n >;\n\n return (\n <motion.dialog\n ref={ref}\n className={buildClassnames([\n modalStyles.dialog,\n modalStyles[displayMode],\n modalStyles[`${variant}-variant`],\n appearance === 'secondary' && modalStyles.secondaryAppearance,\n className,\n ])}\n initial={animations[displayMode].initial}\n animate={animations[displayMode].animate}\n exit={animations[displayMode].exit}\n transition={{ type: 'tween', duration: 0.25 }}\n {...closeHandler}\n {...rest}\n >\n {children}\n </motion.dialog>\n );\n },\n);\n"],"names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AAO,EAAE,GAAG,IAAI,EAAE,EAAE,GAAG,KAAI;;;;AAInF,IAAA,MAAM,YAAY,GAAG,EAAE,OAAO,EAG7B;AAED,IAAA,QACEA,sBAAA,CAAA,aAAA,CAACC,mBAAM,CAAC,MAAM,EAAA,EACZ,GAAG,EAAE,GAAG,EACR,SAAS,EAAEC,+BAAe,CAAC;AACzB,YAAAC,YAAW,CAAC,MAAM;YAClBA,YAAW,CAAC,WAAW,CAAC;AACxB,YAAAA,YAAW,CAAC,CAAA,EAAG,OAAO,CAAA,QAAA,CAAU,CAAC;AACjC,YAAA,UAAU,KAAK,WAAW,IAAIA,YAAW,CAAC,mBAAmB;YAC7D,SAAS;SACV,CAAC,EACF,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,OAAO,EACxC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,OAAO,EACxC,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,EAClC,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KACzC,YAAY,EAAA,GACZ,IAAI,EAAA,EAEP,QAAQ,CACK;AAEpB,CAAC;;;;"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type ModifiedDialogProps = {
|
|
2
|
+
import { ModalAppearance, ModalTypes, ModalVariants } from '../../types';
|
|
3
|
+
type DialogProps = {
|
|
5
4
|
variant: ModalVariants;
|
|
5
|
+
displayMode: ModalTypes;
|
|
6
6
|
appearance?: ModalAppearance;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
className?: string;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLDialogElement>;
|
|
11
|
+
onClick?: React.MouseEventHandler<HTMLDialogElement>;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
[key: `data-${string}`]: string | undefined;
|
|
14
|
+
[key: `aria-${string}`]: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLDialogElement>>;
|
|
9
17
|
export {};
|
|
@@ -1,7 +1,40 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { motion } from 'framer-motion';
|
|
3
|
+
import { buildClassnames } from '../../../../utils/buildClassnames.js';
|
|
4
|
+
import 'uid/secure';
|
|
5
|
+
import modalStyles from '../../Modal.module.scss.js';
|
|
3
6
|
|
|
4
|
-
|
|
7
|
+
// Animation configurations
|
|
8
|
+
const animations = {
|
|
9
|
+
leftDrawer: {
|
|
10
|
+
initial: { opacity: 0, x: -300, bounce: 0 },
|
|
11
|
+
exit: { opacity: 0, x: -300, bounce: 0 },
|
|
12
|
+
animate: { opacity: 1, x: 0, bounce: 0 },
|
|
13
|
+
},
|
|
14
|
+
rightDrawer: {
|
|
15
|
+
initial: { opacity: 0, x: 300, bounce: 0 },
|
|
16
|
+
exit: { opacity: 0, x: 300, bounce: 0 },
|
|
17
|
+
animate: { opacity: 1, x: 0, bounce: 0 },
|
|
18
|
+
},
|
|
19
|
+
modal: {
|
|
20
|
+
initial: { opacity: 0, y: -50, bounce: 0 },
|
|
21
|
+
exit: { opacity: 0, y: -50, bounce: 0 },
|
|
22
|
+
animate: { opacity: 1, y: 0, bounce: 0 },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const Dialog = React__default.forwardRef(({ variant, displayMode, appearance, className, children, onClose, ...rest }, ref) => {
|
|
26
|
+
// framer-motion's type definitions for motion.dialog omit the standard
|
|
27
|
+
// HTML dialog onClose handler. Cast through a focused type to pass it
|
|
28
|
+
// safely to the underlying DOM element.
|
|
29
|
+
const closeHandler = { onClose };
|
|
30
|
+
return (React__default.createElement(motion.dialog, { ref: ref, className: buildClassnames([
|
|
31
|
+
modalStyles.dialog,
|
|
32
|
+
modalStyles[displayMode],
|
|
33
|
+
modalStyles[`${variant}-variant`],
|
|
34
|
+
appearance === 'secondary' && modalStyles.secondaryAppearance,
|
|
35
|
+
className,
|
|
36
|
+
]), initial: animations[displayMode].initial, animate: animations[displayMode].animate, exit: animations[displayMode].exit, transition: { type: 'tween', duration: 0.25 }, ...closeHandler, ...rest }, children));
|
|
37
|
+
});
|
|
5
38
|
|
|
6
39
|
export { Dialog };
|
|
7
40
|
//# sourceMappingURL=Dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sources":["../../../../../src/components/Modal/components/Dialog/Dialog.tsx"],"sourcesContent":["import React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../../../../../src/components/Modal/components/Dialog/Dialog.tsx"],"sourcesContent":["import React from 'react';\nimport { motion } from 'framer-motion';\nimport { ModalAppearance, ModalTypes, ModalVariants } from '../../types';\nimport { buildClassnames } from '../../../../utils';\nimport modalStyles from '../../Modal.module.scss';\n\n// Animation configurations\nconst animations = {\n leftDrawer: {\n initial: { opacity: 0, x: -300, bounce: 0 },\n exit: { opacity: 0, x: -300, bounce: 0 },\n animate: { opacity: 1, x: 0, bounce: 0 },\n },\n rightDrawer: {\n initial: { opacity: 0, x: 300, bounce: 0 },\n exit: { opacity: 0, x: 300, bounce: 0 },\n animate: { opacity: 1, x: 0, bounce: 0 },\n },\n modal: {\n initial: { opacity: 0, y: -50, bounce: 0 },\n exit: { opacity: 0, y: -50, bounce: 0 },\n animate: { opacity: 1, y: 0, bounce: 0 },\n },\n};\n\ntype DialogProps = {\n variant: ModalVariants;\n displayMode: ModalTypes;\n appearance?: ModalAppearance;\n className?: string;\n children?: React.ReactNode;\n onClose?: () => void;\n onKeyDown?: React.KeyboardEventHandler<HTMLDialogElement>;\n onClick?: React.MouseEventHandler<HTMLDialogElement>;\n style?: React.CSSProperties;\n [key: `data-${string}`]: string | undefined;\n [key: `aria-${string}`]: string | undefined;\n};\n\nexport const Dialog = React.forwardRef<HTMLDialogElement, DialogProps>(\n ({ variant, displayMode, appearance, className, children, onClose, ...rest }, ref) => {\n // framer-motion's type definitions for motion.dialog omit the standard\n // HTML dialog onClose handler. Cast through a focused type to pass it\n // safely to the underlying DOM element.\n const closeHandler = { onClose } as Pick<\n React.DialogHTMLAttributes<HTMLDialogElement>,\n 'onClose'\n >;\n\n return (\n <motion.dialog\n ref={ref}\n className={buildClassnames([\n modalStyles.dialog,\n modalStyles[displayMode],\n modalStyles[`${variant}-variant`],\n appearance === 'secondary' && modalStyles.secondaryAppearance,\n className,\n ])}\n initial={animations[displayMode].initial}\n animate={animations[displayMode].animate}\n exit={animations[displayMode].exit}\n transition={{ type: 'tween', duration: 0.25 }}\n {...closeHandler}\n {...rest}\n >\n {children}\n </motion.dialog>\n );\n },\n);\n"],"names":["React"],"mappings":";;;;;;AAMA;AACA,MAAM,UAAU,GAAG;AACjB,IAAA,UAAU,EAAE;AACV,QAAA,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE;AAC3C,QAAA,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE;AACxC,QAAA,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;AACzC,KAAA;AACD,IAAA,WAAW,EAAE;AACX,QAAA,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE;AAC1C,QAAA,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE;AACvC,QAAA,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,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|
@@ -14,6 +14,10 @@ export declare const PaginationButton: import("styled-components").StyledCompone
|
|
|
14
14
|
dropdown?: boolean | undefined;
|
|
15
15
|
loading?: boolean | undefined;
|
|
16
16
|
contentStyles?: import("react").CSSProperties | undefined;
|
|
17
|
+
as?: import("react").ElementType | undefined;
|
|
18
|
+
href?: string | undefined;
|
|
19
|
+
target?: string | undefined;
|
|
20
|
+
rel?: string | undefined;
|
|
17
21
|
} & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("../../hoc/withTokens").WithTokensProps & import("react").RefAttributes<HTMLButtonElement>>, any, {}, never>;
|
|
18
22
|
export declare const PageInput: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<{
|
|
19
23
|
rel?: string | undefined;
|
|
@@ -5,17 +5,19 @@ var reactPopper = require('react-popper');
|
|
|
5
5
|
var ResizeObserver = require('resize-observer-polyfill');
|
|
6
6
|
var Portal = require('../Portal/Portal.cjs');
|
|
7
7
|
var index = require('../../theme/index.cjs');
|
|
8
|
-
var
|
|
8
|
+
var buildClassnames = require('../../utils/buildClassnames.cjs');
|
|
9
9
|
var generateId = require('../../utils/generateId.cjs');
|
|
10
|
+
var assignCssVars = require('../../utils/assignCssVars.cjs');
|
|
10
11
|
var useUpdateAriaAnchor = require('./hooks/useUpdateAriaAnchor.cjs');
|
|
11
12
|
var useHandleFocus = require('./hooks/useHandleFocus.cjs');
|
|
13
|
+
var Popover_module = require('./Popover.module.scss.cjs');
|
|
12
14
|
|
|
13
15
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
14
16
|
|
|
15
17
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
16
18
|
var ResizeObserver__default = /*#__PURE__*/_interopDefaultCompat(ResizeObserver);
|
|
17
19
|
|
|
18
|
-
const Popover = ({ id: passedId, children, zIndex = index.theme.layers.popup, placement = 'bottom', anchorElement, rootElementRef, onShouldClose, style, disableFocusLock, removeBackdrop = false, useAnchorWidth, ignoreAriaWarnings, ...dialogProps }) => {
|
|
20
|
+
const Popover = ({ id: passedId, children, zIndex = index.theme.layers.popup, placement = 'bottom', anchorElement, rootElementRef, onShouldClose, style, disableFocusLock, removeBackdrop = false, useAnchorWidth, ignoreAriaWarnings, className, ...dialogProps }) => {
|
|
19
21
|
// Set up PopperJS
|
|
20
22
|
const [popperElement, setPopperElement] = React.useState(null);
|
|
21
23
|
const { styles, attributes, update } = reactPopper.usePopper(anchorElement, popperElement, { placement });
|
|
@@ -57,8 +59,9 @@ const Popover = ({ id: passedId, children, zIndex = index.theme.layers.popup, pl
|
|
|
57
59
|
};
|
|
58
60
|
}, [update]);
|
|
59
61
|
return (React__default.default.createElement(Portal.Portal, { rootElementRef: rootElementRef },
|
|
60
|
-
!removeBackdrop && (React__default.default.createElement(
|
|
61
|
-
React__default.default.createElement(
|
|
62
|
+
!removeBackdrop && (React__default.default.createElement("div", { className: Popover_module.backdrop, style: assignCssVars.assignCssVars({ zIndex }), onClick: onClose, "data-testid": "popover-backdrop" })),
|
|
63
|
+
React__default.default.createElement("dialog", { open: true, id: id, "data-dialog-type": "popover", className: buildClassnames.buildClassnames([Popover_module.dialog, className]), ref: setPopperElement, style: {
|
|
64
|
+
...assignCssVars.assignCssVars({ zIndex: zIndex + 1 }),
|
|
62
65
|
...styles.popper,
|
|
63
66
|
...style,
|
|
64
67
|
...(useAnchorWidth ? { minWidth: anchorElement === null || anchorElement === void 0 ? void 0 : anchorElement.clientWidth } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.cjs","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useState, useEffect, useMemo } from 'react';\nimport { usePopper } from 'react-popper';\nimport ResizeObserver from 'resize-observer-polyfill';\n\nimport { Portal } from '../Portal';\nimport { theme } from '../../theme';\nimport {
|
|
1
|
+
{"version":3,"file":"Popover.cjs","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useState, useEffect, useMemo } from 'react';\nimport { usePopper } from 'react-popper';\nimport ResizeObserver from 'resize-observer-polyfill';\n\nimport { Portal } from '../Portal';\nimport { theme } from '../../theme';\nimport { buildClassnames, generateId, assignCssVars } from '../../utils';\nimport { useUpdateAriaAnchor } from './hooks/useUpdateAriaAnchor';\nimport { PopoverProps } from './types';\nimport { useHandleFocus } from './hooks/useHandleFocus';\nimport popoverStyles from './Popover.module.scss';\n\nexport const Popover = ({\n id: passedId,\n children,\n zIndex = theme.layers.popup,\n placement = 'bottom',\n anchorElement,\n rootElementRef,\n onShouldClose,\n style,\n disableFocusLock,\n removeBackdrop = false,\n useAnchorWidth,\n ignoreAriaWarnings,\n className,\n ...dialogProps\n}: PopoverProps) => {\n // Set up PopperJS\n const [popperElement, setPopperElement] = useState<HTMLDialogElement | null>(null);\n const { styles, attributes, update } = usePopper(anchorElement, popperElement, { placement });\n\n // Setup popover id to use passed, or generate its' own.\n const id = useMemo(() => passedId || generateId('popover'), [passedId]);\n\n // Check and update aria for anchor, only works once this has rendered for the first time though.\n useUpdateAriaAnchor({ anchorElement, popoverId: id, ignoreAriaWarnings });\n\n const onClose = () => {\n anchorElement?.focus();\n onShouldClose?.();\n };\n\n const { handleKeyDown } = useHandleFocus({\n popperElement,\n anchorElement,\n onClose,\n disableFocusLock,\n });\n\n /**\n * When content size is changed, force popper update\n */\n useEffect(() => {\n if (!update || !popperElement) return undefined;\n const resizeObserver = new ResizeObserver(update);\n resizeObserver.observe(popperElement);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [update, popperElement]);\n\n /**\n * When window is resized, force popper update\n */\n useEffect(() => {\n if (!update) return undefined;\n window.addEventListener('resize', update);\n\n return () => {\n window.removeEventListener('resize', update);\n };\n }, [update]);\n\n return (\n <Portal rootElementRef={rootElementRef}>\n {!removeBackdrop && (\n <div\n className={popoverStyles.backdrop}\n style={assignCssVars({ zIndex })}\n onClick={onClose}\n data-testid=\"popover-backdrop\"\n />\n )}\n <dialog\n open\n id={id}\n data-dialog-type=\"popover\"\n className={buildClassnames([popoverStyles.dialog, className])}\n ref={setPopperElement}\n style={{\n ...assignCssVars({ zIndex: zIndex + 1 }), // Dialog stacks above its backdrop\n ...styles.popper,\n ...style,\n ...(useAnchorWidth ? { minWidth: anchorElement?.clientWidth } : {}),\n }}\n onKeyDown={handleKeyDown}\n {...attributes.popper}\n {...dialogProps}\n >\n {children}\n </dialog>\n </Portal>\n );\n};\n"],"names":["theme","useState","usePopper","useMemo","generateId","useUpdateAriaAnchor","useHandleFocus","useEffect","ResizeObserver","React","Portal","popoverStyles","assignCssVars","buildClassnames"],"mappings":";;;;;;;;;;;;;;;;;;;MAYa,OAAO,GAAG,CAAC,EACtB,EAAE,EAAE,QAAQ,EACZ,QAAQ,EACR,MAAM,GAAGA,WAAK,CAAC,MAAM,CAAC,KAAK,EAC3B,SAAS,GAAG,QAAQ,EACpB,aAAa,EACb,cAAc,EACd,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,cAAc,GAAG,KAAK,EACtB,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,GAAG,WAAW,EACD,KAAI;;IAEjB,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGC,cAAQ,CAA2B,IAAI,CAAC;AAClF,IAAA,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAGC,qBAAS,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,SAAS,EAAE,CAAC;;AAG7F,IAAA,MAAM,EAAE,GAAGC,aAAO,CAAC,MAAM,QAAQ,IAAIC,qBAAU,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;;IAGvEC,uCAAmB,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,EAAE,kBAAkB,EAAE,CAAC;IAEzE,MAAM,OAAO,GAAG,MAAK;AACnB,QAAA,aAAa,aAAb,aAAa,KAAA,MAAA,GAAA,MAAA,GAAb,aAAa,CAAE,KAAK,EAAE;AACtB,QAAA,aA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I,EAAA,IAAA,EACJ,EAAE,EAAE,EAAE,EAAA,kBAAA,EACW,SAAS,EAC1B,SAAS,EAAEI,+BAAe,CAAC,CAACF,cAAa,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,EAC7D,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE;gBACL,GAAGC,2BAAa,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;gBACxC,GAAG,MAAM,CAAC,MAAM;AAChB,gBAAA,GAAG,KAAK;gBACR,IAAI,cAAc,GAAG,EAAE,QAAQ,EAAE,aAAa,KAAA,IAAA,IAAb,aAAa,KAAA,MAAA,GAAA,MAAA,GAAb,aAAa,CAAE,WAAW,EAAE,GAAG,EAAE,CAAC;AACpE,aAAA,EACD,SAAS,EAAE,aAAa,EAAA,GACpB,UAAU,CAAC,MAAM,EAAA,GACjB,WAAW,EAAA,EAEd,QAAQ,CACF,CACF;AAEb;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PopoverProps } from './types';
|
|
3
|
-
export declare const Popover: ({ id: passedId, children, zIndex, placement, anchorElement, rootElementRef, onShouldClose, style, disableFocusLock, removeBackdrop, useAnchorWidth, ignoreAriaWarnings, ...dialogProps }: PopoverProps) => React.JSX.Element;
|
|
3
|
+
export declare const Popover: ({ id: passedId, children, zIndex, placement, anchorElement, rootElementRef, onShouldClose, style, disableFocusLock, removeBackdrop, useAnchorWidth, ignoreAriaWarnings, className, ...dialogProps }: PopoverProps) => React.JSX.Element;
|
|
@@ -3,12 +3,14 @@ import { usePopper } from 'react-popper';
|
|
|
3
3
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
4
4
|
import { Portal } from '../Portal/Portal.js';
|
|
5
5
|
import { theme } from '../../theme/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { buildClassnames } from '../../utils/buildClassnames.js';
|
|
7
7
|
import { generateId } from '../../utils/generateId.js';
|
|
8
|
+
import { assignCssVars } from '../../utils/assignCssVars.js';
|
|
8
9
|
import { useUpdateAriaAnchor } from './hooks/useUpdateAriaAnchor.js';
|
|
9
10
|
import { useHandleFocus } from './hooks/useHandleFocus.js';
|
|
11
|
+
import popoverStyles from './Popover.module.scss.js';
|
|
10
12
|
|
|
11
|
-
const Popover = ({ id: passedId, children, zIndex = theme.layers.popup, placement = 'bottom', anchorElement, rootElementRef, onShouldClose, style, disableFocusLock, removeBackdrop = false, useAnchorWidth, ignoreAriaWarnings, ...dialogProps }) => {
|
|
13
|
+
const Popover = ({ id: passedId, children, zIndex = theme.layers.popup, placement = 'bottom', anchorElement, rootElementRef, onShouldClose, style, disableFocusLock, removeBackdrop = false, useAnchorWidth, ignoreAriaWarnings, className, ...dialogProps }) => {
|
|
12
14
|
// Set up PopperJS
|
|
13
15
|
const [popperElement, setPopperElement] = useState(null);
|
|
14
16
|
const { styles, attributes, update } = usePopper(anchorElement, popperElement, { placement });
|
|
@@ -50,8 +52,9 @@ const Popover = ({ id: passedId, children, zIndex = theme.layers.popup, placemen
|
|
|
50
52
|
};
|
|
51
53
|
}, [update]);
|
|
52
54
|
return (React__default.createElement(Portal, { rootElementRef: rootElementRef },
|
|
53
|
-
!removeBackdrop && (React__default.createElement(
|
|
54
|
-
React__default.createElement(
|
|
55
|
+
!removeBackdrop && (React__default.createElement("div", { className: popoverStyles.backdrop, style: assignCssVars({ zIndex }), onClick: onClose, "data-testid": "popover-backdrop" })),
|
|
56
|
+
React__default.createElement("dialog", { open: true, id: id, "data-dialog-type": "popover", className: buildClassnames([popoverStyles.dialog, className]), ref: setPopperElement, style: {
|
|
57
|
+
...assignCssVars({ zIndex: zIndex + 1 }),
|
|
55
58
|
...styles.popper,
|
|
56
59
|
...style,
|
|
57
60
|
...(useAnchorWidth ? { minWidth: anchorElement === null || anchorElement === void 0 ? void 0 : anchorElement.clientWidth } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useState, useEffect, useMemo } from 'react';\nimport { usePopper } from 'react-popper';\nimport ResizeObserver from 'resize-observer-polyfill';\n\nimport { Portal } from '../Portal';\nimport { theme } from '../../theme';\nimport {
|
|
1
|
+
{"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useState, useEffect, useMemo } from 'react';\nimport { usePopper } from 'react-popper';\nimport ResizeObserver from 'resize-observer-polyfill';\n\nimport { Portal } from '../Portal';\nimport { theme } from '../../theme';\nimport { buildClassnames, generateId, assignCssVars } from '../../utils';\nimport { useUpdateAriaAnchor } from './hooks/useUpdateAriaAnchor';\nimport { PopoverProps } from './types';\nimport { useHandleFocus } from './hooks/useHandleFocus';\nimport popoverStyles from './Popover.module.scss';\n\nexport const Popover = ({\n id: passedId,\n children,\n zIndex = theme.layers.popup,\n placement = 'bottom',\n anchorElement,\n rootElementRef,\n onShouldClose,\n style,\n disableFocusLock,\n removeBackdrop = false,\n useAnchorWidth,\n ignoreAriaWarnings,\n className,\n ...dialogProps\n}: PopoverProps) => {\n // Set up PopperJS\n const [popperElement, setPopperElement] = useState<HTMLDialogElement | null>(null);\n const { styles, attributes, update } = usePopper(anchorElement, popperElement, { placement });\n\n // Setup popover id to use passed, or generate its' own.\n const id = useMemo(() => passedId || generateId('popover'), [passedId]);\n\n // Check and update aria for anchor, only works once this has rendered for the first time though.\n useUpdateAriaAnchor({ anchorElement, popoverId: id, ignoreAriaWarnings });\n\n const onClose = () => {\n anchorElement?.focus();\n onShouldClose?.();\n };\n\n const { handleKeyDown } = useHandleFocus({\n popperElement,\n anchorElement,\n onClose,\n disableFocusLock,\n });\n\n /**\n * When content size is changed, force popper update\n */\n useEffect(() => {\n if (!update || !popperElement) return undefined;\n const resizeObserver = new ResizeObserver(update);\n resizeObserver.observe(popperElement);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [update, popperElement]);\n\n /**\n * When window is resized, force popper update\n */\n useEffect(() => {\n if (!update) return undefined;\n window.addEventListener('resize', update);\n\n return () => {\n window.removeEventListener('resize', update);\n };\n }, [update]);\n\n return (\n <Portal rootElementRef={rootElementRef}>\n {!removeBackdrop && (\n <div\n className={popoverStyles.backdrop}\n style={assignCssVars({ zIndex })}\n onClick={onClose}\n data-testid=\"popover-backdrop\"\n />\n )}\n <dialog\n open\n id={id}\n data-dialog-type=\"popover\"\n className={buildClassnames([popoverStyles.dialog, className])}\n ref={setPopperElement}\n style={{\n ...assignCssVars({ zIndex: zIndex + 1 }), // Dialog stacks above its backdrop\n ...styles.popper,\n ...style,\n ...(useAnchorWidth ? { minWidth: anchorElement?.clientWidth } : {}),\n }}\n onKeyDown={handleKeyDown}\n {...attributes.popper}\n {...dialogProps}\n >\n {children}\n </dialog>\n </Portal>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;MAYa,OAAO,GAAG,CAAC,EACtB,EAAE,EAAE,QAAQ,EACZ,QAAQ,EACR,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAC3B,SAAS,GAAG,QAAQ,EACpB,aAAa,EACb,cAAc,EACd,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,cAAc,GAAG,KAAK,EACtB,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,GAAG,WAAW,EACD,KAAI;;IAEjB,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAA2B,IAAI,CAAC;AAClF,IAAA,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,SAAS,EAAE,CAAC;;AAG7F,IAAA,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,QAAQ,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;;IAGvE,mBAAmB,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,EAAE,kBAAkB,EAAE,CAAC;IAEzE,M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EAAE,OAAO,EAAA,aAAA,EACJ,kBAAkB,EAAA,CAC9B,CACH;QACDA,cAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EACE,IAAI,EAAA,IAAA,EACJ,EAAE,EAAE,EAAE,EAAA,kBAAA,EACW,SAAS,EAC1B,SAAS,EAAE,eAAe,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,EAC7D,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE;gBACL,GAAG,aAAa,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;gBACxC,GAAG,MAAM,CAAC,MAAM;AAChB,gBAAA,GAAG,KAAK;gBACR,IAAI,cAAc,GAAG,EAAE,QAAQ,EAAE,aAAa,KAAA,IAAA,IAAb,aAAa,KAAA,MAAA,GAAA,MAAA,GAAb,aAAa,CAAE,WAAW,EAAE,GAAG,EAAE,CAAC;AACpE,aAAA,EACD,SAAS,EAAE,aAAa,EAAA,GACpB,UAAU,CAAC,MAAM,EAAA,GACjB,WAAW,EAAA,EAEd,QAAQ,CACF,CACF;AAEb;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
|
+
|
|
5
|
+
___$insertStyle("._dialog_xax8f_1 {\n z-index: var(--z-index);\n /* Remove browser default styling of HTML Dialog. */\n padding: 0;\n margin: 0;\n border: none;\n background: transparent;\n}\n\n._backdrop_xax8f_10 {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: var(--z-index);\n}");
|
|
6
|
+
var popoverStyles = {"dialog":"_dialog_xax8f_1","backdrop":"_backdrop_xax8f_10"};
|
|
7
|
+
|
|
8
|
+
module.exports = popoverStyles;
|
|
9
|
+
//# sourceMappingURL=Popover.module.scss.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popover.module.scss.cjs","sources":["../../../src/components/Popover/Popover.module.scss"],"sourcesContent":[".dialog {\n z-index: var(--z-index);\n\n /* Remove browser default styling of HTML Dialog. */\n padding: 0;\n margin: 0;\n border: none;\n background: transparent;\n}\n\n.backdrop {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: var(--z-index);\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,mTAAA;AAEA,oBAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,UAAA,CAAA,oBAAA;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import insertStyle from '../../_virtual/____insertStyle.js';
|
|
2
|
+
|
|
3
|
+
insertStyle("._dialog_xax8f_1 {\n z-index: var(--z-index);\n /* Remove browser default styling of HTML Dialog. */\n padding: 0;\n margin: 0;\n border: none;\n background: transparent;\n}\n\n._backdrop_xax8f_10 {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: var(--z-index);\n}");
|
|
4
|
+
var popoverStyles = {"dialog":"_dialog_xax8f_1","backdrop":"_backdrop_xax8f_10"};
|
|
5
|
+
|
|
6
|
+
export { popoverStyles as default };
|
|
7
|
+
//# sourceMappingURL=Popover.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popover.module.scss.js","sources":["../../../src/components/Popover/Popover.module.scss"],"sourcesContent":[".dialog {\n z-index: var(--z-index);\n\n /* Remove browser default styling of HTML Dialog. */\n padding: 0;\n margin: 0;\n border: none;\n background: transparent;\n}\n\n.backdrop {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: var(--z-index);\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,mTAAA;AAEA,oBAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,UAAA,CAAA,oBAAA;;;;"}
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var framerMotion = require('framer-motion');
|
|
5
|
-
var styled = require('./components/styled.cjs');
|
|
6
5
|
var TooltipPopover = require('./components/TooltipPopover.cjs');
|
|
7
6
|
var Portal = require('../Portal/Portal.cjs');
|
|
7
|
+
var buildClassnames = require('../../utils/buildClassnames.cjs');
|
|
8
|
+
require('uid/secure');
|
|
9
|
+
var Tooltip_module = require('./Tooltip.module.scss.cjs');
|
|
8
10
|
|
|
9
11
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
10
12
|
|
|
@@ -13,26 +15,28 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
13
15
|
const WithOptionalPortal = ({ usePortal = false, children,
|
|
14
16
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
15
17
|
}) => (usePortal ? React__default.default.createElement(Portal.Portal, null, children) : React__default.default.createElement(React__default.default.Fragment, null, children));
|
|
16
|
-
const Tooltip = ({ children, text, content, config, reversed = false, className, withTriangle, initialShouldShow = false, useReactPortal = true, }) => {
|
|
18
|
+
const Tooltip = ({ children, text, content, config, reversed = false, className, hoverableClassName, withTriangle, initialShouldShow = false, useReactPortal = true, }) => {
|
|
17
19
|
const [shouldShow, setShouldShow] = React.useState(initialShouldShow);
|
|
18
20
|
const [hoverableElement, setHoverableElement] = React.useState(null);
|
|
19
|
-
const classNames = {
|
|
20
|
-
container: className && `${className} ${className}-container`,
|
|
21
|
-
tip: className && `${className}-tip`,
|
|
22
|
-
wrap: className && `${className}-wrap`,
|
|
23
|
-
triangle: className && `${className}-triangle`,
|
|
24
|
-
hoverable: className && `${className}-hoverable`,
|
|
25
|
-
};
|
|
26
21
|
const hasText = text ? text.trim().length > 0 : false;
|
|
27
22
|
const hasContent = !!(content || hasText);
|
|
23
|
+
// Backward-compatible suffix classes for monolith consumers that
|
|
24
|
+
// target sub-elements via the className prefix convention.
|
|
25
|
+
const legacyClassNames = className
|
|
26
|
+
? {
|
|
27
|
+
tip: `${className}-tip`,
|
|
28
|
+
wrap: `${className}-wrap`,
|
|
29
|
+
triangle: `${className}-triangle`,
|
|
30
|
+
}
|
|
31
|
+
: undefined;
|
|
28
32
|
if (!hasContent)
|
|
29
33
|
return children;
|
|
30
34
|
const show = () => setShouldShow(true);
|
|
31
35
|
const hide = () => setShouldShow(false);
|
|
32
|
-
return (React__default.default.createElement(
|
|
36
|
+
return (React__default.default.createElement("div", { className: buildClassnames.buildClassnames([Tooltip_module.container, className, className && `${className}-container`]) },
|
|
33
37
|
React__default.default.createElement(framerMotion.AnimatePresence, null, shouldShow && (React__default.default.createElement(WithOptionalPortal, { usePortal: useReactPortal },
|
|
34
|
-
React__default.default.createElement(TooltipPopover.TooltipPopover, { key: "tooltip-popover",
|
|
35
|
-
React__default.default.createElement(
|
|
38
|
+
React__default.default.createElement(TooltipPopover.TooltipPopover, { key: "tooltip-popover", hoverableElement: hoverableElement, config: config, reversed: reversed, withTriangle: withTriangle, text: text, content: content, legacyClassNames: legacyClassNames })))),
|
|
39
|
+
React__default.default.createElement("div", { ref: setHoverableElement, className: buildClassnames.buildClassnames([Tooltip_module.hoverable, hoverableClassName, className && `${className}-hoverable`]), onMouseEnter: show, onMouseLeave: hide }, children)));
|
|
36
40
|
};
|
|
37
41
|
|
|
38
42
|
exports.Tooltip = Tooltip;
|