@pega/cosmos-react-core 10.0.0-build.12.4 → 10.0.0-build.12.6
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/Actions/Actions.d.ts.map +1 -1
- package/lib/components/Actions/Actions.js +13 -13
- package/lib/components/Actions/Actions.js.map +1 -1
- package/lib/components/AppShell/AppShell.js +1 -1
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/ThemeSwitcher.d.ts.map +1 -1
- package/lib/components/AppShell/ThemeSwitcher.js +4 -12
- package/lib/components/AppShell/ThemeSwitcher.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.js +16 -6
- package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.utils.d.ts +5 -2
- package/lib/components/FieldGroup/FieldGroupList.utils.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.utils.js +6 -4
- package/lib/components/FieldGroup/FieldGroupList.utils.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupListContext.d.ts +1 -0
- package/lib/components/FieldGroup/FieldGroupListContext.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroupListContext.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.js +25 -9
- package/lib/components/Lightbox/Lightbox.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.styles.d.ts +1 -0
- package/lib/components/Lightbox/Lightbox.styles.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.styles.js +40 -31
- package/lib/components/Lightbox/Lightbox.styles.js.map +1 -1
- package/lib/components/Lightbox/ZoomControls/ZoomControls.d.ts +14 -0
- package/lib/components/Lightbox/ZoomControls/ZoomControls.d.ts.map +1 -0
- package/lib/components/Lightbox/ZoomControls/ZoomControls.js +23 -0
- package/lib/components/Lightbox/ZoomControls/ZoomControls.js.map +1 -0
- package/lib/components/Lightbox/ZoomControls/ZoomControls.styles.d.ts +5 -0
- package/lib/components/Lightbox/ZoomControls/ZoomControls.styles.d.ts.map +1 -0
- package/lib/components/Lightbox/ZoomControls/ZoomControls.styles.js +40 -0
- package/lib/components/Lightbox/ZoomControls/ZoomControls.styles.js.map +1 -0
- package/lib/components/Lightbox/ZoomControls/ZoomControls.test-ids.d.ts +2 -0
- package/lib/components/Lightbox/ZoomControls/ZoomControls.test-ids.d.ts.map +1 -0
- package/lib/components/Lightbox/ZoomControls/ZoomControls.test-ids.js +7 -0
- package/lib/components/Lightbox/ZoomControls/ZoomControls.test-ids.js.map +1 -0
- package/lib/components/Lightbox/ZoomControls/index.d.ts +4 -0
- package/lib/components/Lightbox/ZoomControls/index.d.ts.map +1 -0
- package/lib/components/Lightbox/ZoomControls/index.js +3 -0
- package/lib/components/Lightbox/ZoomControls/index.js.map +1 -0
- package/lib/components/Lightbox/useZoom.d.ts +30 -0
- package/lib/components/Lightbox/useZoom.d.ts.map +1 -0
- package/lib/components/Lightbox/useZoom.js +183 -0
- package/lib/components/Lightbox/useZoom.js.map +1 -0
- package/lib/components/MultiStepForm/FormProgress.styles.d.ts.map +1 -1
- package/lib/components/MultiStepForm/FormProgress.styles.js +4 -2
- package/lib/components/MultiStepForm/FormProgress.styles.js.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.js +0 -7
- package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +39 -8
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +5 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +5 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +6 -1
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +5 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/theme/theme.d.ts +6 -0
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +4 -0
- package/lib/theme/themeOverrides.schema.json +4 -0
- package/lib/utils/clamp.d.ts +11 -0
- package/lib/utils/clamp.d.ts.map +1 -0
- package/lib/utils/clamp.js +13 -0
- package/lib/utils/clamp.js.map +1 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { rgba } from 'polished';
|
|
3
|
+
import { defaultThemeProp } from '../../../theme';
|
|
4
|
+
import { tryCatch } from '../../../utils';
|
|
5
|
+
import Button from '../../Button';
|
|
6
|
+
export const StyledZoomControlsButton = styled(Button)(({ theme }) => {
|
|
7
|
+
const bg = tryCatch(() => rgba(theme.base.colors.gray.medium, 0.5));
|
|
8
|
+
const hoverBg = tryCatch(() => rgba(theme.base.colors.gray.medium, 0.7));
|
|
9
|
+
return css `
|
|
10
|
+
background-color: ${bg};
|
|
11
|
+
|
|
12
|
+
& + & {
|
|
13
|
+
margin-inline-start: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&:hover {
|
|
17
|
+
background-color: ${hoverBg};
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
});
|
|
21
|
+
StyledZoomControlsButton.defaultProps = defaultThemeProp;
|
|
22
|
+
export const StyledZoomControls = styled.div(({ theme }) => {
|
|
23
|
+
return css `
|
|
24
|
+
position: absolute;
|
|
25
|
+
z-index: 2;
|
|
26
|
+
inset-block-end: calc(${theme.base.spacing} * 2);
|
|
27
|
+
inset-inline-end: calc(${theme.base.spacing} * 2);
|
|
28
|
+
|
|
29
|
+
${StyledZoomControlsButton} {
|
|
30
|
+
padding: ${theme.base.spacing};
|
|
31
|
+
color: ${theme.base.palette.light};
|
|
32
|
+
|
|
33
|
+
&:focus:enabled {
|
|
34
|
+
box-shadow: ${theme.base.shadow.focus};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
});
|
|
39
|
+
StyledZoomControls.defaultProps = defaultThemeProp;
|
|
40
|
+
//# sourceMappingURL=ZoomControls.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoomControls.styles.js","sourceRoot":"","sources":["../../../../src/components/Lightbox/ZoomControls/ZoomControls.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACnE,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACpE,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAEzE,OAAO,GAAG,CAAA;wBACY,EAAE;;;;;;;0BAOA,OAAO;;GAE9B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,wBAAwB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACzD,OAAO,GAAG,CAAA;;;4BAGgB,KAAK,CAAC,IAAI,CAAC,OAAO;6BACjB,KAAK,CAAC,IAAI,CAAC,OAAO;;MAEzC,wBAAwB;iBACb,KAAK,CAAC,IAAI,CAAC,OAAO;eACpB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK;;;sBAGjB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;;GAG1C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport { defaultThemeProp } from '../../../theme';\nimport { tryCatch } from '../../../utils';\nimport Button from '../../Button';\n\nexport const StyledZoomControlsButton = styled(Button)(({ theme }) => {\n const bg = tryCatch(() => rgba(theme.base.colors.gray.medium, 0.5));\n const hoverBg = tryCatch(() => rgba(theme.base.colors.gray.medium, 0.7));\n\n return css`\n background-color: ${bg};\n\n & + & {\n margin-inline-start: 0;\n }\n\n &:hover {\n background-color: ${hoverBg};\n }\n `;\n});\n\nStyledZoomControlsButton.defaultProps = defaultThemeProp;\n\nexport const StyledZoomControls = styled.div(({ theme }) => {\n return css`\n position: absolute;\n z-index: 2;\n inset-block-end: calc(${theme.base.spacing} * 2);\n inset-inline-end: calc(${theme.base.spacing} * 2);\n\n ${StyledZoomControlsButton} {\n padding: ${theme.base.spacing};\n color: ${theme.base.palette.light};\n\n &:focus:enabled {\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n `;\n});\n\nStyledZoomControls.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoomControls.test-ids.d.ts","sourceRoot":"","sources":["../../../../src/components/Lightbox/ZoomControls/ZoomControls.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,4IAIxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoomControls.test-ids.js","sourceRoot":"","sources":["../../../../src/components/Lightbox/ZoomControls/ZoomControls.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC,eAAe,EAAE;IACnE,SAAS;IACT,UAAU;IACV,YAAY;CACJ,CAAC,CAAC","sourcesContent":["import { createTestIds } from '../../../utils';\n\nexport const getZoomControlsTestIds = createTestIds('zoom-controls', [\n 'zoom-in',\n 'zoom-out',\n 'zoom-reset'\n] as const);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Lightbox/ZoomControls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Lightbox/ZoomControls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { default } from './ZoomControls';\nexport type { ZoomControlsProps } from './ZoomControls';\nexport { StyledZoomControls, StyledZoomControlsButton } from './ZoomControls.styles';\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
interface UseZoomOptions {
|
|
2
|
+
/**
|
|
3
|
+
* The largest allowed scale. Values below 1 are treated as 1.
|
|
4
|
+
* @default 4
|
|
5
|
+
*/
|
|
6
|
+
maxScale?: number;
|
|
7
|
+
}
|
|
8
|
+
interface UseZoomResult {
|
|
9
|
+
/** Zooms in a step, centered on the container. */
|
|
10
|
+
zoomIn: () => void;
|
|
11
|
+
/** Zooms out a step, centered on the container. */
|
|
12
|
+
zoomOut: () => void;
|
|
13
|
+
/** Returns the target to its resting size. */
|
|
14
|
+
reset: () => void;
|
|
15
|
+
/** Whether the target is currently zoomed away from its resting size. */
|
|
16
|
+
zoomed: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Adds pinch, ctrl + wheel and double tap zooming to a target element.
|
|
20
|
+
*
|
|
21
|
+
* Zooming only scales the target. Above the resting size, scrolling is left to the container,
|
|
22
|
+
* which must be scrollable, and the content under the gesture stays in place. Below the resting
|
|
23
|
+
* size, the target scales around the center of the visible area, and the scroll position is kept.
|
|
24
|
+
*
|
|
25
|
+
* @param container The scrollable element that receives gestures. Gestures are off while null.
|
|
26
|
+
* @param target The element that is scaled.
|
|
27
|
+
*/
|
|
28
|
+
declare const useZoom: (container: HTMLElement | null, target: HTMLElement | null, { maxScale }?: UseZoomOptions) => UseZoomResult;
|
|
29
|
+
export default useZoom;
|
|
30
|
+
//# sourceMappingURL=useZoom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useZoom.d.ts","sourceRoot":"","sources":["../../../src/components/Lightbox/useZoom.ts"],"names":[],"mappings":"AAgCA,UAAU,cAAc;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,aAAa;IACrB,kDAAkD;IAClD,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,mDAAmD;IACnD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,8CAA8C;IAC9C,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,yEAAyE;IACzE,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,OAAO,GACX,WAAW,WAAW,GAAG,IAAI,EAC7B,QAAQ,WAAW,GAAG,IAAI,EAC1B,eAAkB,cAAmB,KACpC,aA8KF,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { clamp, isInstance } from '../../utils';
|
|
3
|
+
const ZOOM_STEP = 1.5;
|
|
4
|
+
const MIN_SCALE = 0.5;
|
|
5
|
+
const DOUBLE_TAP_SCALE = 2;
|
|
6
|
+
const DOUBLE_TAP_DELAY = 300;
|
|
7
|
+
const DOUBLE_TAP_DISTANCE = 30;
|
|
8
|
+
const TAP_MOVE_THRESHOLD = 8;
|
|
9
|
+
const WHEEL_ZOOM_SPEED = 0.01;
|
|
10
|
+
const WHEEL_MAX_DELTA = 25;
|
|
11
|
+
const LINE_HEIGHT = 16;
|
|
12
|
+
// Scaling from the top left only adds overflow at the end, so space before the target (e.g. from
|
|
13
|
+
// centering) is never matched there. Shrinks that space as the target grows to fill the container.
|
|
14
|
+
const getShift = (start, size, containerSize, scale) => {
|
|
15
|
+
const free = containerSize - size;
|
|
16
|
+
if (free <= 0)
|
|
17
|
+
return 0;
|
|
18
|
+
return -start * (1 - clamp((containerSize - size * scale) / free, 0, 1));
|
|
19
|
+
};
|
|
20
|
+
// Below the resting size, keep the center of the visible area fixed, wherever it is scrolled to.
|
|
21
|
+
const getZoomOutShift = (start, scroll, containerSize, scale) => (scroll + containerSize / 2 - start) * (1 - scale);
|
|
22
|
+
/**
|
|
23
|
+
* Adds pinch, ctrl + wheel and double tap zooming to a target element.
|
|
24
|
+
*
|
|
25
|
+
* Zooming only scales the target. Above the resting size, scrolling is left to the container,
|
|
26
|
+
* which must be scrollable, and the content under the gesture stays in place. Below the resting
|
|
27
|
+
* size, the target scales around the center of the visible area, and the scroll position is kept.
|
|
28
|
+
*
|
|
29
|
+
* @param container The scrollable element that receives gestures. Gestures are off while null.
|
|
30
|
+
* @param target The element that is scaled.
|
|
31
|
+
*/
|
|
32
|
+
const useZoom = (container, target, { maxScale = 4 } = {}) => {
|
|
33
|
+
const scale = useRef(1);
|
|
34
|
+
const shift = useRef({ x: 0, y: 0 });
|
|
35
|
+
const [scaleState, setScaleState] = useState(1);
|
|
36
|
+
const reset = useCallback(() => {
|
|
37
|
+
scale.current = 1;
|
|
38
|
+
shift.current = { x: 0, y: 0 };
|
|
39
|
+
setScaleState(1);
|
|
40
|
+
if (!target)
|
|
41
|
+
return;
|
|
42
|
+
target.style.transform = '';
|
|
43
|
+
target.style.transformOrigin = '';
|
|
44
|
+
}, [target]);
|
|
45
|
+
const zoomTo = useCallback((nextScale, point) => {
|
|
46
|
+
const next = clamp(nextScale, MIN_SCALE, Math.max(1, maxScale));
|
|
47
|
+
if (!container || !target || next === scale.current)
|
|
48
|
+
return;
|
|
49
|
+
const zoomedOut = next < 1;
|
|
50
|
+
const rect = target.getBoundingClientRect();
|
|
51
|
+
const bounds = container.getBoundingClientRect();
|
|
52
|
+
const current = scale.current;
|
|
53
|
+
// The target's unscaled position within the container's scrollable content.
|
|
54
|
+
const startX = rect.left - bounds.left + container.scrollLeft - shift.current.x;
|
|
55
|
+
const startY = rect.top - bounds.top + container.scrollTop - shift.current.y;
|
|
56
|
+
const width = rect.width / current;
|
|
57
|
+
const height = rect.height / current;
|
|
58
|
+
const previousShift = shift.current;
|
|
59
|
+
const nextShift = zoomedOut
|
|
60
|
+
? {
|
|
61
|
+
x: getZoomOutShift(startX, container.scrollLeft, container.clientWidth, next),
|
|
62
|
+
y: getZoomOutShift(startY, container.scrollTop, container.clientHeight, next)
|
|
63
|
+
}
|
|
64
|
+
: {
|
|
65
|
+
x: getShift(startX, width, container.clientWidth, next),
|
|
66
|
+
y: getShift(startY, height, container.clientHeight, next)
|
|
67
|
+
};
|
|
68
|
+
scale.current = next;
|
|
69
|
+
shift.current = nextShift;
|
|
70
|
+
setScaleState(next);
|
|
71
|
+
target.style.transformOrigin = next === 1 ? '' : '0 0';
|
|
72
|
+
target.style.transform =
|
|
73
|
+
next === 1 ? '' : `translate(${nextShift.x}px, ${nextShift.y}px) scale(${next})`;
|
|
74
|
+
if (zoomedOut)
|
|
75
|
+
return;
|
|
76
|
+
const origin = point ?? {
|
|
77
|
+
x: (bounds.left + bounds.right) / 2,
|
|
78
|
+
y: (bounds.top + bounds.bottom) / 2
|
|
79
|
+
};
|
|
80
|
+
const growth = next / current - 1;
|
|
81
|
+
const scrollX = growth * (origin.x - rect.left) + nextShift.x - previousShift.x;
|
|
82
|
+
const scrollY = growth * (origin.y - rect.top) + nextShift.y - previousShift.y;
|
|
83
|
+
container.scrollLeft += scrollX;
|
|
84
|
+
container.scrollTop += scrollY;
|
|
85
|
+
}, [container, target, maxScale]);
|
|
86
|
+
const zoomIn = useCallback(() => zoomTo(scale.current * ZOOM_STEP), [zoomTo]);
|
|
87
|
+
const zoomOut = useCallback(() => zoomTo(scale.current / ZOOM_STEP), [zoomTo]);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (!container)
|
|
90
|
+
return;
|
|
91
|
+
const pointers = new Map();
|
|
92
|
+
let tap;
|
|
93
|
+
let lastTap;
|
|
94
|
+
// Allows native scrolling, but not the browser's own pinch zoom.
|
|
95
|
+
const previousTouchAction = container.style.touchAction;
|
|
96
|
+
container.style.touchAction = 'pan-x pan-y';
|
|
97
|
+
const measure = () => {
|
|
98
|
+
const [a, b] = [...pointers.values()];
|
|
99
|
+
return {
|
|
100
|
+
mid: { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 },
|
|
101
|
+
distance: Math.hypot(a.x - b.x, a.y - b.y)
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
const onWheel = (e) => {
|
|
105
|
+
// Trackpad pinches arrive as ctrl + wheel in Chromium and Firefox.
|
|
106
|
+
if (!e.ctrlKey)
|
|
107
|
+
return;
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
const delta = clamp(e.deltaY * (e.deltaMode === 1 ? LINE_HEIGHT : 1), -WHEEL_MAX_DELTA, WHEEL_MAX_DELTA);
|
|
110
|
+
zoomTo(scale.current * Math.exp(-delta * WHEEL_ZOOM_SPEED), { x: e.clientX, y: e.clientY });
|
|
111
|
+
};
|
|
112
|
+
const onPointerDown = (e) => {
|
|
113
|
+
if ((e.pointerType === 'mouse' && e.button !== 0) || pointers.size >= 2)
|
|
114
|
+
return;
|
|
115
|
+
container.setPointerCapture(e.pointerId);
|
|
116
|
+
pointers.set(e.pointerId, { x: e.clientX, y: e.clientY });
|
|
117
|
+
tap =
|
|
118
|
+
pointers.size === 1
|
|
119
|
+
? {
|
|
120
|
+
id: e.pointerId,
|
|
121
|
+
x: e.clientX,
|
|
122
|
+
y: e.clientY,
|
|
123
|
+
onTarget: !!target && isInstance(e.target, Node) && target.contains(e.target)
|
|
124
|
+
}
|
|
125
|
+
: undefined;
|
|
126
|
+
};
|
|
127
|
+
const onPointerMove = (e) => {
|
|
128
|
+
if (!pointers.has(e.pointerId))
|
|
129
|
+
return;
|
|
130
|
+
const before = pointers.size === 2 ? measure() : undefined;
|
|
131
|
+
pointers.set(e.pointerId, { x: e.clientX, y: e.clientY });
|
|
132
|
+
if (tap && Math.hypot(e.clientX - tap.x, e.clientY - tap.y) > TAP_MOVE_THRESHOLD) {
|
|
133
|
+
tap = undefined;
|
|
134
|
+
}
|
|
135
|
+
if (before && before.distance > 0) {
|
|
136
|
+
const after = measure();
|
|
137
|
+
zoomTo((scale.current * after.distance) / before.distance, after.mid);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const onPointerEnd = (e) => {
|
|
141
|
+
if (!pointers.delete(e.pointerId))
|
|
142
|
+
return;
|
|
143
|
+
const completedTap = e.type === 'pointerup' && tap?.id === e.pointerId ? tap : undefined;
|
|
144
|
+
tap = undefined;
|
|
145
|
+
if (!completedTap?.onTarget)
|
|
146
|
+
return;
|
|
147
|
+
const point = { x: e.clientX, y: e.clientY };
|
|
148
|
+
if (lastTap &&
|
|
149
|
+
e.timeStamp - lastTap.time < DOUBLE_TAP_DELAY &&
|
|
150
|
+
Math.hypot(point.x - lastTap.x, point.y - lastTap.y) < DOUBLE_TAP_DISTANCE) {
|
|
151
|
+
lastTap = undefined;
|
|
152
|
+
if (scale.current !== 1)
|
|
153
|
+
reset();
|
|
154
|
+
else
|
|
155
|
+
zoomTo(DOUBLE_TAP_SCALE, point);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
lastTap = { ...point, time: e.timeStamp };
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const ac = new AbortController();
|
|
162
|
+
// Non-passive so wheel events can cancel the browser's page zoom.
|
|
163
|
+
const listenerOptions = { passive: false, signal: ac.signal };
|
|
164
|
+
container.addEventListener('wheel', onWheel, listenerOptions);
|
|
165
|
+
container.addEventListener('pointerdown', onPointerDown, listenerOptions);
|
|
166
|
+
container.addEventListener('pointermove', onPointerMove, listenerOptions);
|
|
167
|
+
container.addEventListener('pointerup', onPointerEnd, listenerOptions);
|
|
168
|
+
container.addEventListener('pointercancel', onPointerEnd, listenerOptions);
|
|
169
|
+
return () => {
|
|
170
|
+
ac.abort();
|
|
171
|
+
container.style.touchAction = previousTouchAction;
|
|
172
|
+
reset();
|
|
173
|
+
};
|
|
174
|
+
}, [container, target, zoomTo, reset]);
|
|
175
|
+
return {
|
|
176
|
+
zoomIn,
|
|
177
|
+
zoomOut,
|
|
178
|
+
reset,
|
|
179
|
+
zoomed: scaleState !== 1
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
export default useZoom;
|
|
183
|
+
//# sourceMappingURL=useZoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useZoom.js","sourceRoot":"","sources":["../../../src/components/Lightbox/useZoom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,KAAK,EAAE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,EAAE,CAAC;YAC5C,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,EAAE,GAAG,IAAI,eAAe,EAAE,CAAC;QACjC,kEAAkE;QAClE,MAAM,eAAe,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC;QAC9D,SAAS,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;QAC9D,SAAS,CAAC,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;QAC1E,SAAS,CAAC,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;QAC1E,SAAS,CAAC,gBAAgB,CAAC,WAAW,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;QACvE,SAAS,CAAC,gBAAgB,CAAC,eAAe,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;QAE3E,OAAO,GAAG,EAAE;YACV,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,SAAS,CAAC,KAAK,CAAC,WAAW,GAAG,mBAAmB,CAAC;YAClD,KAAK,EAAE,CAAC;QACV,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAEvC,OAAO;QACL,MAAM;QACN,OAAO;QACP,KAAK;QACL,MAAM,EAAE,UAAU,KAAK,CAAC;KACzB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { clamp, isInstance } from '../../utils';\n\ninterface Point {\n x: number;\n y: number;\n}\n\nconst ZOOM_STEP = 1.5;\nconst MIN_SCALE = 0.5;\nconst DOUBLE_TAP_SCALE = 2;\nconst DOUBLE_TAP_DELAY = 300;\nconst DOUBLE_TAP_DISTANCE = 30;\nconst TAP_MOVE_THRESHOLD = 8;\nconst WHEEL_ZOOM_SPEED = 0.01;\nconst WHEEL_MAX_DELTA = 25;\nconst LINE_HEIGHT = 16;\n\n// Scaling from the top left only adds overflow at the end, so space before the target (e.g. from\n// centering) is never matched there. Shrinks that space as the target grows to fill the container.\nconst getShift = (start: number, size: number, containerSize: number, scale: number) => {\n const free = containerSize - size;\n if (free <= 0) return 0;\n\n return -start * (1 - clamp((containerSize - size * scale) / free, 0, 1));\n};\n\n// Below the resting size, keep the center of the visible area fixed, wherever it is scrolled to.\nconst getZoomOutShift = (start: number, scroll: number, containerSize: number, scale: number) =>\n (scroll + containerSize / 2 - start) * (1 - scale);\n\ninterface UseZoomOptions {\n /**\n * The largest allowed scale. Values below 1 are treated as 1.\n * @default 4\n */\n maxScale?: number;\n}\n\ninterface UseZoomResult {\n /** Zooms in a step, centered on the container. */\n zoomIn: () => void;\n /** Zooms out a step, centered on the container. */\n zoomOut: () => void;\n /** Returns the target to its resting size. */\n reset: () => void;\n /** Whether the target is currently zoomed away from its resting size. */\n zoomed: boolean;\n}\n\n/**\n * Adds pinch, ctrl + wheel and double tap zooming to a target element.\n *\n * Zooming only scales the target. Above the resting size, scrolling is left to the container,\n * which must be scrollable, and the content under the gesture stays in place. Below the resting\n * size, the target scales around the center of the visible area, and the scroll position is kept.\n *\n * @param container The scrollable element that receives gestures. Gestures are off while null.\n * @param target The element that is scaled.\n */\nconst useZoom = (\n container: HTMLElement | null,\n target: HTMLElement | null,\n { maxScale = 4 }: UseZoomOptions = {}\n): UseZoomResult => {\n const scale = useRef(1);\n const shift = useRef<Point>({ x: 0, y: 0 });\n const [scaleState, setScaleState] = useState(1);\n\n const reset = useCallback(() => {\n scale.current = 1;\n shift.current = { x: 0, y: 0 };\n setScaleState(1);\n if (!target) return;\n\n target.style.transform = '';\n target.style.transformOrigin = '';\n }, [target]);\n\n const zoomTo = useCallback(\n (nextScale: number, point?: Point) => {\n const next = clamp(nextScale, MIN_SCALE, Math.max(1, maxScale));\n if (!container || !target || next === scale.current) return;\n\n const zoomedOut = next < 1;\n const rect = target.getBoundingClientRect();\n const bounds = container.getBoundingClientRect();\n const current = scale.current;\n // The target's unscaled position within the container's scrollable content.\n const startX = rect.left - bounds.left + container.scrollLeft - shift.current.x;\n const startY = rect.top - bounds.top + container.scrollTop - shift.current.y;\n const width = rect.width / current;\n const height = rect.height / current;\n const previousShift = shift.current;\n const nextShift = zoomedOut\n ? {\n x: getZoomOutShift(startX, container.scrollLeft, container.clientWidth, next),\n y: getZoomOutShift(startY, container.scrollTop, container.clientHeight, next)\n }\n : {\n x: getShift(startX, width, container.clientWidth, next),\n y: getShift(startY, height, container.clientHeight, next)\n };\n\n scale.current = next;\n shift.current = nextShift;\n setScaleState(next);\n target.style.transformOrigin = next === 1 ? '' : '0 0';\n target.style.transform =\n next === 1 ? '' : `translate(${nextShift.x}px, ${nextShift.y}px) scale(${next})`;\n if (zoomedOut) return;\n\n const origin = point ?? {\n x: (bounds.left + bounds.right) / 2,\n y: (bounds.top + bounds.bottom) / 2\n };\n const growth = next / current - 1;\n const scrollX = growth * (origin.x - rect.left) + nextShift.x - previousShift.x;\n const scrollY = growth * (origin.y - rect.top) + nextShift.y - previousShift.y;\n\n container.scrollLeft += scrollX;\n container.scrollTop += scrollY;\n },\n [container, target, maxScale]\n );\n\n const zoomIn = useCallback(() => zoomTo(scale.current * ZOOM_STEP), [zoomTo]);\n const zoomOut = useCallback(() => zoomTo(scale.current / ZOOM_STEP), [zoomTo]);\n\n useEffect(() => {\n if (!container) return;\n\n const pointers = new Map<number, Point>();\n let tap: { id: number; x: number; y: number; onTarget: boolean } | undefined;\n let lastTap: { x: number; y: number; time: number } | undefined;\n\n // Allows native scrolling, but not the browser's own pinch zoom.\n const previousTouchAction = container.style.touchAction;\n container.style.touchAction = 'pan-x pan-y';\n\n const measure = () => {\n const [a, b] = [...pointers.values()];\n\n return {\n mid: { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 },\n distance: Math.hypot(a.x - b.x, a.y - b.y)\n };\n };\n\n const onWheel = (e: WheelEvent) => {\n // Trackpad pinches arrive as ctrl + wheel in Chromium and Firefox.\n if (!e.ctrlKey) return;\n\n e.preventDefault();\n const delta = clamp(\n e.deltaY * (e.deltaMode === 1 ? LINE_HEIGHT : 1),\n -WHEEL_MAX_DELTA,\n WHEEL_MAX_DELTA\n );\n zoomTo(scale.current * Math.exp(-delta * WHEEL_ZOOM_SPEED), { x: e.clientX, y: e.clientY });\n };\n\n const onPointerDown = (e: PointerEvent) => {\n if ((e.pointerType === 'mouse' && e.button !== 0) || pointers.size >= 2) return;\n\n container.setPointerCapture(e.pointerId);\n pointers.set(e.pointerId, { x: e.clientX, y: e.clientY });\n\n tap =\n pointers.size === 1\n ? {\n id: e.pointerId,\n x: e.clientX,\n y: e.clientY,\n onTarget: !!target && isInstance(e.target, Node) && target.contains(e.target)\n }\n : undefined;\n };\n\n const onPointerMove = (e: PointerEvent) => {\n if (!pointers.has(e.pointerId)) return;\n\n const before = pointers.size === 2 ? measure() : undefined;\n pointers.set(e.pointerId, { x: e.clientX, y: e.clientY });\n\n if (tap && Math.hypot(e.clientX - tap.x, e.clientY - tap.y) > TAP_MOVE_THRESHOLD) {\n tap = undefined;\n }\n\n if (before && before.distance > 0) {\n const after = measure();\n zoomTo((scale.current * after.distance) / before.distance, after.mid);\n }\n };\n\n const onPointerEnd = (e: PointerEvent) => {\n if (!pointers.delete(e.pointerId)) return;\n\n const completedTap = e.type === 'pointerup' && tap?.id === e.pointerId ? tap : undefined;\n tap = undefined;\n if (!completedTap?.onTarget) return;\n\n const point = { x: e.clientX, y: e.clientY };\n if (\n lastTap &&\n e.timeStamp - lastTap.time < DOUBLE_TAP_DELAY &&\n Math.hypot(point.x - lastTap.x, point.y - lastTap.y) < DOUBLE_TAP_DISTANCE\n ) {\n lastTap = undefined;\n if (scale.current !== 1) reset();\n else zoomTo(DOUBLE_TAP_SCALE, point);\n } else {\n lastTap = { ...point, time: e.timeStamp };\n }\n };\n\n const ac = new AbortController();\n // Non-passive so wheel events can cancel the browser's page zoom.\n const listenerOptions = { passive: false, signal: ac.signal };\n container.addEventListener('wheel', onWheel, listenerOptions);\n container.addEventListener('pointerdown', onPointerDown, listenerOptions);\n container.addEventListener('pointermove', onPointerMove, listenerOptions);\n container.addEventListener('pointerup', onPointerEnd, listenerOptions);\n container.addEventListener('pointercancel', onPointerEnd, listenerOptions);\n\n return () => {\n ac.abort();\n container.style.touchAction = previousTouchAction;\n reset();\n };\n }, [container, target, zoomTo, reset]);\n\n return {\n zoomIn,\n zoomOut,\n reset,\n zoomed: scaleState !== 1\n };\n};\n\nexport default useZoom;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormProgress.styles.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/FormProgress.styles.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAElD,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,0DAA0D;AAC1D,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,6DAA6D;AAC7D,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,WAAW,CAAC;AAEjD,eAAO,MAAM,kBAAkB,4ZAU9B,CAAC;AAyBF,eAAO,MAAM,SAAS;cAA0B,OAAO;YAsBrD,CAAC;AAIH,eAAO,MAAM,UAAU;eAA2B,MAAM;YA+BtD,CAAC;AAIH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAAkC,OAAO;gJAmBtE,CAAC;AAIH,eAAO,MAAM,UAAU;;;aACZ,OAAO;WACT,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JAmBtE,CAAC;AAIH,eAAO,MAAM,UAAU;;;aACZ,OAAO;WACT,IAAI,CAAC,OAAO,CAAC;gBACR,IAAI,CAAC,WAAW,CAAC;gBACjB,OAAO;mKAmHnB,CAAC;AAIH,eAAO,MAAM,0BAA0B;oBAA+B,OAAO;YAsD5E,CAAC;AAIF,eAAO,MAAM,yBAAyB,mOAErC,CAAC;AAEF,eAAO,MAAM,mBAAmB;aACrB,OAAO;WACT,OAAO;YA2Cd,CAAC;AAIH,eAAO,MAAM,cAAc,6NAKzB,CAAC;AAIH,eAAO,MAAM,wBAAwB,6NAUnC,CAAC;AAIH,eAAO,MAAM,sBAAsB;oBAA+B,OAAO;YA4BxE,CAAC;AAIF,eAAO,MAAM,0BAA0B;;;aAC5B,OAAO;gBACJ,OAAO;gBACP,OAAO;mKAkFnB,CAAC;AAIH,eAAO,MAAM,wBAAwB,6NAKnC,CAAC;AAIH,eAAO,MAAM,wBAAwB;;;aAC1B,OAAO;gBACJ,OAAO;gBACP,OAAO;mKA8EnB,CAAC"}
|
|
@@ -329,6 +329,7 @@ export const StyledHorizontalBarSegment = styled(BareButton)(({ current, complet
|
|
|
329
329
|
const maxBarHeight = `calc(${fontSize} * 0.75)`;
|
|
330
330
|
const barHeight = current ? maxBarHeight : `calc(${fontSize} * 0.5)`;
|
|
331
331
|
const hoverBackground = tryCatch(() => lighten(0.1, interactive), () => interactive);
|
|
332
|
+
const filledBackground = completed && !clickable && !current ? borderColor : interactive;
|
|
332
333
|
return css `
|
|
333
334
|
position: relative;
|
|
334
335
|
display: block;
|
|
@@ -337,7 +338,7 @@ export const StyledHorizontalBarSegment = styled(BareButton)(({ current, complet
|
|
|
337
338
|
margin-block: calc((${maxBarHeight} - ${barHeight}) / 2);
|
|
338
339
|
border: ${borderWidth} solid transparent;
|
|
339
340
|
border-radius: ${barIndicatorBorderRadius};
|
|
340
|
-
background: ${current || completed ?
|
|
341
|
+
background: ${current || completed ? filledBackground : primaryBackground};
|
|
341
342
|
transition:
|
|
342
343
|
background calc(2 * ${animationSpeed}) ${animationTiming},
|
|
343
344
|
border-color calc(2 * ${animationSpeed}) ${animationTiming};
|
|
@@ -397,6 +398,7 @@ export const StyledVerticalBarSegment = styled(BareButton)(({ current, completed
|
|
|
397
398
|
const { base: { 'font-size': fontSize, animation: { speed: animationSpeed }, palette: { interactive, 'primary-background': primaryBackground }, shadow: { focus: focusShadow }, 'hit-area': { 'finger-min': touchButtonSize } }, components: { 'form-control': { 'border-color': borderColor, 'border-width': borderWidth }, 'multi-step-form': { 'bar-indicator-border-radius': barIndicatorBorderRadius } } } = theme;
|
|
398
399
|
const barWidth = current ? `calc(${fontSize} * 0.75)` : `calc(${fontSize} * 0.5)`;
|
|
399
400
|
const hoverBackground = tryCatch(() => lighten(0.1, interactive), () => interactive);
|
|
401
|
+
const filledBackground = completed && !clickable && !current ? borderColor : interactive;
|
|
400
402
|
return css `
|
|
401
403
|
position: relative;
|
|
402
404
|
display: block;
|
|
@@ -405,7 +407,7 @@ export const StyledVerticalBarSegment = styled(BareButton)(({ current, completed
|
|
|
405
407
|
flex: 1 1 0;
|
|
406
408
|
border: ${borderWidth} solid transparent;
|
|
407
409
|
border-radius: ${barIndicatorBorderRadius};
|
|
408
|
-
background: ${current || completed ?
|
|
410
|
+
background: ${current || completed ? filledBackground : primaryBackground};
|
|
409
411
|
transition:
|
|
410
412
|
background calc(2 * ${animationSpeed}),
|
|
411
413
|
border-color calc(2 * ${animationSpeed});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormProgress.styles.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/FormProgress.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE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,EAC9B,UAAU,EAAE,EAAE,YAAY,EAAE,eAAe,EAAE,EAC9C,EACD,UAAU,EAAE,EACV,cAAc,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,EAC5E,iBAAiB,EAAE,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,EAC/E,EACF,GAAG,KAAK,CAAC;IAEV,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,QAAQ,QAAQ,UAAU,CAAC,CAAC,CAAC,QAAQ,QAAQ,SAAS,CAAC;IAClF,MAAM,eAAe,GAAG,QAAQ,CAC9B,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,EAC/B,GAAG,EAAE,CAAC,WAAW,CAClB,CAAC;IAEF,OAAO,GAAG,CAAA;;;aAGC,QAAQ;kBACH,wBAAwB;;cAE5B,WAAW;qBACJ,wBAAwB;kBAC3B,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAiB;;4BAE5C,cAAc;8BACZ,cAAc;;MAEtC,CAAC,OAAO;QACV,GAAG,CAAA;sBACe,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW;;;;;KAKtD;;MAEC,SAAS;QACX,GAAG,CAAA;;;QAGC,CAAC,OAAO;YACV,GAAG,CAAA;;wBAEe,eAAe;;OAEhC;KACF;;;oBAGe,WAAW;;;;;;;;;oBASX,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY;;;;;;;;4BAQzC,eAAe,MAAM,QAAQ;;GAEtD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,wBAAwB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { lighten, size } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport BareButton from '../Button/BareButton';\nimport Popover from '../Popover';\nimport { StyledText } from '../Text';\nimport { calculateFontSize, type FontSize } from '../../styles';\nimport { useDirection } from '../../hooks';\nimport Flex from '../Flex';\nimport { ellipsisOverflow } from '../../styles/mixins';\n\nimport type { Step } from './MultiStepForm.types';\n\n/** Min width of each step item including labels in ch units */\nexport const stepItemMinWidth = 15;\n\n/** Min width of step marker without labels in ch units */\nexport const stepMarkerMinWidth = 3;\n\n/** Min width of each bar segment in bars mode in ch units */\nexport const stepBarMinWidth = 3;\n\n/** Min height of each vertical bar segment in bars mode */\nexport const stepVerticalBarMinHeight = '2.5rem';\n\nexport const CurrentStepPopover = styled(Popover)`\n max-width: 100%;\n background-color: transparent;\n z-index: 0;\n box-shadow: none;\n animation: none;\n\n & > ${StyledText} {\n ${ellipsisOverflow}\n }\n`;\n\nconst calculateStepMarkerSizes = (fontSize: string, fontScale: string | number) => {\n const { m: stepMarkerSize } = calculateFontSize(fontSize, fontScale);\n return {\n stepMarkerSize,\n smallStepMarkerSize: `calc(${stepMarkerSize} / 1.5)`,\n bigStepMarkerSize: `calc(${stepMarkerSize} * 1.5)`\n };\n};\n\nconst calculateBarTopPadding = (\n fontSize: string,\n fontScale: string | number,\n lineHeight: string\n) => {\n const { bigStepMarkerSize } = calculateStepMarkerSizes(fontSize, fontScale);\n return {\n // assuming the step progress always contains current step marker which is the biggest one,\n // the top padding of the bar should be half of the big step marker size minus line height of the bar\n // to be vertically centered\n stepBarTopPadding: `calc((${bigStepMarkerSize} / 2) - (${lineHeight} / 2))`\n };\n};\n\nexport const StyledBar = styled.div<{ shifted?: boolean }>(({ shifted, theme }) => {\n const {\n base: { 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n 'form-control': { 'border-color': borderColor }\n }\n } = theme;\n\n const lineHeight = '0.125rem';\n const { stepBarTopPadding } = calculateBarTopPadding(fontSize, fontScale, lineHeight);\n\n return css`\n position: absolute;\n ${shifted && `inset-block-start: ${stepBarTopPadding};`}\n width: 100%;\n height: ${lineHeight};\n background: ${borderColor};\n\n @media (forced-colors: active) {\n background: CanvasText;\n }\n `;\n});\n\nStyledBar.defaultProps = defaultThemeProp;\n\nexport const StyledFill = styled.div<{ fillScale: number }>(({ fillScale, theme }) => {\n const {\n base: {\n animation: {\n speed: animationSpeed,\n timing: { ease: animationTiming }\n },\n palette: { interactive }\n }\n } = theme;\n\n const { ltr } = useDirection();\n\n const markedLineThicknessFactor = 2;\n\n return css`\n position: absolute;\n width: 100%;\n height: calc(100% * ${markedLineThicknessFactor});\n\n /* top position based on line thickness factor to keep the fill centered */\n top: calc(-50% * (${markedLineThicknessFactor} - 1));\n background: ${interactive};\n transition: all calc(2 * ${animationSpeed}) ${animationTiming};\n transform: scaleX(${fillScale});\n transform-origin: ${ltr ? 0 : '100%'} 0;\n\n @media (forced-colors: active) {\n background: Highlight;\n }\n `;\n});\n\nStyledFill.defaultProps = defaultThemeProp;\n\nexport const StyledFormProgress = styled(Flex)<{ showStepNames?: boolean }>(({\n showStepNames,\n theme\n}) => {\n const {\n base: { spacing, 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n text: {\n h4: { 'font-size': h3fontSize }\n }\n }\n } = theme;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n position: relative;\n ${!showStepNames &&\n `padding-block-end: calc(${spacing} + ${fontSizes[h3fontSize as FontSize]} * 1.35);`}\n `;\n});\n\nStyledFormProgress.defaultProps = defaultThemeProp;\n\nexport const StepMarker = styled(BareButton)<{\n current: boolean;\n depth: Step['depth'];\n completed?: Step['completed'];\n clickable?: boolean;\n}>(({ current, depth, completed, clickable, theme }) => {\n const {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n animation: {\n speed: animationSpeed,\n timing: { ease: animationTiming }\n },\n palette: { interactive, 'primary-background': primaryBackground },\n shadow: { focus: focusShadow },\n 'hit-area': { 'mouse-min': buttonSize, 'finger-min': touchButtonSize }\n },\n components: {\n 'form-control': { 'border-color': borderColor, 'border-width': borderWidth }\n }\n } = theme;\n\n const { stepMarkerSize, smallStepMarkerSize, bigStepMarkerSize } = calculateStepMarkerSizes(\n fontSize,\n fontScale\n );\n\n // Determine the actual size for this marker based on its state\n let markerSize = stepMarkerSize;\n if (current) {\n markerSize = bigStepMarkerSize;\n } else if (depth === 1) {\n markerSize = smallStepMarkerSize;\n }\n\n return css`\n position: relative;\n z-index: 1;\n\n /* Fixed container size based on the biggest marker to prevent layout shifts */\n ${size(bigStepMarkerSize)}\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n\n ${clickable\n ? css`\n border-color: ${interactive};\n `\n : css`\n cursor: default;\n `}\n\n &::before {\n content: '';\n ${size(markerSize)}\n position: absolute;\n border-radius: 100%;\n transition: all calc(2 * ${animationSpeed}) ${animationTiming};\n }\n\n &:focus-visible::before {\n box-shadow: ${focusShadow};\n\n @media (forced-colors: active) {\n outline: 0.125rem solid Highlight;\n outline-offset: 0.125rem;\n }\n }\n\n ${!current &&\n css`\n border-color: transparent;\n background: transparent;\n\n &::before {\n background: ${primaryBackground};\n border: calc(2 * ${borderWidth}) solid ${clickable ? interactive : borderColor};\n\n ${completed &&\n css`\n background: ${interactive};\n border-color: ${interactive};\n `}\n\n @media (forced-colors: active) {\n background: ${completed ? 'Highlight' : 'Canvas'};\n border-color: ${clickable ? 'Highlight' : 'CanvasText'};\n }\n }\n `}\n\n ${current &&\n css`\n &::before {\n background: ${interactive};\n\n @media (forced-colors: active) {\n background: Highlight;\n }\n }\n `}\n\n ::after {\n content: '';\n position: absolute;\n ${size(buttonSize)}\n inset-block-start: ${`calc((${buttonSize} - ${bigStepMarkerSize}) / -2) `};\n inset-inline-start: ${`calc((${buttonSize} - ${bigStepMarkerSize}) / -2) `};\n\n @media (pointer: coarse) {\n inset-block-start: ${`calc((${touchButtonSize} - ${bigStepMarkerSize}) / -2) `};\n inset-inline-start: ${`calc((${touchButtonSize} - ${bigStepMarkerSize}) / -2) `};\n ${size(touchButtonSize)}\n }\n }\n `;\n});\n\nStepMarker.defaultProps = defaultThemeProp;\n\nexport const StyleHorizontalStepMarkers = styled.ol<{ showStepNames?: boolean }>(\n ({ showStepNames, theme }) => {\n return css`\n list-style-type: none;\n justify-content: space-between;\n\n li {\n display: flex;\n position: relative;\n flex: 1 1 0;\n\n /* min width changes based on whether step names are shown */\n min-width: ${`${showStepNames ? stepItemMinWidth : stepMarkerMinWidth}ch`};\n font-size: small;\n margin-inline: ${theme.base.spacing};\n flex-direction: column;\n align-items: center;\n text-align: center;\n }\n\n li:first-child,\n li:last-child {\n flex: 0.5 1 0;\n /* stylelint-disable-next-line unit-allowed-list */\n min-width: ${`${showStepNames ? stepItemMinWidth / 2 : stepMarkerMinWidth / 2}ch`};\n }\n\n li:first-child {\n align-items: flex-start;\n text-align: start;\n margin-inline-start: 0;\n padding-inline-start: 0;\n\n ${StepMarker}::before {\n inset-inline-start: 0;\n }\n }\n\n li:last-child {\n align-items: flex-end;\n text-align: end;\n margin-inline-end: 0;\n padding-inline-end: 0;\n\n ${StepMarker}::before {\n inset-inline-end: 0;\n }\n }\n\n &:has(:focus-visible) {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n `;\n }\n);\n\nStyleHorizontalStepMarkers.defaultProps = defaultThemeProp;\n\nexport const StyledVerticalStepMarkers = styled.ol`\n list-style-type: none;\n`;\n\nexport const StyledBulletWrapper = styled.div<{\n hasNext: boolean;\n prior: boolean;\n}>(({ theme, hasNext, prior }) => {\n const {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n animation: { speed: animationSpeed },\n palette: { interactive }\n },\n components: {\n 'form-control': { 'border-color': borderColor }\n }\n } = theme;\n\n const baseLineWidth = '0.125rem';\n const lineWidth = prior ? `calc(2 * ${baseLineWidth})` : baseLineWidth;\n\n const { bigStepMarkerSize } = calculateStepMarkerSizes(fontSize, fontScale);\n\n return css`\n position: relative;\n min-width: 2rem;\n\n ${hasNext &&\n css`\n &::after {\n content: '';\n position: absolute;\n\n /* Center the line horizontally and vertically relative to the step marker */\n inset-block-start: calc(${bigStepMarkerSize});\n inset-inline-start: calc(50% - (${lineWidth} / 2));\n width: ${lineWidth};\n height: 100%;\n background: ${prior ? interactive : borderColor};\n transition: background calc(2 * ${animationSpeed});\n\n @media (forced-colors: active) {\n background: ${prior ? 'Highlight' : 'CanvasText'};\n }\n }\n `}\n `;\n});\n\nStyledBulletWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStepText = styled.div(({ theme }) => {\n return css`\n padding-block: ${theme.base.spacing};\n overflow-wrap: break-word;\n `;\n});\n\nStyledStepText.defaultProps = defaultThemeProp;\n\nexport const StyledHorizontalStepText = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n padding-block: ${theme.base.spacing};\n overflow-wrap: break-word;\n min-width: inherit;\n font-size: ${fontSize.xxs};\n text-align: inherit;\n `;\n});\n\nStyledHorizontalStepText.defaultProps = defaultThemeProp;\n\nexport const StyleHorizontalBarList = styled.ol<{ showStepNames?: boolean }>(\n ({ showStepNames, theme }) => {\n return css`\n list-style-type: none;\n\n li {\n display: flex;\n position: relative;\n flex: 1 1 0;\n min-width: ${`${showStepNames ? stepItemMinWidth : stepBarMinWidth}ch`};\n flex-direction: column;\n align-items: stretch;\n text-align: center;\n }\n\n li:first-child {\n text-align: start;\n }\n\n li:last-child {\n text-align: end;\n }\n\n &:has(:focus-visible) {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n `;\n }\n);\n\nStyleHorizontalBarList.defaultProps = defaultThemeProp;\n\nexport const StyledHorizontalBarSegment = styled(BareButton)<{\n current: boolean;\n completed?: boolean;\n clickable?: boolean;\n}>(({ current, completed, clickable, theme }) => {\n const {\n base: {\n 'font-size': fontSize,\n animation: {\n speed: animationSpeed,\n timing: { ease: animationTiming }\n },\n palette: { interactive, 'primary-background': primaryBackground },\n shadow: { focus: focusShadow },\n 'hit-area': { 'finger-min': touchButtonSize }\n },\n components: {\n 'form-control': { 'border-color': borderColor, 'border-width': borderWidth },\n 'multi-step-form': { 'bar-indicator-border-radius': barIndicatorBorderRadius }\n }\n } = theme;\n\n const maxBarHeight = `calc(${fontSize} * 0.75)`;\n const barHeight = current ? maxBarHeight : `calc(${fontSize} * 0.5)`;\n const hoverBackground = tryCatch(\n () => lighten(0.1, interactive),\n () => interactive\n );\n\n return css`\n position: relative;\n display: block;\n width: 100%;\n height: ${barHeight};\n margin-block: calc((${maxBarHeight} - ${barHeight}) / 2);\n border: ${borderWidth} solid transparent;\n border-radius: ${barIndicatorBorderRadius};\n background: ${current || completed ? interactive : primaryBackground};\n transition:\n background calc(2 * ${animationSpeed}) ${animationTiming},\n border-color calc(2 * ${animationSpeed}) ${animationTiming};\n\n ${!current &&\n css`\n border-color: ${clickable ? interactive : borderColor};\n\n @media (forced-colors: active) {\n border-color: Highlight;\n }\n `}\n\n ${clickable &&\n css`\n cursor: pointer;\n\n ${!current &&\n css`\n &:hover {\n background: ${hoverBackground};\n }\n `}\n `}\n\n &:focus-visible {\n box-shadow: ${focusShadow};\n\n @media (forced-colors: active) {\n outline: 0.125rem solid Highlight;\n outline-offset: 0.125rem;\n }\n }\n\n @media (forced-colors: active) {\n background: ${current || completed ? 'Highlight' : 'CanvasText'};\n }\n\n /* Touch hit-area expansion without affecting layout */\n &::after {\n content: '';\n position: absolute;\n inset-block: calc((${touchButtonSize} - ${barHeight}) / -2);\n inset-inline: 0;\n }\n `;\n});\n\nStyledHorizontalBarSegment.defaultProps = defaultThemeProp;\n\nexport const StyledVerticalBarWrapper = styled.div(({ theme }) => {\n return css`\n min-width: 2rem;\n padding-block: calc(${theme.base.spacing} / 2);\n `;\n});\n\nStyledVerticalBarWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledVerticalBarSegment = styled(BareButton)<{\n current: boolean;\n completed?: boolean;\n clickable?: boolean;\n}>(({ current, completed, clickable, theme }) => {\n const {\n base: {\n 'font-size': fontSize,\n animation: { speed: animationSpeed },\n palette: { interactive, 'primary-background': primaryBackground },\n shadow: { focus: focusShadow },\n 'hit-area': { 'finger-min': touchButtonSize }\n },\n components: {\n 'form-control': { 'border-color': borderColor, 'border-width': borderWidth },\n 'multi-step-form': { 'bar-indicator-border-radius': barIndicatorBorderRadius }\n }\n } = theme;\n\n const barWidth = current ? `calc(${fontSize} * 0.75)` : `calc(${fontSize} * 0.5)`;\n const hoverBackground = tryCatch(\n () => lighten(0.1, interactive),\n () => interactive\n );\n\n return css`\n position: relative;\n display: block;\n width: ${barWidth};\n min-height: ${stepVerticalBarMinHeight};\n flex: 1 1 0;\n border: ${borderWidth} solid transparent;\n border-radius: ${barIndicatorBorderRadius};\n background: ${current || completed ? interactive : primaryBackground};\n transition:\n background calc(2 * ${animationSpeed}),\n border-color calc(2 * ${animationSpeed});\n\n ${!current &&\n css`\n border-color: ${clickable ? interactive : borderColor};\n\n @media (forced-colors: active) {\n border-color: Highlight;\n }\n `}\n\n ${clickable &&\n css`\n cursor: pointer;\n\n ${!current &&\n css`\n &:hover {\n background: ${hoverBackground};\n }\n `}\n `}\n\n &:focus-visible {\n box-shadow: ${focusShadow};\n\n @media (forced-colors: active) {\n outline: 0.125rem solid Highlight;\n outline-offset: 0.125rem;\n }\n }\n\n @media (forced-colors: active) {\n background: ${current || completed ? 'Highlight' : 'CanvasText'};\n }\n\n /* Touch hit-area expansion without affecting layout */\n &::after {\n content: '';\n position: absolute;\n inset-block: 0;\n inset-inline: calc((${touchButtonSize} - ${barWidth}) / -2);\n }\n `;\n});\n\nStyledVerticalBarSegment.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"FormProgress.styles.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/FormProgress.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,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;;;;;4BAQzC,eAAe,MAAM,QAAQ;;GAEtD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,wBAAwB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { lighten, size } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport BareButton from '../Button/BareButton';\nimport Popover from '../Popover';\nimport { StyledText } from '../Text';\nimport { calculateFontSize, type FontSize } from '../../styles';\nimport { useDirection } from '../../hooks';\nimport Flex from '../Flex';\nimport { ellipsisOverflow } from '../../styles/mixins';\n\nimport type { Step } from './MultiStepForm.types';\n\n/** Min width of each step item including labels in ch units */\nexport const stepItemMinWidth = 15;\n\n/** Min width of step marker without labels in ch units */\nexport const stepMarkerMinWidth = 3;\n\n/** Min width of each bar segment in bars mode in ch units */\nexport const stepBarMinWidth = 3;\n\n/** Min height of each vertical bar segment in bars mode */\nexport const stepVerticalBarMinHeight = '2.5rem';\n\nexport const CurrentStepPopover = styled(Popover)`\n max-width: 100%;\n background-color: transparent;\n z-index: 0;\n box-shadow: none;\n animation: none;\n\n & > ${StyledText} {\n ${ellipsisOverflow}\n }\n`;\n\nconst calculateStepMarkerSizes = (fontSize: string, fontScale: string | number) => {\n const { m: stepMarkerSize } = calculateFontSize(fontSize, fontScale);\n return {\n stepMarkerSize,\n smallStepMarkerSize: `calc(${stepMarkerSize} / 1.5)`,\n bigStepMarkerSize: `calc(${stepMarkerSize} * 1.5)`\n };\n};\n\nconst calculateBarTopPadding = (\n fontSize: string,\n fontScale: string | number,\n lineHeight: string\n) => {\n const { bigStepMarkerSize } = calculateStepMarkerSizes(fontSize, fontScale);\n return {\n // assuming the step progress always contains current step marker which is the biggest one,\n // the top padding of the bar should be half of the big step marker size minus line height of the bar\n // to be vertically centered\n stepBarTopPadding: `calc((${bigStepMarkerSize} / 2) - (${lineHeight} / 2))`\n };\n};\n\nexport const StyledBar = styled.div<{ shifted?: boolean }>(({ shifted, theme }) => {\n const {\n base: { 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n 'form-control': { 'border-color': borderColor }\n }\n } = theme;\n\n const lineHeight = '0.125rem';\n const { stepBarTopPadding } = calculateBarTopPadding(fontSize, fontScale, lineHeight);\n\n return css`\n position: absolute;\n ${shifted && `inset-block-start: ${stepBarTopPadding};`}\n width: 100%;\n height: ${lineHeight};\n background: ${borderColor};\n\n @media (forced-colors: active) {\n background: CanvasText;\n }\n `;\n});\n\nStyledBar.defaultProps = defaultThemeProp;\n\nexport const StyledFill = styled.div<{ fillScale: number }>(({ fillScale, theme }) => {\n const {\n base: {\n animation: {\n speed: animationSpeed,\n timing: { ease: animationTiming }\n },\n palette: { interactive }\n }\n } = theme;\n\n const { ltr } = useDirection();\n\n const markedLineThicknessFactor = 2;\n\n return css`\n position: absolute;\n width: 100%;\n height: calc(100% * ${markedLineThicknessFactor});\n\n /* top position based on line thickness factor to keep the fill centered */\n top: calc(-50% * (${markedLineThicknessFactor} - 1));\n background: ${interactive};\n transition: all calc(2 * ${animationSpeed}) ${animationTiming};\n transform: scaleX(${fillScale});\n transform-origin: ${ltr ? 0 : '100%'} 0;\n\n @media (forced-colors: active) {\n background: Highlight;\n }\n `;\n});\n\nStyledFill.defaultProps = defaultThemeProp;\n\nexport const StyledFormProgress = styled(Flex)<{ showStepNames?: boolean }>(({\n showStepNames,\n theme\n}) => {\n const {\n base: { spacing, 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n text: {\n h4: { 'font-size': h3fontSize }\n }\n }\n } = theme;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n position: relative;\n ${!showStepNames &&\n `padding-block-end: calc(${spacing} + ${fontSizes[h3fontSize as FontSize]} * 1.35);`}\n `;\n});\n\nStyledFormProgress.defaultProps = defaultThemeProp;\n\nexport const StepMarker = styled(BareButton)<{\n current: boolean;\n depth: Step['depth'];\n completed?: Step['completed'];\n clickable?: boolean;\n}>(({ current, depth, completed, clickable, theme }) => {\n const {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n animation: {\n speed: animationSpeed,\n timing: { ease: animationTiming }\n },\n palette: { interactive, 'primary-background': primaryBackground },\n shadow: { focus: focusShadow },\n 'hit-area': { 'mouse-min': buttonSize, 'finger-min': touchButtonSize }\n },\n components: {\n 'form-control': { 'border-color': borderColor, 'border-width': borderWidth }\n }\n } = theme;\n\n const { stepMarkerSize, smallStepMarkerSize, bigStepMarkerSize } = calculateStepMarkerSizes(\n fontSize,\n fontScale\n );\n\n // Determine the actual size for this marker based on its state\n let markerSize = stepMarkerSize;\n if (current) {\n markerSize = bigStepMarkerSize;\n } else if (depth === 1) {\n markerSize = smallStepMarkerSize;\n }\n\n return css`\n position: relative;\n z-index: 1;\n\n /* Fixed container size based on the biggest marker to prevent layout shifts */\n ${size(bigStepMarkerSize)}\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n\n ${clickable\n ? css`\n border-color: ${interactive};\n `\n : css`\n cursor: default;\n `}\n\n &::before {\n content: '';\n ${size(markerSize)}\n position: absolute;\n border-radius: 100%;\n transition: all calc(2 * ${animationSpeed}) ${animationTiming};\n }\n\n &:focus-visible::before {\n box-shadow: ${focusShadow};\n\n @media (forced-colors: active) {\n outline: 0.125rem solid Highlight;\n outline-offset: 0.125rem;\n }\n }\n\n ${!current &&\n css`\n border-color: transparent;\n background: transparent;\n\n &::before {\n background: ${primaryBackground};\n border: calc(2 * ${borderWidth}) solid ${clickable ? interactive : borderColor};\n\n ${completed &&\n css`\n background: ${interactive};\n border-color: ${interactive};\n `}\n\n @media (forced-colors: active) {\n background: ${completed ? 'Highlight' : 'Canvas'};\n border-color: ${clickable ? 'Highlight' : 'CanvasText'};\n }\n }\n `}\n\n ${current &&\n css`\n &::before {\n background: ${interactive};\n\n @media (forced-colors: active) {\n background: Highlight;\n }\n }\n `}\n\n ::after {\n content: '';\n position: absolute;\n ${size(buttonSize)}\n inset-block-start: ${`calc((${buttonSize} - ${bigStepMarkerSize}) / -2) `};\n inset-inline-start: ${`calc((${buttonSize} - ${bigStepMarkerSize}) / -2) `};\n\n @media (pointer: coarse) {\n inset-block-start: ${`calc((${touchButtonSize} - ${bigStepMarkerSize}) / -2) `};\n inset-inline-start: ${`calc((${touchButtonSize} - ${bigStepMarkerSize}) / -2) `};\n ${size(touchButtonSize)}\n }\n }\n `;\n});\n\nStepMarker.defaultProps = defaultThemeProp;\n\nexport const StyleHorizontalStepMarkers = styled.ol<{ showStepNames?: boolean }>(\n ({ showStepNames, theme }) => {\n return css`\n list-style-type: none;\n justify-content: space-between;\n\n li {\n display: flex;\n position: relative;\n flex: 1 1 0;\n\n /* min width changes based on whether step names are shown */\n min-width: ${`${showStepNames ? stepItemMinWidth : stepMarkerMinWidth}ch`};\n font-size: small;\n margin-inline: ${theme.base.spacing};\n flex-direction: column;\n align-items: center;\n text-align: center;\n }\n\n li:first-child,\n li:last-child {\n flex: 0.5 1 0;\n /* stylelint-disable-next-line unit-allowed-list */\n min-width: ${`${showStepNames ? stepItemMinWidth / 2 : stepMarkerMinWidth / 2}ch`};\n }\n\n li:first-child {\n align-items: flex-start;\n text-align: start;\n margin-inline-start: 0;\n padding-inline-start: 0;\n\n ${StepMarker}::before {\n inset-inline-start: 0;\n }\n }\n\n li:last-child {\n align-items: flex-end;\n text-align: end;\n margin-inline-end: 0;\n padding-inline-end: 0;\n\n ${StepMarker}::before {\n inset-inline-end: 0;\n }\n }\n\n &:has(:focus-visible) {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n `;\n }\n);\n\nStyleHorizontalStepMarkers.defaultProps = defaultThemeProp;\n\nexport const StyledVerticalStepMarkers = styled.ol`\n list-style-type: none;\n`;\n\nexport const StyledBulletWrapper = styled.div<{\n hasNext: boolean;\n prior: boolean;\n}>(({ theme, hasNext, prior }) => {\n const {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n animation: { speed: animationSpeed },\n palette: { interactive }\n },\n components: {\n 'form-control': { 'border-color': borderColor }\n }\n } = theme;\n\n const baseLineWidth = '0.125rem';\n const lineWidth = prior ? `calc(2 * ${baseLineWidth})` : baseLineWidth;\n\n const { bigStepMarkerSize } = calculateStepMarkerSizes(fontSize, fontScale);\n\n return css`\n position: relative;\n min-width: 2rem;\n\n ${hasNext &&\n css`\n &::after {\n content: '';\n position: absolute;\n\n /* Center the line horizontally and vertically relative to the step marker */\n inset-block-start: calc(${bigStepMarkerSize});\n inset-inline-start: calc(50% - (${lineWidth} / 2));\n width: ${lineWidth};\n height: 100%;\n background: ${prior ? interactive : borderColor};\n transition: background calc(2 * ${animationSpeed});\n\n @media (forced-colors: active) {\n background: ${prior ? 'Highlight' : 'CanvasText'};\n }\n }\n `}\n `;\n});\n\nStyledBulletWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStepText = styled.div(({ theme }) => {\n return css`\n padding-block: ${theme.base.spacing};\n overflow-wrap: break-word;\n `;\n});\n\nStyledStepText.defaultProps = defaultThemeProp;\n\nexport const StyledHorizontalStepText = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n padding-block: ${theme.base.spacing};\n overflow-wrap: break-word;\n min-width: inherit;\n font-size: ${fontSize.xxs};\n text-align: inherit;\n `;\n});\n\nStyledHorizontalStepText.defaultProps = defaultThemeProp;\n\nexport const StyleHorizontalBarList = styled.ol<{ showStepNames?: boolean }>(\n ({ showStepNames, theme }) => {\n return css`\n list-style-type: none;\n\n li {\n display: flex;\n position: relative;\n flex: 1 1 0;\n min-width: ${`${showStepNames ? stepItemMinWidth : stepBarMinWidth}ch`};\n flex-direction: column;\n align-items: stretch;\n text-align: center;\n }\n\n li:first-child {\n text-align: start;\n }\n\n li:last-child {\n text-align: end;\n }\n\n &:has(:focus-visible) {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n `;\n }\n);\n\nStyleHorizontalBarList.defaultProps = defaultThemeProp;\n\nexport const StyledHorizontalBarSegment = styled(BareButton)<{\n current: boolean;\n completed?: boolean;\n clickable?: boolean;\n}>(({ current, completed, clickable, theme }) => {\n const {\n base: {\n 'font-size': fontSize,\n animation: {\n speed: animationSpeed,\n timing: { ease: animationTiming }\n },\n palette: { interactive, 'primary-background': primaryBackground },\n shadow: { focus: focusShadow },\n 'hit-area': { 'finger-min': touchButtonSize }\n },\n components: {\n 'form-control': { 'border-color': borderColor, 'border-width': borderWidth },\n 'multi-step-form': { 'bar-indicator-border-radius': barIndicatorBorderRadius }\n }\n } = theme;\n\n const maxBarHeight = `calc(${fontSize} * 0.75)`;\n const barHeight = current ? maxBarHeight : `calc(${fontSize} * 0.5)`;\n const hoverBackground = tryCatch(\n () => lighten(0.1, interactive),\n () => interactive\n );\n const filledBackground = completed && !clickable && !current ? borderColor : interactive;\n\n return css`\n position: relative;\n display: block;\n width: 100%;\n height: ${barHeight};\n margin-block: calc((${maxBarHeight} - ${barHeight}) / 2);\n border: ${borderWidth} solid transparent;\n border-radius: ${barIndicatorBorderRadius};\n background: ${current || completed ? filledBackground : primaryBackground};\n transition:\n background calc(2 * ${animationSpeed}) ${animationTiming},\n border-color calc(2 * ${animationSpeed}) ${animationTiming};\n\n ${!current &&\n css`\n border-color: ${clickable ? interactive : borderColor};\n\n @media (forced-colors: active) {\n border-color: Highlight;\n }\n `}\n\n ${clickable &&\n css`\n cursor: pointer;\n\n ${!current &&\n css`\n &:hover {\n background: ${hoverBackground};\n }\n `}\n `}\n\n &:focus-visible {\n box-shadow: ${focusShadow};\n\n @media (forced-colors: active) {\n outline: 0.125rem solid Highlight;\n outline-offset: 0.125rem;\n }\n }\n\n @media (forced-colors: active) {\n background: ${current || completed ? 'Highlight' : 'CanvasText'};\n }\n\n /* Touch hit-area expansion without affecting layout */\n &::after {\n content: '';\n position: absolute;\n inset-block: calc((${touchButtonSize} - ${barHeight}) / -2);\n inset-inline: 0;\n }\n `;\n});\n\nStyledHorizontalBarSegment.defaultProps = defaultThemeProp;\n\nexport const StyledVerticalBarWrapper = styled.div(({ theme }) => {\n return css`\n min-width: 2rem;\n padding-block: calc(${theme.base.spacing} / 2);\n `;\n});\n\nStyledVerticalBarWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledVerticalBarSegment = styled(BareButton)<{\n current: boolean;\n completed?: boolean;\n clickable?: boolean;\n}>(({ current, completed, clickable, theme }) => {\n const {\n base: {\n 'font-size': fontSize,\n animation: { speed: animationSpeed },\n palette: { interactive, 'primary-background': primaryBackground },\n shadow: { focus: focusShadow },\n 'hit-area': { 'finger-min': touchButtonSize }\n },\n components: {\n 'form-control': { 'border-color': borderColor, 'border-width': borderWidth },\n 'multi-step-form': { 'bar-indicator-border-radius': barIndicatorBorderRadius }\n }\n } = theme;\n\n const barWidth = current ? `calc(${fontSize} * 0.75)` : `calc(${fontSize} * 0.5)`;\n const hoverBackground = tryCatch(\n () => lighten(0.1, interactive),\n () => interactive\n );\n const filledBackground = completed && !clickable && !current ? borderColor : interactive;\n\n return css`\n position: relative;\n display: block;\n width: ${barWidth};\n min-height: ${stepVerticalBarMinHeight};\n flex: 1 1 0;\n border: ${borderWidth} solid transparent;\n border-radius: ${barIndicatorBorderRadius};\n background: ${current || completed ? filledBackground : primaryBackground};\n transition:\n background calc(2 * ${animationSpeed}),\n border-color calc(2 * ${animationSpeed});\n\n ${!current &&\n css`\n border-color: ${clickable ? interactive : borderColor};\n\n @media (forced-colors: active) {\n border-color: Highlight;\n }\n `}\n\n ${clickable &&\n css`\n cursor: pointer;\n\n ${!current &&\n css`\n &:hover {\n background: ${hoverBackground};\n }\n `}\n `}\n\n &:focus-visible {\n box-shadow: ${focusShadow};\n\n @media (forced-colors: active) {\n outline: 0.125rem solid Highlight;\n outline-offset: 0.125rem;\n }\n }\n\n @media (forced-colors: active) {\n background: ${current || completed ? 'Highlight' : 'CanvasText'};\n }\n\n /* Touch hit-area expansion without affecting layout */\n &::after {\n content: '';\n position: absolute;\n inset-block: 0;\n inset-inline: calc((${touchButtonSize} - ${barWidth}) / -2);\n }\n `;\n});\n\nStyledVerticalBarSegment.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiStepForm.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/MultiStepForm.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAWnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAIhE,eAAO,MAAM,UAAU;cAA2B,OAAO;cAAY,OAAO;YAuB3E,CAAC;AAIF,eAAO,MAAM,iBAAiB,6NAAe,CAAC;AAE9C,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oLAIjC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;uIAqBpC,CAAC;AAIH,QAAA,MAAM,aAAa,EAAE,+BAA+B,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"MultiStepForm.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/MultiStepForm.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAWnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAIhE,eAAO,MAAM,UAAU;cAA2B,OAAO;cAAY,OAAO;YAuB3E,CAAC;AAIF,eAAO,MAAM,iBAAiB,6NAAe,CAAC;AAE9C,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oLAIjC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;uIAqBpC,CAAC;AAIH,QAAA,MAAM,aAAa,EAAE,+BAA+B,CAAC,kBAAkB,CA+MtE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -123,13 +123,6 @@ const MultiStepForm = forwardRef(function MultiStepForm({ currentStepId, steps,
|
|
|
123
123
|
setFocus();
|
|
124
124
|
}
|
|
125
125
|
}, [currentStepId, previousId]);
|
|
126
|
-
// Set focus if the form content updates while focus is within the actions region of the form
|
|
127
|
-
useAfterInitialEffect(() => {
|
|
128
|
-
if (multiStepActionsRef.current &&
|
|
129
|
-
multiStepActionsRef.current.contains(document.activeElement)) {
|
|
130
|
-
setFocus();
|
|
131
|
-
}
|
|
132
|
-
}, [currentStep.content]);
|
|
133
126
|
// Set focus if a progress state resolves
|
|
134
127
|
useAfterInitialEffect(() => {
|
|
135
128
|
if (!progress) {
|