@pega/cosmos-react-core 9.33.1 → 9.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.styles.js +9 -0
- package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts +3 -2
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +84 -186
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +2 -7
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +30 -124
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/TopNavDrawerProvider.d.ts +7 -0
- package/lib/components/AppShell/TopNavDrawerProvider.d.ts.map +1 -0
- package/lib/components/AppShell/TopNavDrawerProvider.js +28 -0
- package/lib/components/AppShell/TopNavDrawerProvider.js.map +1 -0
- package/lib/components/AppShell/TouchAppShell.d.ts +15 -0
- package/lib/components/AppShell/TouchAppShell.d.ts.map +1 -0
- package/lib/components/AppShell/TouchAppShell.js +129 -0
- package/lib/components/AppShell/TouchAppShell.js.map +1 -0
- package/lib/components/AppShell/TouchAppShell.styles.d.ts +207 -0
- package/lib/components/AppShell/TouchAppShell.styles.d.ts.map +1 -0
- package/lib/components/AppShell/TouchAppShell.styles.js +188 -0
- package/lib/components/AppShell/TouchAppShell.styles.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.js +42 -11
- package/lib/components/Dialog/TouchDialog.js.map +1 -1
- package/lib/components/Dialog/TouchDialog.styles.d.ts +7 -0
- package/lib/components/Dialog/TouchDialog.styles.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.styles.js +15 -0
- package/lib/components/Dialog/TouchDialog.styles.js.map +1 -1
- package/lib/components/Dialog/TouchDialog.types.d.ts +10 -2
- package/lib/components/Dialog/TouchDialog.types.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.types.js.map +1 -1
- package/lib/components/Modal/DockedModals.d.ts.map +1 -1
- package/lib/components/Modal/DockedModals.js +3 -2
- package/lib/components/Modal/DockedModals.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,40 +1,46 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import { useConsolidatedRef, useConfiguration, useFocusTrap, useI18n, useTestIds, useEscape, useUID } from '../../hooks';
|
|
4
|
+
import { useConsolidatedRef, useConfiguration, useFocusTrap, useI18n, useTestIds, useEscape, useUID, useEvent } from '../../hooks';
|
|
5
5
|
import Button from '../Button';
|
|
6
6
|
import Icon, { registerIcon } from '../Icon';
|
|
7
7
|
import Text from '../Text';
|
|
8
8
|
import * as caretUp from '../Icon/icons/caret-up.icon';
|
|
9
9
|
import * as timesIcon from '../Icon/icons/times.icon';
|
|
10
10
|
import Flex from '../Flex';
|
|
11
|
-
import Backdrop from '../Backdrop';
|
|
12
11
|
import { focusNonInteractiveElement, getActiveElement, isInstance } from '../../utils';
|
|
13
12
|
import Progress from '../Progress';
|
|
14
|
-
import { StyledTouchDialogContent, StyledTouchDialogHeader, StyledTouchDialog, StyledExpandCollapse } from './TouchDialog.styles';
|
|
13
|
+
import { StyledTouchDialogContent, StyledTouchDialogHeader, StyledTouchDialog, StyledTouchDialogBackdrop, StyledExpandCollapse } from './TouchDialog.styles';
|
|
15
14
|
import { getTouchDialogTestIds } from './TouchDialog.test-ids';
|
|
16
15
|
import { StyledChildrenWrap } from './Dialog.styles';
|
|
17
16
|
registerIcon(caretUp, timesIcon);
|
|
18
17
|
const drawerSizeMapping = {
|
|
19
18
|
auto: 'auto',
|
|
19
|
+
compact: 'var(--touch-dialog-compact-height)',
|
|
20
20
|
half: '50dvh',
|
|
21
21
|
full: '90dvh'
|
|
22
22
|
};
|
|
23
|
-
export const TouchDialog = forwardRef(function TouchDialog({ open, onDismiss: onDismissProp, children, size = 'half', onBeforeOpen, onAfterOpen: onAfterOpenProp, onBeforeClose, onAfterClose, heading, progress: progressProp, testId, ...restProps }, ref) {
|
|
23
|
+
export const TouchDialog = forwardRef(function TouchDialog({ open, onDismiss: onDismissProp, children, size = 'half', onBeforeOpen, onAfterOpen: onAfterOpenProp, onBeforeClose, onAfterClose, heading, progress: progressProp, outerClickAction = 'close', testId, ...restProps }, ref) {
|
|
24
24
|
const dialogRef = useConsolidatedRef(ref);
|
|
25
|
+
const backdropRef = useRef(null);
|
|
25
26
|
const t = useI18n();
|
|
26
27
|
const { portalTarget } = useConfiguration();
|
|
27
28
|
const headingRef = useRef(null);
|
|
28
|
-
const
|
|
29
|
+
const isFullCompact = size === 'full-compact';
|
|
30
|
+
const [drawerSize, setDrawerSize] = useState(isFullCompact ? 'full' : size);
|
|
29
31
|
const headingId = useUID();
|
|
30
32
|
const testIds = useTestIds(testId, getTouchDialogTestIds);
|
|
31
33
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
32
34
|
const returnRef = useRef(null);
|
|
33
35
|
useEffect(() => {
|
|
34
|
-
setDrawerSize(size);
|
|
36
|
+
setDrawerSize(isFullCompact ? 'full' : size);
|
|
35
37
|
}, [size]);
|
|
36
|
-
const isAutoSize = size === 'auto';
|
|
37
|
-
|
|
38
|
+
const isAutoSize = size === 'auto' || isFullCompact;
|
|
39
|
+
const resetSize = useCallback(() => {
|
|
40
|
+
setDrawerSize(isFullCompact ? 'compact' : size);
|
|
41
|
+
}, [size]);
|
|
42
|
+
const shouldTrapFocus = open && drawerOpen && !(isFullCompact && drawerSize === 'compact');
|
|
43
|
+
useFocusTrap(shouldTrapFocus ? dialogRef : null, false, [shouldTrapFocus]);
|
|
38
44
|
const setFocus = useCallback(() => {
|
|
39
45
|
if (progressProp || !drawerOpen || dialogRef.current?.contains(getActiveElement()))
|
|
40
46
|
return;
|
|
@@ -49,6 +55,14 @@ export const TouchDialog = forwardRef(function TouchDialog({ open, onDismiss: on
|
|
|
49
55
|
setDrawerOpen(false);
|
|
50
56
|
onDismissProp?.();
|
|
51
57
|
}, [onDismissProp]);
|
|
58
|
+
const onOuterClick = useCallback(() => {
|
|
59
|
+
if (outerClickAction === 'reset-size') {
|
|
60
|
+
resetSize();
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
onDismiss();
|
|
64
|
+
}
|
|
65
|
+
}, [onDismiss, outerClickAction, resetSize]);
|
|
52
66
|
const onAfterOpen = useCallback(() => {
|
|
53
67
|
onAfterOpenProp?.();
|
|
54
68
|
setFocus();
|
|
@@ -64,21 +78,38 @@ export const TouchDialog = forwardRef(function TouchDialog({ open, onDismiss: on
|
|
|
64
78
|
e.stopPropagation();
|
|
65
79
|
}, dialogRef, [onDismiss]);
|
|
66
80
|
const progress = (_jsx(Progress, { visible: !!progressProp, focusOnVisible: true, placement: 'local', message: typeof progressProp === 'string' ? progressProp : undefined }));
|
|
81
|
+
const isCompact = isFullCompact && drawerSize === 'compact';
|
|
82
|
+
const hasContent = children !== undefined || progressProp !== undefined;
|
|
67
83
|
const dismissButton = (_jsx(Button, { "data-testid": testIds.dismiss, variant: 'simple', icon: true, label: t('dismiss'), onClick: onDismiss, children: _jsx(Icon, { name: 'times' }) }));
|
|
68
|
-
|
|
84
|
+
useEvent('click', e => {
|
|
85
|
+
if (open && e.target === backdropRef.current) {
|
|
86
|
+
onOuterClick();
|
|
87
|
+
}
|
|
88
|
+
}, { target: backdropRef, dependencies: [onOuterClick, open] });
|
|
89
|
+
const content = (_jsx(StyledTouchDialogBackdrop, { ref: backdropRef, open: open, "$compact": isCompact, onBeforeTransitionIn: () => {
|
|
69
90
|
setDrawerOpen(true);
|
|
91
|
+
if (isFullCompact)
|
|
92
|
+
setDrawerSize('full');
|
|
70
93
|
returnRef.current = getActiveElement();
|
|
71
94
|
onBeforeOpen?.();
|
|
72
95
|
}, onBeforeTransitionOut: () => {
|
|
73
96
|
setDrawerOpen(false);
|
|
74
|
-
setDrawerSize(size);
|
|
75
97
|
}, onAfterTransitionOut: () => {
|
|
98
|
+
resetSize();
|
|
76
99
|
if (isInstance(returnRef.current, HTMLElement) &&
|
|
77
100
|
dialogRef.current?.contains(getActiveElement())) {
|
|
78
101
|
returnRef.current.focus();
|
|
79
102
|
}
|
|
80
103
|
onAfterClose?.();
|
|
81
|
-
}, children: _jsxs(StyledTouchDialog, { "data-testid": testIds.root, ...restProps, ref: dialogRef, open: drawerOpen, placement: 'bottom', position: 'fixed', size: drawerSizeMapping[drawerSize], shadow: true, onAfterOpen: onAfterOpen, onBeforeClose: onBeforeClose,
|
|
104
|
+
}, children: _jsxs(StyledTouchDialog, { "data-testid": testIds.root, ...restProps, ref: dialogRef, open: drawerOpen, placement: 'bottom', position: 'fixed', size: drawerSizeMapping[drawerSize], shadow: true, onAfterOpen: onAfterOpen, onBeforeClose: onBeforeClose, role: 'dialog', "aria-modal": shouldTrapFocus ? 'true' : undefined, "aria-labelledby": heading ? headingId : undefined, "aria-busy": !!progressProp, children: [_jsxs(Flex, { container: { direction: 'row', justify: 'between', alignItems: 'center' }, as: StyledTouchDialogHeader, children: [heading && (_jsx(Text, { variant: 'h2', ref: headingRef, id: headingId, children: heading })), dismissButton] }), hasContent && (_jsxs(Flex, { as: StyledTouchDialogContent, container: { gap: 1, direction: 'column' }, hidden: isCompact && !progressProp, children: [children && (_jsx(StyledChildrenWrap, { inert: progressProp || isCompact ? '' : undefined, hidden: isCompact, children: children })), progress] })), (!isAutoSize || isFullCompact) && (_jsx(StyledExpandCollapse, { onToggle: () => {
|
|
105
|
+
setDrawerSize(prev => {
|
|
106
|
+
if (isFullCompact)
|
|
107
|
+
return prev === 'compact' ? 'full' : 'compact';
|
|
108
|
+
if (prev === 'full')
|
|
109
|
+
return 'half';
|
|
110
|
+
return 'full';
|
|
111
|
+
});
|
|
112
|
+
}, expanded: drawerSize === 'full', compact: true, iconOnly: true }))] }) }));
|
|
82
113
|
return portalTarget ? createPortal(content, portalTarget) : content;
|
|
83
114
|
});
|
|
84
115
|
export default TouchDialog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TouchDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/TouchDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,UAAU,EACV,SAAS,EACT,MAAM,EACP,MAAM,aAAa,CAAC;AAErB,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAEjC,MAAM,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om';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n useConsolidatedRef,\n useConfiguration,\n useFocusTrap,\n useI18n,\n useTestIds,\n useEscape,\n useUID\n} from '../../hooks';\nimport type { ForwardRefForwardPropsComponent } from '../../types';\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport Text from '../Text';\nimport * as caretUp from '../Icon/icons/caret-up.icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport Flex from '../Flex';\nimport Backdrop from '../Backdrop';\nimport { focusNonInteractiveElement, getActiveElement, isInstance } from '../../utils';\nimport Progress from '../Progress';\n\nimport {\n StyledTouchDialogContent,\n StyledTouchDialogHeader,\n StyledTouchDialog,\n StyledExpandCollapse\n} from './TouchDialog.styles';\nimport { getTouchDialogTestIds } from './TouchDialog.test-ids';\nimport type { TouchDialogProps } from './TouchDialog.types';\nimport { StyledChildrenWrap } from './Dialog.styles';\n\nregisterIcon(caretUp, timesIcon);\n\nconst drawerSizeMapping = {\n auto: 'auto',\n half: '50dvh',\n full: '90dvh'\n} as const;\n\nexport const TouchDialog: ForwardRefForwardPropsComponent<TouchDialogProps> = forwardRef(\n function TouchDialog(\n {\n open,\n onDismiss: onDismissProp,\n children,\n size = 'half',\n onBeforeOpen,\n onAfterOpen: onAfterOpenProp,\n onBeforeClose,\n onAfterClose,\n heading,\n progress: progressProp,\n testId,\n ...restProps\n }: PropsWithoutRef<TouchDialogProps>,\n ref: TouchDialogProps['ref']\n ) {\n const dialogRef = useConsolidatedRef(ref);\n const t = useI18n();\n const { portalTarget } = useConfiguration();\n const headingRef = useRef<HTMLHeadingElement>(null);\n const [drawerSize, setDrawerSize] = useState(size);\n const headingId = useUID();\n const testIds = useTestIds(testId, getTouchDialogTestIds);\n const [drawerOpen, setDrawerOpen] = useState(false);\n const returnRef = useRef<Element | null>(null);\n\n useEffect(() => {\n setDrawerSize(size);\n }, [size]);\n\n const isAutoSize = size === 'auto';\n\n useFocusTrap(open && drawerOpen ? dialogRef : null, false, [open, drawerOpen]);\n\n const setFocus = useCallback(() => {\n if (progressProp || !drawerOpen || dialogRef.current?.contains(getActiveElement())) return;\n if (headingRef.current) {\n focusNonInteractiveElement(headingRef.current, heading);\n } else if (dialogRef.current) {\n focusNonInteractiveElement(dialogRef.current, heading);\n }\n }, [progressProp, drawerOpen, heading]);\n\n const onDismiss = useCallback(() => {\n setDrawerOpen(false);\n onDismissProp?.();\n }, [onDismissProp]);\n\n const onAfterOpen = useCallback(() => {\n onAfterOpenProp?.();\n setFocus();\n }, [onAfterOpenProp, setFocus]);\n\n useEffect(() => {\n if (!progressProp) {\n // Delay focus to the next tick to allow progress to unmount so setFocus do not bail out\n setTimeout(setFocus, 0);\n }\n }, [progressProp, setFocus]);\n\n useEscape(\n e => {\n onDismiss?.();\n e.stopPropagation();\n },\n dialogRef,\n [onDismiss]\n );\n\n const progress = (\n <Progress\n visible={!!progressProp}\n focusOnVisible\n placement='local'\n message={typeof progressProp === 'string' ? progressProp : undefined}\n />\n );\n\n const dismissButton = (\n <Button\n data-testid={testIds.dismiss}\n variant='simple'\n icon\n label={t('dismiss')}\n onClick={onDismiss}\n >\n <Icon name='times' />\n </Button>\n );\n\n const content = (\n <Backdrop\n open={open}\n onBeforeTransitionIn={() => {\n setDrawerOpen(true);\n returnRef.current = getActiveElement();\n onBeforeOpen?.();\n }}\n onBeforeTransitionOut={() => {\n setDrawerOpen(false);\n setDrawerSize(size);\n }}\n onAfterTransitionOut={() => {\n if (\n isInstance(returnRef.current, HTMLElement) &&\n dialogRef.current?.contains(getActiveElement())\n ) {\n returnRef.current.focus();\n }\n onAfterClose?.();\n }}\n >\n <StyledTouchDialog\n data-testid={testIds.root}\n {...restProps}\n ref={dialogRef}\n open={drawerOpen}\n placement='bottom'\n position='fixed'\n size={drawerSizeMapping[drawerSize]}\n shadow\n onAfterOpen={onAfterOpen}\n onBeforeClose={onBeforeClose}\n onOuterClick={onDismiss}\n role='dialog'\n aria-modal='true'\n aria-labelledby={heading ? headingId : undefined}\n aria-busy={!!progressProp}\n >\n <Flex\n container={{ direction: 'row', justify: 'between', alignItems: 'center' }}\n as={StyledTouchDialogHeader}\n >\n {heading && (\n <Text variant='h2' ref={headingRef} id={headingId}>\n {heading}\n </Text>\n )}\n {dismissButton}\n </Flex>\n <Flex as={StyledTouchDialogContent} container={{ gap: 1, direction: 'column' }}>\n {children && (\n <StyledChildrenWrap inert={progressProp ? '' : undefined}>\n {children}\n </StyledChildrenWrap>\n )}\n {progress}\n </Flex>\n {!isAutoSize && (\n <StyledExpandCollapse\n onToggle={() => setDrawerSize(prev => (prev === 'half' ? 'full' : 'half'))}\n expanded={drawerSize === 'full'}\n compact\n iconOnly\n />\n )}\n </StyledTouchDialog>\n </Backdrop>\n );\n\n return portalTarget ? createPortal(content, portalTarget) : content;\n }\n);\n\nexport default TouchDialog;\n"]}
|
|
1
|
+
{"version":3,"file":"TouchDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/TouchDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,aAAa,CAAC;AAErB,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;A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CAAC,IAAI,CACjC,KAAC,oBAAoB,IACnB,QAAQ,EAAE,GAAG,EAAE;wBACb,aAAa,CAAC,IAAI,CAAC,EAAE;4BACnB,IAAI,aAAa;gCAAE,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;4BAClE,IAAI,IAAI,KAAK,MAAM;gCAAE,OAAO,MAAM,CAAC;4BACnC,OAAO,MAAM,CAAC;wBAChB,CAAC,CAAC,CAAC;oBACL,CAAC,EACD,QAAQ,EAAE,UAAU,KAAK,MAAM,EAC/B,OAAO,QACP,QAAQ,SACR,CACH,IACiB,GACM,CAC7B,CAAC;IAEF,OAAO,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACtE,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n useConsolidatedRef,\n useConfiguration,\n useFocusTrap,\n useI18n,\n useTestIds,\n useEscape,\n useUID,\n useEvent\n} from '../../hooks';\nimport type { ForwardRefForwardPropsComponent } from '../../types';\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport Text from '../Text';\nimport * as caretUp from '../Icon/icons/caret-up.icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport Flex from '../Flex';\nimport { focusNonInteractiveElement, getActiveElement, isInstance } from '../../utils';\nimport Progress from '../Progress';\n\nimport {\n StyledTouchDialogContent,\n StyledTouchDialogHeader,\n StyledTouchDialog,\n StyledTouchDialogBackdrop,\n StyledExpandCollapse\n} from './TouchDialog.styles';\nimport { getTouchDialogTestIds } from './TouchDialog.test-ids';\nimport type { TouchDialogProps } from './TouchDialog.types';\nimport { StyledChildrenWrap } from './Dialog.styles';\n\nregisterIcon(caretUp, timesIcon);\n\nconst drawerSizeMapping = {\n auto: 'auto',\n compact: 'var(--touch-dialog-compact-height)',\n half: '50dvh',\n full: '90dvh'\n} as const;\n\nexport const TouchDialog: ForwardRefForwardPropsComponent<TouchDialogProps> = forwardRef(\n function TouchDialog(\n {\n open,\n onDismiss: onDismissProp,\n children,\n size = 'half',\n onBeforeOpen,\n onAfterOpen: onAfterOpenProp,\n onBeforeClose,\n onAfterClose,\n heading,\n progress: progressProp,\n outerClickAction = 'close',\n testId,\n ...restProps\n }: PropsWithoutRef<TouchDialogProps>,\n ref: TouchDialogProps['ref']\n ) {\n const dialogRef = useConsolidatedRef(ref);\n const backdropRef = useRef<HTMLDivElement>(null);\n const t = useI18n();\n const { portalTarget } = useConfiguration();\n const headingRef = useRef<HTMLHeadingElement>(null);\n const isFullCompact = size === 'full-compact';\n const [drawerSize, setDrawerSize] = useState<'auto' | 'compact' | 'half' | 'full'>(\n isFullCompact ? 'full' : size\n );\n const headingId = useUID();\n const testIds = useTestIds(testId, getTouchDialogTestIds);\n const [drawerOpen, setDrawerOpen] = useState(false);\n const returnRef = useRef<Element | null>(null);\n\n useEffect(() => {\n setDrawerSize(isFullCompact ? 'full' : size);\n }, [size]);\n\n const isAutoSize = size === 'auto' || isFullCompact;\n\n const resetSize = useCallback(() => {\n setDrawerSize(isFullCompact ? 'compact' : size);\n }, [size]);\n\n const shouldTrapFocus = open && drawerOpen && !(isFullCompact && drawerSize === 'compact');\n\n useFocusTrap(shouldTrapFocus ? dialogRef : null, false, [shouldTrapFocus]);\n\n const setFocus = useCallback(() => {\n if (progressProp || !drawerOpen || dialogRef.current?.contains(getActiveElement())) return;\n if (headingRef.current) {\n focusNonInteractiveElement(headingRef.current, heading);\n } else if (dialogRef.current) {\n focusNonInteractiveElement(dialogRef.current, heading);\n }\n }, [progressProp, drawerOpen, heading]);\n\n const onDismiss = useCallback(() => {\n setDrawerOpen(false);\n onDismissProp?.();\n }, [onDismissProp]);\n\n const onOuterClick = useCallback(() => {\n if (outerClickAction === 'reset-size') {\n resetSize();\n } else {\n onDismiss();\n }\n }, [onDismiss, outerClickAction, resetSize]);\n\n const onAfterOpen = useCallback(() => {\n onAfterOpenProp?.();\n setFocus();\n }, [onAfterOpenProp, setFocus]);\n\n useEffect(() => {\n if (!progressProp) {\n // Delay focus to the next tick to allow progress to unmount so setFocus do not bail out\n setTimeout(setFocus, 0);\n }\n }, [progressProp, setFocus]);\n\n useEscape(\n e => {\n onDismiss?.();\n e.stopPropagation();\n },\n dialogRef,\n [onDismiss]\n );\n\n const progress = (\n <Progress\n visible={!!progressProp}\n focusOnVisible\n placement='local'\n message={typeof progressProp === 'string' ? progressProp : undefined}\n />\n );\n const isCompact = isFullCompact && drawerSize === 'compact';\n const hasContent = children !== undefined || progressProp !== undefined;\n\n const dismissButton = (\n <Button\n data-testid={testIds.dismiss}\n variant='simple'\n icon\n label={t('dismiss')}\n onClick={onDismiss}\n >\n <Icon name='times' />\n </Button>\n );\n\n useEvent(\n 'click',\n e => {\n if (open && e.target === backdropRef.current) {\n onOuterClick();\n }\n },\n { target: backdropRef, dependencies: [onOuterClick, open] }\n );\n\n const content = (\n <StyledTouchDialogBackdrop\n ref={backdropRef}\n open={open}\n $compact={isCompact}\n onBeforeTransitionIn={() => {\n setDrawerOpen(true);\n if (isFullCompact) setDrawerSize('full');\n returnRef.current = getActiveElement();\n onBeforeOpen?.();\n }}\n onBeforeTransitionOut={() => {\n setDrawerOpen(false);\n }}\n onAfterTransitionOut={() => {\n resetSize();\n if (\n isInstance(returnRef.current, HTMLElement) &&\n dialogRef.current?.contains(getActiveElement())\n ) {\n returnRef.current.focus();\n }\n onAfterClose?.();\n }}\n >\n <StyledTouchDialog\n data-testid={testIds.root}\n {...restProps}\n ref={dialogRef}\n open={drawerOpen}\n placement='bottom'\n position='fixed'\n size={drawerSizeMapping[drawerSize]}\n shadow\n onAfterOpen={onAfterOpen}\n onBeforeClose={onBeforeClose}\n role='dialog'\n aria-modal={shouldTrapFocus ? 'true' : undefined}\n aria-labelledby={heading ? headingId : undefined}\n aria-busy={!!progressProp}\n >\n <Flex\n container={{ direction: 'row', justify: 'between', alignItems: 'center' }}\n as={StyledTouchDialogHeader}\n >\n {heading && (\n <Text variant='h2' ref={headingRef} id={headingId}>\n {heading}\n </Text>\n )}\n {dismissButton}\n </Flex>\n {hasContent && (\n <Flex\n as={StyledTouchDialogContent}\n container={{ gap: 1, direction: 'column' }}\n hidden={isCompact && !progressProp}\n >\n {children && (\n <StyledChildrenWrap\n inert={progressProp || isCompact ? '' : undefined}\n hidden={isCompact}\n >\n {children}\n </StyledChildrenWrap>\n )}\n {progress}\n </Flex>\n )}\n {(!isAutoSize || isFullCompact) && (\n <StyledExpandCollapse\n onToggle={() => {\n setDrawerSize(prev => {\n if (isFullCompact) return prev === 'compact' ? 'full' : 'compact';\n if (prev === 'full') return 'half';\n return 'full';\n });\n }}\n expanded={drawerSize === 'full'}\n compact\n iconOnly\n />\n )}\n </StyledTouchDialog>\n </StyledTouchDialogBackdrop>\n );\n\n return portalTarget ? createPortal(content, portalTarget) : content;\n }\n);\n\nexport default TouchDialog;\n"]}
|
|
@@ -2,6 +2,13 @@ export declare const StyledExpandCollapse: import("styled-components/dist/types"
|
|
|
2
2
|
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
3
3
|
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<import("../ExpandCollapse").ExpandCollapseButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
|
|
4
4
|
export declare const StyledTouchDialog: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("../Drawer").DrawerProps & import("../..").ForwardProps, never>> & string & Omit<import("react").FunctionComponent<import("../Drawer").DrawerProps & import("../..").ForwardProps>, keyof import("react").Component<any, {}, any>>;
|
|
5
|
+
export declare const StyledTouchDialogBackdrop: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("../Backdrop").BackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
+
}, {
|
|
8
|
+
$compact?: boolean;
|
|
9
|
+
}>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<import("../Backdrop").BackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>> & {
|
|
10
|
+
getTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly []>;
|
|
11
|
+
}, keyof import("react").Component<any, {}, any>>;
|
|
5
12
|
export declare const StyledTouchDialogHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
13
|
export declare const StyledTouchDialogContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
14
|
//# sourceMappingURL=TouchDialog.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TouchDialog.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/TouchDialog.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TouchDialog.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/TouchDialog.styles.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,oBAAoB;;2OAQhC,CAAC;AAIF,eAAO,MAAM,iBAAiB,mVAyB7B,CAAC;AAIF,eAAO,MAAM,yBAAyB;;;eAAiC,OAAO;;;iDAM7E,CAAC;AAIF,eAAO,MAAM,uBAAuB,6NASnC,CAAC;AAIF,eAAO,MAAM,wBAAwB,6NAoBpC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { defaultThemeProp } from '../../theme';
|
|
3
3
|
import { StyledButton } from '../Button';
|
|
4
|
+
import Backdrop from '../Backdrop';
|
|
4
5
|
import Drawer from '../Drawer';
|
|
5
6
|
import { ExpandCollapseButton } from '../ExpandCollapse';
|
|
6
7
|
import { StyledIcon } from '../Icon';
|
|
@@ -22,8 +23,12 @@ export const StyledTouchDialog = styled(Drawer)(({ theme: { base, components } }
|
|
|
22
23
|
inset-block-end: calc(${base.spacing} * 0.5 + var(--appshell-hard-bottom-offset, 0rem));
|
|
23
24
|
inset-inline: calc(${base.spacing} * 0.5);
|
|
24
25
|
max-height: 90dvh;
|
|
26
|
+
--touch-dialog-compact-height: calc(
|
|
27
|
+
${base['hit-area'].compact} + ${base.spacing} + ${base['hit-area']['finger-min']}
|
|
28
|
+
);
|
|
25
29
|
border-radius: ${components.card['border-radius']};
|
|
26
30
|
width: auto;
|
|
31
|
+
overflow: hidden;
|
|
27
32
|
transition-property: transform, box-shadow, opacity, height;
|
|
28
33
|
|
|
29
34
|
@media (height < 31.25rem) {
|
|
@@ -36,6 +41,11 @@ export const StyledTouchDialog = styled(Drawer)(({ theme: { base, components } }
|
|
|
36
41
|
}
|
|
37
42
|
`);
|
|
38
43
|
StyledTouchDialog.defaultProps = defaultThemeProp;
|
|
44
|
+
export const StyledTouchDialogBackdrop = styled(Backdrop)(({ $compact }) => $compact &&
|
|
45
|
+
css `
|
|
46
|
+
inset-block-start: calc(100dvh - var(--appshell-bottom-panel-offset, 0));
|
|
47
|
+
`);
|
|
48
|
+
StyledTouchDialogBackdrop.defaultProps = defaultThemeProp;
|
|
39
49
|
export const StyledTouchDialogHeader = styled.div(({ theme: { base } }) => css `
|
|
40
50
|
padding-inline: ${base.spacing};
|
|
41
51
|
padding-block-start: ${base.spacing};
|
|
@@ -52,6 +62,11 @@ export const StyledTouchDialogContent = styled.div(({ theme: { base } }) => css
|
|
|
52
62
|
position: relative;
|
|
53
63
|
padding-block-start: calc(${base.spacing} * 0.5);
|
|
54
64
|
|
|
65
|
+
&[hidden],
|
|
66
|
+
${StyledChildrenWrap}[hidden] {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
55
70
|
${StyledChildrenWrap} {
|
|
56
71
|
height: 100%;
|
|
57
72
|
display: flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TouchDialog.styles.js","sourceRoot":"","sources":["../../../src/components/Dialog/TouchDialog.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAA;;;;;6BAKnC,UAAU;;;CAGtC,CAAC;AAEF,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,CAC7C,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EA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C,CAAC,OAAO;;GAElD,CACF,CAAC;AAEF,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,QAAQ,CAAC,CACvD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CACf,QAAQ;IACR,GAAG,CAAA;;KAEF,CACJ,CAAC;AAEF,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE1D,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAC/C,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;sBACR,IAAI,CAAC,OAAO;2BACP,IAAI,CAAC,OAAO;;MAEjC,YAAY;;;GAGf,CACF,CAAC;AAEF,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAChD,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;;;gCAKE,IAAI,CAAC,OAAO;;;MAGtC,kBAAkB;;;;MAIlB,kBAAkB;;;;wBAIA,IAAI,CAAC,OAAO;;GAEjC,CACF,CAAC;AAEF,wBAAwB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { StyledButton } from '../Button';\nimport Backdrop from '../Backdrop';\nimport Drawer from '../Drawer';\nimport { ExpandCollapseButton } from '../ExpandCollapse';\nimport { StyledIcon } from '../Icon';\n\nimport { StyledChildrenWrap } from './Dialog.styles';\n\nexport const StyledExpandCollapse = styled(ExpandCollapseButton)`\n position: absolute;\n inset-block-start: 0;\n width: 100%;\n\n &[aria-expanded='false'] ${StyledIcon} {\n transform: rotate(-90deg);\n }\n`;\n\nStyledExpandCollapse.defaultProps = defaultThemeProp;\n\nexport const StyledTouchDialog = styled(Drawer)(\n ({ theme: { base, components } }) => css`\n display: flex;\n flex-direction: column;\n background: ${components.popover.background};\n inset-block-end: calc(${base.spacing} * 0.5 + var(--appshell-hard-bottom-offset, 0rem));\n inset-inline: calc(${base.spacing} * 0.5);\n max-height: 90dvh;\n --touch-dialog-compact-height: calc(\n ${base['hit-area'].compact} + ${base.spacing} + ${base['hit-area']['finger-min']}\n );\n border-radius: ${components.card['border-radius']};\n width: auto;\n overflow: hidden;\n transition-property: transform, box-shadow, opacity, height;\n\n @media (height < 31.25rem) {\n overflow-y: auto;\n display: block;\n }\n\n &:has(${StyledExpandCollapse}) {\n padding-block-start: ${base['hit-area'].compact};\n }\n `\n);\n\nStyledTouchDialog.defaultProps = defaultThemeProp;\n\nexport const StyledTouchDialogBackdrop = styled(Backdrop)<{ $compact?: boolean }>(\n ({ $compact }) =>\n $compact &&\n css`\n inset-block-start: calc(100dvh - var(--appshell-bottom-panel-offset, 0));\n `\n);\n\nStyledTouchDialogBackdrop.defaultProps = defaultThemeProp;\n\nexport const StyledTouchDialogHeader = styled.div(\n ({ theme: { base } }) => css`\n padding-inline: ${base.spacing};\n padding-block-start: ${base.spacing};\n\n ${StyledButton} {\n margin-inline-start: auto;\n }\n `\n);\n\nStyledTouchDialogHeader.defaultProps = defaultThemeProp;\n\nexport const StyledTouchDialogContent = styled.div(\n ({ theme: { base } }) => css`\n min-height: 0;\n overflow: auto;\n height: 100%;\n position: relative;\n padding-block-start: calc(${base.spacing} * 0.5);\n\n &[hidden],\n ${StyledChildrenWrap}[hidden] {\n display: none;\n }\n\n ${StyledChildrenWrap} {\n height: 100%;\n display: flex;\n flex-direction: column;\n padding-inline: ${base.spacing};\n }\n `\n);\n\nStyledTouchDialogContent.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -22,12 +22,13 @@ export interface TouchDialogProps extends BaseProps, TestIdProp {
|
|
|
22
22
|
progress?: boolean | ProgressProps['message'];
|
|
23
23
|
/**
|
|
24
24
|
* The initial height of the TouchDialog panel.
|
|
25
|
-
* - `'auto'` — height is driven by content (capped at 90% of the viewport).
|
|
25
|
+
* - `'auto'` — height is driven by content (capped at 90% of the viewport), without an expand control.
|
|
26
|
+
* - `'full-compact'` — initially opens to full height, with the option to collapse to a compact header.
|
|
26
27
|
* - `'half'` — half the viewport height.
|
|
27
28
|
* - `'full'` — opens to the maximum height (90% of the viewport).
|
|
28
29
|
* @default 'half'
|
|
29
30
|
*/
|
|
30
|
-
size?: 'auto' | 'half' | 'full';
|
|
31
|
+
size?: 'auto' | 'full-compact' | 'half' | 'full';
|
|
31
32
|
/** Callback fired before the TouchDialog starts opening. */
|
|
32
33
|
onBeforeOpen?: DrawerProps['onBeforeOpen'];
|
|
33
34
|
/** Callback fired after the TouchDialog finishes opening. */
|
|
@@ -36,6 +37,13 @@ export interface TouchDialogProps extends BaseProps, TestIdProp {
|
|
|
36
37
|
onBeforeClose?: DrawerProps['onBeforeClose'];
|
|
37
38
|
/** Callback fired after the TouchDialog finishes closing. */
|
|
38
39
|
onAfterClose?: DrawerProps['onAfterClose'];
|
|
40
|
+
/**
|
|
41
|
+
* Action performed when a click occurs outside the dialog.
|
|
42
|
+
* - `'close'` — dismisses the dialog.
|
|
43
|
+
* - `'reset-size'` — resets to `compact` for `full-compact`, otherwise to the configured size.
|
|
44
|
+
* @default 'close'
|
|
45
|
+
*/
|
|
46
|
+
outerClickAction?: 'close' | 'reset-size';
|
|
39
47
|
/** Ref for the dialog panel element. */
|
|
40
48
|
ref?: Ref<HTMLDivElement>;
|
|
41
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TouchDialog.types.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/TouchDialog.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EA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,MAAM,GAAG,MAAM,CAAC;IACjD,4DAA4D;IAC5D,YAAY,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IAC3C,6DAA6D;IAC7D,WAAW,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;IACzC,4DAA4D;IAC5D,aAAa,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IAC7C,6DAA6D;IAC7D,YAAY,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IAC3C;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;IAC1C,wCAAwC;IACxC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TouchDialog.types.js","sourceRoot":"","sources":["../../../src/components/Dialog/TouchDialog.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Ref } from 'react';\n\nimport type { BaseProps, TestIdProp } from '../../types';\nimport type { DrawerProps } from '../Drawer';\nimport type { ProgressProps } from '../Progress';\n\nexport interface TouchDialogProps extends BaseProps, TestIdProp {\n /**\n * Whether the TouchDialog should be open or closed.\n * The component should not be unmounted before onAfterClose is called,\n * otherwise the closing animation will be interrupted.\n */\n open: DrawerProps['open'];\n /**\n * Callback fired when the TouchDialog is dismissed with user intent.\n * The parent component should toggle the `open` prop.\n */\n onDismiss: () => void;\n /** Heading text displayed at the top of the drawer. */\n heading?: string;\n /** Content of the TouchDialog. */\n children?: DrawerProps['children'];\n /** If there is a progress state either on opening, or after submit, you must indicate as such. A custom message is supported as well. */\n progress?: boolean | ProgressProps['message'];\n /**\n * The initial height of the TouchDialog panel.\n * - `'auto'` — height is driven by content (capped at 90% of the viewport).\n * - `'half'` — half the viewport height.\n * - `'full'` — opens to the maximum height (90% of the viewport).\n * @default 'half'\n */\n size?: 'auto' | 'half' | 'full';\n /** Callback fired before the TouchDialog starts opening. */\n onBeforeOpen?: DrawerProps['onBeforeOpen'];\n /** Callback fired after the TouchDialog finishes opening. */\n onAfterOpen?: DrawerProps['onAfterOpen'];\n /** Callback fired before the TouchDialog starts closing. */\n onBeforeClose?: DrawerProps['onBeforeClose'];\n /** Callback fired after the TouchDialog finishes closing. */\n onAfterClose?: DrawerProps['onAfterClose'];\n /** Ref for the dialog panel element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TouchDialog.types.js","sourceRoot":"","sources":["../../../src/components/Dialog/TouchDialog.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Ref } from 'react';\n\nimport type { BaseProps, TestIdProp } from '../../types';\nimport type { DrawerProps } from '../Drawer';\nimport type { ProgressProps } from '../Progress';\n\nexport interface TouchDialogProps extends BaseProps, TestIdProp {\n /**\n * Whether the TouchDialog should be open or closed.\n * The component should not be unmounted before onAfterClose is called,\n * otherwise the closing animation will be interrupted.\n */\n open: DrawerProps['open'];\n /**\n * Callback fired when the TouchDialog is dismissed with user intent.\n * The parent component should toggle the `open` prop.\n */\n onDismiss: () => void;\n /** Heading text displayed at the top of the drawer. */\n heading?: string;\n /** Content of the TouchDialog. */\n children?: DrawerProps['children'];\n /** If there is a progress state either on opening, or after submit, you must indicate as such. A custom message is supported as well. */\n progress?: boolean | ProgressProps['message'];\n /**\n * The initial height of the TouchDialog panel.\n * - `'auto'` — height is driven by content (capped at 90% of the viewport), without an expand control.\n * - `'full-compact'` — initially opens to full height, with the option to collapse to a compact header.\n * - `'half'` — half the viewport height.\n * - `'full'` — opens to the maximum height (90% of the viewport).\n * @default 'half'\n */\n size?: 'auto' | 'full-compact' | 'half' | 'full';\n /** Callback fired before the TouchDialog starts opening. */\n onBeforeOpen?: DrawerProps['onBeforeOpen'];\n /** Callback fired after the TouchDialog finishes opening. */\n onAfterOpen?: DrawerProps['onAfterOpen'];\n /** Callback fired before the TouchDialog starts closing. */\n onBeforeClose?: DrawerProps['onBeforeClose'];\n /** Callback fired after the TouchDialog finishes closing. */\n onAfterClose?: DrawerProps['onAfterClose'];\n /**\n * Action performed when a click occurs outside the dialog.\n * - `'close'` — dismisses the dialog.\n * - `'reset-size'` — resets to `compact` for `full-compact`, otherwise to the configured size.\n * @default 'close'\n */\n outerClickAction?: 'close' | 'reset-size';\n /** Ref for the dialog panel element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DockedModals.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/DockedModals.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAO,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DockedModals.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/DockedModals.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAO,MAAM,OAAO,CAAC;AAqB5C,QAAA,MAAM,YAAY;eACI,SAAS;kDAW7B,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -7,8 +7,9 @@ const StyledDockedModals = styled.div(({ theme }) => {
|
|
|
7
7
|
return css `
|
|
8
8
|
position: fixed;
|
|
9
9
|
z-index: ${theme.base['z-index'].modal};
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
inset-block-end: calc(
|
|
11
|
+
var(--appshell-bottom-offset, 0rem) + var(--appshell-bottom-panel-gap, 0rem)
|
|
12
|
+
);
|
|
12
13
|
right: 0;
|
|
13
14
|
pointer-events: none;
|
|
14
15
|
width: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DockedModals.js","sourceRoot":"","sources":["../../../src/components/Modal/DockedModals.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAClD,OAAO,GAAG,CAAA;;eAEG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK
|
|
1
|
+
{"version":3,"file":"DockedModals.js","sourceRoot":"","sources":["../../../src/components/Modal/DockedModals.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAClD,OAAO,GAAG,CAAA;;eAEG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK;;;;;;;GAOvC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,YAAY,CACnD,KAA+B,EAC/B,GAAwB;IAExB,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EACrE,EAAE,EAAE,kBAAkB,KAClB,KAAK,EACT,GAAG,EAAE,GAAG,GACR,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { ReactNode, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\n\nconst StyledDockedModals = styled.div(({ theme }) => {\n return css`\n position: fixed;\n z-index: ${theme.base['z-index'].modal};\n inset-block-end: calc(\n var(--appshell-bottom-offset, 0rem) + var(--appshell-bottom-panel-gap, 0rem)\n );\n right: 0;\n pointer-events: none;\n width: 100%;\n `;\n});\n\nStyledDockedModals.defaultProps = defaultThemeProp;\n\nconst DockedModals = forwardRef(function DockedModals(\n props: { children?: ReactNode },\n ref: Ref<HTMLDivElement>\n) {\n return (\n <Flex\n container={{ justify: 'end', alignItems: 'end', gap: 2, pad: [0, 2] }}\n as={StyledDockedModals}\n {...props}\n ref={ref}\n />\n );\n});\n\nexport default DockedModals;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-core",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.34.0",
|
|
4
4
|
"description": "Cosmos is a visual design system and UI component collection. Its goal is to empower application developers in their pursuit to create engaging and rewarding user experiences.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Pegasystems",
|