@pega/cosmos-react-core 9.45.0 → 9.47.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/Checkbox/Checkbox.d.ts +1 -1
- package/lib/components/Checkbox/Checkbox.test-ids.d.ts +1 -1
- package/lib/components/Checkbox/Checkbox.test-ids.d.ts.map +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/lib/components/ColorPicker/ColorPicker.d.ts +1 -1
- package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts +1 -1
- package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +2 -2
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.types.d.ts +2 -0
- package/lib/components/ComboBox/ComboBox.types.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.types.js.map +1 -1
- package/lib/components/ComboBox/ComboxBox.test-ids.d.ts +1 -1
- package/lib/components/ComboBox/ComboxBox.test-ids.d.ts.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.d.ts +1 -1
- package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts +1 -1
- package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts.map +1 -1
- package/lib/components/Currency/Currency.test-ids.d.ts +1 -1
- package/lib/components/Currency/Currency.test-ids.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.d.ts +1 -1
- package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.js +2 -2
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.styles.d.ts +1 -1
- package/lib/components/DateTime/DateTime.test-ids.d.ts +10 -10
- package/lib/components/DateTime/DateTime.test-ids.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts +3 -1
- package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +2 -2
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.d.ts +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts +3 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +2 -2
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +1 -1
- package/lib/components/DateTime/Input/Duration/DurationInput.d.ts +1 -1
- package/lib/components/DateTime/Input/MonthInput.d.ts +1 -1
- package/lib/components/DateTime/Input/QuarterInput.d.ts +1 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts +3 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +2 -2
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts +1 -1
- package/lib/components/DateTime/Input/WeekInput.d.ts +1 -1
- package/lib/components/FieldGroup/FieldGroup.d.ts +4 -0
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +5 -4
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/File/File.test-ids.d.ts +1 -1
- package/lib/components/File/File.test-ids.d.ts.map +1 -1
- package/lib/components/File/FileInput.d.ts +3 -1
- package/lib/components/File/FileInput.d.ts.map +1 -1
- package/lib/components/File/FileInput.js +4 -4
- package/lib/components/File/FileInput.js.map +1 -1
- package/lib/components/File/FileInput.styles.d.ts +1 -1
- package/lib/components/FormControl/FormControl.d.ts +3 -0
- package/lib/components/FormControl/FormControl.d.ts.map +1 -1
- package/lib/components/FormControl/FormControl.js.map +1 -1
- package/lib/components/FormField/FormField.d.ts +1 -1
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js +14 -9
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/FormField/FormField.test-ids.d.ts +2 -2
- package/lib/components/FormField/FormField.test-ids.d.ts.map +1 -1
- package/lib/components/FormField/FormField.test-ids.js +1 -0
- package/lib/components/FormField/FormField.test-ids.js.map +1 -1
- package/lib/components/Icon/iconNames.d.ts +1 -1
- package/lib/components/Icon/iconNames.d.ts.map +1 -1
- package/lib/components/Icon/iconNames.js +1 -0
- package/lib/components/Icon/iconNames.js.map +1 -1
- package/lib/components/Icon/icons/related-content.icon.d.ts +5 -0
- package/lib/components/Icon/icons/related-content.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/related-content.icon.js +7 -0
- package/lib/components/Icon/icons/related-content.icon.js.map +1 -0
- package/lib/components/Icon/streamline-icons/related-content.icon.d.ts +5 -0
- package/lib/components/Icon/streamline-icons/related-content.icon.d.ts.map +1 -0
- package/lib/components/Icon/streamline-icons/related-content.icon.js +7 -0
- package/lib/components/Icon/streamline-icons/related-content.icon.js.map +1 -0
- package/lib/components/Icon/streamlineIconNames.d.ts +1 -1
- package/lib/components/Icon/streamlineIconNames.d.ts.map +1 -1
- package/lib/components/Icon/streamlineIconNames.js +1 -0
- package/lib/components/Icon/streamlineIconNames.js.map +1 -1
- package/lib/components/Input/Input.d.ts +1 -1
- package/lib/components/Input/Input.d.ts.map +1 -1
- package/lib/components/Input/Input.js +2 -2
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/Input/Input.test-ids.d.ts +1 -1
- package/lib/components/Input/Input.test-ids.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.js +17 -3
- package/lib/components/Lightbox/Lightbox.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.styles.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.styles.js +104 -1
- package/lib/components/Lightbox/Lightbox.styles.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.types.d.ts +11 -1
- package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.types.js.map +1 -1
- package/lib/components/Lightbox/LightboxPdfViewer.js +1 -1
- package/lib/components/Lightbox/LightboxPdfViewer.js.map +1 -1
- package/lib/components/Location/Location.test-ids.d.ts +1 -1
- package/lib/components/Location/Location.test-ids.d.ts.map +1 -1
- package/lib/components/Location/LocationInput.d.ts +1 -1
- package/lib/components/Location/LocationInput.d.ts.map +1 -1
- package/lib/components/Location/LocationInput.js +2 -2
- package/lib/components/Location/LocationInput.js.map +1 -1
- package/lib/components/Number/Number.test-ids.d.ts +2 -2
- package/lib/components/Number/Number.test-ids.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.d.ts +1 -1
- package/lib/components/Number/NumberInput.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.js +2 -2
- package/lib/components/Number/NumberInput.js.map +1 -1
- package/lib/components/Number/NumberInput.types.d.ts +2 -0
- package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.types.js.map +1 -1
- package/lib/components/Number/NumberRangeInput.d.ts +1 -1
- package/lib/components/Phone/Phone.test-ids.d.ts +1 -1
- package/lib/components/Phone/Phone.test-ids.d.ts.map +1 -1
- package/lib/components/Phone/PhoneInput.d.ts +1 -1
- package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
- package/lib/components/Phone/PhoneInput.js +2 -2
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/RadioButton/RadioButton.d.ts +1 -1
- package/lib/components/RadioButton/RadioButton.test-ids.d.ts +1 -1
- package/lib/components/RadioButton/RadioButton.test-ids.d.ts.map +1 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
- package/lib/components/RadioCheck/RadioCheck.d.ts +3 -1
- package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.js +2 -2
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.test-ids.d.ts +1 -1
- package/lib/components/RadioCheck/RadioCheck.test-ids.d.ts.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts +3 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.test-ids.d.ts +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.test-ids.d.ts.map +1 -1
- package/lib/components/RelatedContent/RelatedContentButton.d.ts +17 -0
- package/lib/components/RelatedContent/RelatedContentButton.d.ts.map +1 -0
- package/lib/components/RelatedContent/RelatedContentButton.js +18 -0
- package/lib/components/RelatedContent/RelatedContentButton.js.map +1 -0
- package/lib/components/RelatedContent/RelatedContentPanel.d.ts +7 -0
- package/lib/components/RelatedContent/RelatedContentPanel.d.ts.map +1 -0
- package/lib/components/RelatedContent/RelatedContentPanel.js +136 -0
- package/lib/components/RelatedContent/RelatedContentPanel.js.map +1 -0
- package/lib/components/RelatedContent/RelatedContentPanel.styles.d.ts +34 -0
- package/lib/components/RelatedContent/RelatedContentPanel.styles.d.ts.map +1 -0
- package/lib/components/RelatedContent/RelatedContentPanel.styles.js +180 -0
- package/lib/components/RelatedContent/RelatedContentPanel.styles.js.map +1 -0
- package/lib/components/RelatedContent/RelatedContentPanel.test-ids.d.ts +2 -0
- package/lib/components/RelatedContent/RelatedContentPanel.test-ids.d.ts.map +1 -0
- package/lib/components/RelatedContent/RelatedContentPanel.test-ids.js +9 -0
- package/lib/components/RelatedContent/RelatedContentPanel.test-ids.js.map +1 -0
- package/lib/components/RelatedContent/RelatedContentPanel.types.d.ts +21 -0
- package/lib/components/RelatedContent/RelatedContentPanel.types.d.ts.map +1 -0
- package/lib/components/RelatedContent/RelatedContentPanel.types.js +2 -0
- package/lib/components/RelatedContent/RelatedContentPanel.types.js.map +1 -0
- package/lib/components/RelatedContent/index.d.ts +7 -0
- package/lib/components/RelatedContent/index.d.ts.map +1 -0
- package/lib/components/RelatedContent/index.js +5 -0
- package/lib/components/RelatedContent/index.js.map +1 -0
- package/lib/components/SearchInput/SearchInput.styles.d.ts +1 -1
- package/lib/components/Select/Select.d.ts +3 -1
- package/lib/components/Select/Select.d.ts.map +1 -1
- package/lib/components/Select/Select.js +2 -2
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Select/Select.test-ids.d.ts +1 -1
- package/lib/components/Select/Select.test-ids.d.ts.map +1 -1
- package/lib/components/Slider/Slider.d.ts +1 -1
- package/lib/components/Slider/Slider.d.ts.map +1 -1
- package/lib/components/Slider/Slider.js +2 -2
- package/lib/components/Slider/Slider.js.map +1 -1
- package/lib/components/Slider/Slider.test-ids.d.ts +1 -1
- package/lib/components/Slider/Slider.test-ids.d.ts.map +1 -1
- package/lib/components/Slider/Slider.types.d.ts +2 -0
- package/lib/components/Slider/Slider.types.d.ts.map +1 -1
- package/lib/components/Slider/Slider.types.js.map +1 -1
- package/lib/components/TextArea/TextArea.d.ts +1 -1
- package/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.js +2 -2
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/TextArea/TextArea.test-ids.d.ts +1 -1
- package/lib/components/TextArea/TextArea.test-ids.d.ts.map +1 -1
- package/lib/hooks/useI18n.d.ts +4 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +4 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +5 -0
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +4 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Icon, { registerIcon } from '../Icon';
|
|
4
|
+
import MetaList from '../MetaList';
|
|
5
|
+
import ResizeHandle from '../Drawer/ResizeHandle';
|
|
6
|
+
import Tooltip from '../Tooltip';
|
|
7
|
+
import { clamp, getChildOfRootNode, withTestIds } from '../../utils';
|
|
8
|
+
import { useAbortController, useBreakpoint, useConsolidatedRef, useDirection, useElement, useEscape, useI18n, useTestIds, useUID } from '../../hooks';
|
|
9
|
+
import { resizeDrawerKeyboardStep } from '../../styles/constants';
|
|
10
|
+
import * as arrowMicroLeftIcon from '../Icon/icons/arrow-micro-left.icon';
|
|
11
|
+
import * as arrowMicroRightIcon from '../Icon/icons/arrow-micro-right.icon';
|
|
12
|
+
import { getRelatedContentPanelTestIds } from './RelatedContentPanel.test-ids';
|
|
13
|
+
import { StyledCollapseButton, StyledDivider, StyledRelatedContentRegion, StyledRelatedContentPanel, StyledSecondaryBody, StyledSecondaryContent, StyledSecondaryHeader, StyledSecondaryHeaderActions, StyledSecondaryHeaderContent, StyledSecondaryPanel, StyledSecondaryTitle } from './RelatedContentPanel.styles';
|
|
14
|
+
registerIcon(arrowMicroLeftIcon, arrowMicroRightIcon);
|
|
15
|
+
const MIN_SHARE = 25;
|
|
16
|
+
const MAX_SHARE = 75;
|
|
17
|
+
const STARTING_SHARE = 50;
|
|
18
|
+
const RelatedContentPanel = forwardRef(function RelatedContentPanel({ primary, secondary, testId, ...props }, ref) {
|
|
19
|
+
const { content, label, metadata, collapsed: collapsedProp, onCollapse } = secondary;
|
|
20
|
+
const testIds = useTestIds(testId, getRelatedContentPanelTestIds);
|
|
21
|
+
const wide = useBreakpoint('md');
|
|
22
|
+
const [collapsedState, setCollapsedState] = useState(collapsedProp ?? !wide);
|
|
23
|
+
// An explicit prop sets the initial state, and later changes to it replace the current state.
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (collapsedProp === undefined)
|
|
26
|
+
return;
|
|
27
|
+
setCollapsedState(collapsedProp);
|
|
28
|
+
}, [collapsedProp]);
|
|
29
|
+
// Crossing the medium breakpoint collapses going smaller and expands going larger.
|
|
30
|
+
const previousWide = useRef(wide);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (previousWide.current === wide)
|
|
33
|
+
return;
|
|
34
|
+
previousWide.current = wide;
|
|
35
|
+
onCollapse?.(!wide);
|
|
36
|
+
if (collapsedProp === undefined)
|
|
37
|
+
setCollapsedState(!wide);
|
|
38
|
+
}, [wide, onCollapse, collapsedProp]);
|
|
39
|
+
const collapsible = !!onCollapse;
|
|
40
|
+
const collapsed = (collapsible || collapsedProp !== undefined) && collapsedState;
|
|
41
|
+
const t = useI18n();
|
|
42
|
+
const [share, setShare] = useState(STARTING_SHARE);
|
|
43
|
+
const { rtl, start, end } = useDirection();
|
|
44
|
+
const uid = useUID();
|
|
45
|
+
const widthVariable = `--related-content-panel-width-${uid}`;
|
|
46
|
+
const splitRef = useConsolidatedRef(ref);
|
|
47
|
+
const dragController = useRef();
|
|
48
|
+
const dragRoot = useRef();
|
|
49
|
+
const dragStartShare = useRef(STARTING_SHARE);
|
|
50
|
+
const getAbortController = useAbortController();
|
|
51
|
+
const [headerTitle, setHeaderTitle] = useElement();
|
|
52
|
+
const updateShare = useCallback((next) => {
|
|
53
|
+
const width = clamp(next, MIN_SHARE, MAX_SHARE);
|
|
54
|
+
splitRef.current?.style.setProperty(widthVariable, `${width}%`);
|
|
55
|
+
setShare(width);
|
|
56
|
+
}, [widthVariable]);
|
|
57
|
+
const shareRef = useRef(share);
|
|
58
|
+
shareRef.current = share;
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
updateShare(shareRef.current);
|
|
61
|
+
}, [updateShare]);
|
|
62
|
+
const stopDrag = useCallback(() => {
|
|
63
|
+
if (!dragController.current)
|
|
64
|
+
return;
|
|
65
|
+
dragController.current.abort();
|
|
66
|
+
dragController.current = undefined;
|
|
67
|
+
dragRoot.current?.style.removeProperty('user-select');
|
|
68
|
+
dragRoot.current = undefined;
|
|
69
|
+
}, []);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const windowContext = splitRef.current?.ownerDocument.defaultView;
|
|
72
|
+
windowContext?.addEventListener('blur', stopDrag);
|
|
73
|
+
return () => {
|
|
74
|
+
windowContext?.removeEventListener('blur', stopDrag);
|
|
75
|
+
stopDrag();
|
|
76
|
+
};
|
|
77
|
+
}, [stopDrag]);
|
|
78
|
+
// Cancel any in-progress drag when the second region is collapsed.
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (collapsed)
|
|
81
|
+
stopDrag();
|
|
82
|
+
}, [collapsed, stopDrag]);
|
|
83
|
+
useEscape(() => {
|
|
84
|
+
if (!dragController.current)
|
|
85
|
+
return;
|
|
86
|
+
updateShare(dragStartShare.current);
|
|
87
|
+
stopDrag();
|
|
88
|
+
});
|
|
89
|
+
const handleDrag = useCallback((event) => {
|
|
90
|
+
event.stopPropagation();
|
|
91
|
+
const targetNode = getChildOfRootNode(splitRef);
|
|
92
|
+
const size = splitRef.current?.getBoundingClientRect().width;
|
|
93
|
+
if (!targetNode || !size || event.button !== 0)
|
|
94
|
+
return;
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
stopDrag();
|
|
97
|
+
const dragStart = event.clientX;
|
|
98
|
+
const controller = getAbortController();
|
|
99
|
+
dragController.current = controller;
|
|
100
|
+
dragRoot.current = targetNode;
|
|
101
|
+
dragStartShare.current = share;
|
|
102
|
+
targetNode.style.setProperty('user-select', 'none');
|
|
103
|
+
targetNode.ownerDocument.addEventListener('mousemove', moveEvent => {
|
|
104
|
+
const delta = moveEvent.clientX - dragStart;
|
|
105
|
+
updateShare(share + (delta / size) * 100 * (rtl ? -1 : 1));
|
|
106
|
+
}, { passive: true, signal: controller.signal });
|
|
107
|
+
targetNode.ownerDocument.addEventListener('mouseup', stopDrag, {
|
|
108
|
+
once: true,
|
|
109
|
+
signal: controller.signal
|
|
110
|
+
});
|
|
111
|
+
}, [rtl, share, splitRef, getAbortController, updateShare, stopDrag]);
|
|
112
|
+
const handleKeyDown = useCallback((event, grabbed) => {
|
|
113
|
+
if (!grabbed)
|
|
114
|
+
return;
|
|
115
|
+
if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft')
|
|
116
|
+
return;
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
event.stopPropagation();
|
|
119
|
+
const resizeStep = resizeDrawerKeyboardStep * 100;
|
|
120
|
+
updateShare(share + (event.key === 'ArrowRight' ? resizeStep : -resizeStep) * (rtl ? -1 : 1));
|
|
121
|
+
}, [rtl, share, updateShare]);
|
|
122
|
+
// The caret points toward the edge the second region moves to.
|
|
123
|
+
const collapseDirection = end;
|
|
124
|
+
const expandDirection = start;
|
|
125
|
+
const overlay = !wide && !collapsed;
|
|
126
|
+
const resizeLabel = label ? t('resize_noun', [label]) : t('resize_noun', [t('panel')]);
|
|
127
|
+
const toggleText = collapsed ? t('expand') : t('collapse');
|
|
128
|
+
const toggle = collapsible ? (_jsx(StyledCollapseButton, { compact: true, icon: true, label: toggleText, "aria-label": label ? `${toggleText} - ${label}` : toggleText, "aria-expanded": !collapsed, "data-testid": testIds.collapseToggle, onClick: () => {
|
|
129
|
+
setCollapsedState(!collapsed);
|
|
130
|
+
onCollapse?.(!collapsed);
|
|
131
|
+
}, children: _jsx(Icon, { name: `arrow-micro-${collapsed ? expandDirection : collapseDirection}` }) })) : null;
|
|
132
|
+
const secondaryContent = label || metadata || toggle ? (_jsxs(StyledSecondaryPanel, { collapsed: collapsed, children: [_jsxs(StyledSecondaryHeader, { "data-testid": testIds.header, children: [_jsxs(StyledSecondaryHeaderContent, { children: [label && (_jsxs(_Fragment, { children: [_jsx(StyledSecondaryTitle, { "data-testid": testIds.title, variant: 'primary', as: 'h2', ref: setHeaderTitle, children: label }), _jsx(Tooltip, { smart: true, showDelay: 'none', hideDelay: 'none', target: headerTitle, children: label })] })), metadata && _jsx(MetaList, { "data-testid": testIds.metadata, items: metadata })] }), toggle && _jsx(StyledSecondaryHeaderActions, { children: toggle })] }), _jsx(StyledSecondaryBody, { children: content })] })) : (content);
|
|
133
|
+
return (_jsxs(StyledRelatedContentPanel, { ref: splitRef, wide: wide, widthVariable: widthVariable, share: STARTING_SHARE, collapsed: collapsed, "data-testid": testIds.root, ...props, children: [_jsx(StyledRelatedContentRegion, { overlay: overlay, primary: true, children: primary }), wide && !collapsed && (_jsx(StyledDivider, { wide: wide, share: STARTING_SHARE, widthVariable: widthVariable, children: _jsx(ResizeHandle, { onMouseDown: handleDrag, onKeyDown: handleKeyDown, contextualLabel: resizeLabel }) })), _jsx(StyledRelatedContentRegion, { overlay: overlay, "data-testid": testIds.secondary, children: _jsx(StyledSecondaryContent, { children: secondaryContent }) })] }));
|
|
134
|
+
});
|
|
135
|
+
export default withTestIds(RelatedContentPanel, getRelatedContentPanelTestIds);
|
|
136
|
+
//# sourceMappingURL=RelatedContentPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelatedContentPanel.js","sourceRoot":"","sources":["../../../src/components/RelatedContent/RelatedContentPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG7E,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,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AAC,QAAQ,mBAAc,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,GAAI,IAC5C,EAC9B,MAAM,IAAI,KAAC,4BAA4B,cAAE,MAAM,GAAgC,IAC1D,EACxB,KAAC,mBAAmB,cAAE,OAAO,GAAuB,IAC/B,CACxB,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CAAC;IAEJ,OAAO,CACL,MAAC,yBAAyB,IACxB,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,SAAS,iBACP,OAAO,CAAC,IAAI,KACrB,KAAK,aAET,KAAC,0BAA0B,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,kBAClD,OAAO,GACmB,EAC5B,IAAI,IAAI,CAAC,SAAS,IAAI,CACrB,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,YAC5E,KAAC,YAAY,IACX,WAAW,EAAE,UAAU,EACvB,SAAS,EAAE,aAAa,EACxB,eAAe,EAAE,WAAW,GAC5B,GACY,CACjB,EACD,KAAC,0BAA0B,IAAC,OAAO,EAAE,OAAO,iBAAe,OAAO,CAAC,SAAS,YAC1E,KAAC,sBAAsB,cAAE,gBAAgB,GAA0B,GACxC,IACH,CAC7B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\nimport type { PropsWithoutRef, KeyboardEvent, MouseEvent } from 'react';\n\nimport Icon, { registerIcon } from '../Icon';\nimport MetaList from '../MetaList';\nimport ResizeHandle from '../Drawer/ResizeHandle';\nimport Tooltip from '../Tooltip';\nimport { clamp, getChildOfRootNode, withTestIds } from '../../utils';\nimport {\n useAbortController,\n useBreakpoint,\n useConsolidatedRef,\n useDirection,\n useElement,\n useEscape,\n useI18n,\n useTestIds,\n useUID\n} from '../../hooks';\nimport type { WithAttributes } from '../../types';\nimport { resizeDrawerKeyboardStep } from '../../styles/constants';\nimport * as arrowMicroLeftIcon from '../Icon/icons/arrow-micro-left.icon';\nimport * as arrowMicroRightIcon from '../Icon/icons/arrow-micro-right.icon';\n\nimport { getRelatedContentPanelTestIds } from './RelatedContentPanel.test-ids';\nimport type { RelatedContentPanelProps } from './RelatedContentPanel.types';\nimport {\n StyledCollapseButton,\n StyledDivider,\n StyledRelatedContentRegion,\n StyledRelatedContentPanel,\n StyledSecondaryBody,\n StyledSecondaryContent,\n StyledSecondaryHeader,\n StyledSecondaryHeaderActions,\n StyledSecondaryHeaderContent,\n StyledSecondaryPanel,\n StyledSecondaryTitle\n} from './RelatedContentPanel.styles';\n\nregisterIcon(arrowMicroLeftIcon, arrowMicroRightIcon);\n\nconst MIN_SHARE = 25;\nconst MAX_SHARE = 75;\nconst STARTING_SHARE = 50;\n\nconst RelatedContentPanel = forwardRef<\n HTMLDivElement,\n PropsWithoutRef<WithAttributes<'div', RelatedContentPanelProps>>\n>(function RelatedContentPanel({ primary, secondary, testId, ...props }, ref) {\n const { content, label, metadata, collapsed: collapsedProp, onCollapse } = secondary;\n const testIds = useTestIds(testId, getRelatedContentPanelTestIds);\n const wide = useBreakpoint('md');\n const [collapsedState, setCollapsedState] = useState(collapsedProp ?? !wide);\n // An explicit prop sets the initial state, and later changes to it replace the current state.\n useEffect(() => {\n if (collapsedProp === undefined) return;\n setCollapsedState(collapsedProp);\n }, [collapsedProp]);\n // Crossing the medium breakpoint collapses going smaller and expands going larger.\n const previousWide = useRef(wide);\n useEffect(() => {\n if (previousWide.current === wide) return;\n previousWide.current = wide;\n onCollapse?.(!wide);\n if (collapsedProp === undefined) setCollapsedState(!wide);\n }, [wide, onCollapse, collapsedProp]);\n const collapsible = !!onCollapse;\n const collapsed = (collapsible || collapsedProp !== undefined) && collapsedState;\n const t = useI18n();\n const [share, setShare] = useState(STARTING_SHARE);\n const { rtl, start, end } = useDirection();\n const uid = useUID();\n const widthVariable = `--related-content-panel-width-${uid}`;\n const splitRef = useConsolidatedRef<HTMLDivElement>(ref);\n const dragController = useRef<AbortController>();\n const dragRoot = useRef<HTMLElement>();\n const dragStartShare = useRef(STARTING_SHARE);\n const getAbortController = useAbortController();\n const [headerTitle, setHeaderTitle] = useElement();\n\n const updateShare = useCallback(\n (next: number) => {\n const width = clamp(next, MIN_SHARE, MAX_SHARE);\n splitRef.current?.style.setProperty(widthVariable, `${width}%`);\n setShare(width);\n },\n [widthVariable]\n );\n\n const shareRef = useRef(share);\n shareRef.current = share;\n useEffect(() => {\n updateShare(shareRef.current);\n }, [updateShare]);\n\n const stopDrag = useCallback(() => {\n if (!dragController.current) return;\n dragController.current.abort();\n dragController.current = undefined;\n dragRoot.current?.style.removeProperty('user-select');\n dragRoot.current = undefined;\n }, []);\n\n useEffect(() => {\n const windowContext = splitRef.current?.ownerDocument.defaultView;\n windowContext?.addEventListener('blur', stopDrag);\n return () => {\n windowContext?.removeEventListener('blur', stopDrag);\n stopDrag();\n };\n }, [stopDrag]);\n\n // Cancel any in-progress drag when the second region is collapsed.\n useEffect(() => {\n if (collapsed) stopDrag();\n }, [collapsed, stopDrag]);\n\n useEscape(() => {\n if (!dragController.current) return;\n updateShare(dragStartShare.current);\n stopDrag();\n });\n\n const handleDrag = useCallback(\n (event: MouseEvent) => {\n event.stopPropagation();\n const targetNode = getChildOfRootNode(splitRef);\n const size = splitRef.current?.getBoundingClientRect().width;\n if (!targetNode || !size || event.button !== 0) return;\n\n event.preventDefault();\n stopDrag();\n const dragStart = event.clientX;\n const controller = getAbortController();\n dragController.current = controller;\n dragRoot.current = targetNode;\n dragStartShare.current = share;\n targetNode.style.setProperty('user-select', 'none');\n\n targetNode.ownerDocument.addEventListener(\n 'mousemove',\n moveEvent => {\n const delta = moveEvent.clientX - dragStart;\n updateShare(share + (delta / size) * 100 * (rtl ? -1 : 1));\n },\n { passive: true, signal: controller.signal }\n );\n targetNode.ownerDocument.addEventListener('mouseup', stopDrag, {\n once: true,\n signal: controller.signal\n });\n },\n [rtl, share, splitRef, getAbortController, updateShare, stopDrag]\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent, grabbed: boolean) => {\n if (!grabbed) return;\n if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft') return;\n event.preventDefault();\n event.stopPropagation();\n const resizeStep = resizeDrawerKeyboardStep * 100;\n updateShare(share + (event.key === 'ArrowRight' ? resizeStep : -resizeStep) * (rtl ? -1 : 1));\n },\n [rtl, share, updateShare]\n );\n\n // The caret points toward the edge the second region moves to.\n const collapseDirection = end;\n const expandDirection = start;\n const overlay = !wide && !collapsed;\n const resizeLabel = label ? t('resize_noun', [label]) : t('resize_noun', [t('panel')]);\n const toggleText = collapsed ? t('expand') : t('collapse');\n const toggle = collapsible ? (\n <StyledCollapseButton\n compact\n icon\n label={toggleText}\n aria-label={label ? `${toggleText} - ${label}` : toggleText}\n aria-expanded={!collapsed}\n data-testid={testIds.collapseToggle}\n onClick={() => {\n setCollapsedState(!collapsed);\n onCollapse?.(!collapsed);\n }}\n >\n <Icon name={`arrow-micro-${collapsed ? expandDirection : collapseDirection}`} />\n </StyledCollapseButton>\n ) : null;\n\n const secondaryContent =\n label || metadata || toggle ? (\n <StyledSecondaryPanel collapsed={collapsed}>\n <StyledSecondaryHeader data-testid={testIds.header}>\n <StyledSecondaryHeaderContent>\n {label && (\n <>\n <StyledSecondaryTitle\n data-testid={testIds.title}\n variant='primary'\n as='h2'\n ref={setHeaderTitle}\n >\n {label}\n </StyledSecondaryTitle>\n <Tooltip smart showDelay='none' hideDelay='none' target={headerTitle}>\n {label}\n </Tooltip>\n </>\n )}\n {metadata && <MetaList data-testid={testIds.metadata} items={metadata} />}\n </StyledSecondaryHeaderContent>\n {toggle && <StyledSecondaryHeaderActions>{toggle}</StyledSecondaryHeaderActions>}\n </StyledSecondaryHeader>\n <StyledSecondaryBody>{content}</StyledSecondaryBody>\n </StyledSecondaryPanel>\n ) : (\n content\n );\n\n return (\n <StyledRelatedContentPanel\n ref={splitRef}\n wide={wide}\n widthVariable={widthVariable}\n share={STARTING_SHARE}\n collapsed={collapsed}\n data-testid={testIds.root}\n {...props}\n >\n <StyledRelatedContentRegion overlay={overlay} primary>\n {primary}\n </StyledRelatedContentRegion>\n {wide && !collapsed && (\n <StyledDivider wide={wide} share={STARTING_SHARE} widthVariable={widthVariable}>\n <ResizeHandle\n onMouseDown={handleDrag}\n onKeyDown={handleKeyDown}\n contextualLabel={resizeLabel}\n />\n </StyledDivider>\n )}\n <StyledRelatedContentRegion overlay={overlay} data-testid={testIds.secondary}>\n <StyledSecondaryContent>{secondaryContent}</StyledSecondaryContent>\n </StyledRelatedContentRegion>\n </StyledRelatedContentPanel>\n );\n});\n\nexport default withTestIds(RelatedContentPanel, getRelatedContentPanelTestIds);\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const relatedContentPanelMaxBlockSize = "max(70vh)";
|
|
2
|
+
interface LayoutStyleProps {
|
|
3
|
+
wide: boolean;
|
|
4
|
+
/** Name of the custom property, set on the template element, holding the first region's percentage size. */
|
|
5
|
+
widthVariable: string;
|
|
6
|
+
share?: number;
|
|
7
|
+
}
|
|
8
|
+
interface TemplateStyleProps extends LayoutStyleProps {
|
|
9
|
+
collapsed?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const StyledRelatedContentPanel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, TemplateStyleProps>> & string;
|
|
12
|
+
export declare const StyledRelatedContentRegion: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
13
|
+
primary?: boolean;
|
|
14
|
+
/** Secondary region covers the primary region instead of sitting beside it. */
|
|
15
|
+
overlay?: boolean;
|
|
16
|
+
}>> & string;
|
|
17
|
+
export declare const StyledDivider: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, LayoutStyleProps>> & string;
|
|
18
|
+
export declare const StyledSecondaryHeaderContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
19
|
+
export declare const StyledSecondaryBody: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
20
|
+
export declare const StyledSecondaryPanel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
21
|
+
collapsed?: boolean;
|
|
22
|
+
}>> & string;
|
|
23
|
+
export declare const StyledSecondaryHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
|
|
24
|
+
export declare const StyledSecondaryHeaderActions: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
25
|
+
export declare const StyledCollapseButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("../Button").ButtonProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement> & import("../..").ForwardProps, "ref"> & {
|
|
26
|
+
ref?: ((instance: HTMLAnchorElement | 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<HTMLAnchorElement | HTMLButtonElement> | null | undefined;
|
|
27
|
+
}, never>> & string & Omit<import("../..").ForwardRefForwardPropsComponent<import("../Button").ButtonProps>, keyof import("react").Component<any, {}, any>>;
|
|
28
|
+
/** Fills the second region so the panel can collapse without unmounting. */
|
|
29
|
+
export declare const StyledSecondaryContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
30
|
+
export declare const StyledSecondaryTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("../Text").TextProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement | HTMLSpanElement> & import("../..").ForwardProps, "ref"> & {
|
|
31
|
+
ref?: ((instance: HTMLHeadingElement | HTMLSpanElement | 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<HTMLHeadingElement | HTMLSpanElement> | null | undefined;
|
|
32
|
+
}, never>> & string & Omit<import("../..").ForwardRefForwardPropsComponent<import("../Text").TextProps>, keyof import("react").Component<any, {}, any>>;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=RelatedContentPanel.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelatedContentPanel.styles.d.ts","sourceRoot":"","sources":["../../../src/components/RelatedContent/RelatedContentPanel.styles.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,+BAA+B,cAAc,CAAC;AAE3D,UAAU,gBAAgB;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,4GAA4G;IAC5G,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,kBAAmB,SAAQ,gBAAgB;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,yBAAyB,uPA0BrC,CAAC;AAGF,eAAO,MAAM,0BAA0B;cAC3B,OAAO;IACjB,+EAA+E;cACrE,OAAO;YA4ClB,CAAC;AAGF,eAAO,MAAM,aAAa,qPAQzB,CAAC;AAGF,eAAO,MAAM,4BAA4B,6NASvC,CAAC;AAGH,eAAO,MAAM,mBAAmB,6NAG/B,CAAC;AAEF,eAAO,MAAM,oBAAoB;gBAA4B,OAAO;YA2BlE,CAAC;AAGH,eAAO,MAAM,qBAAqB,uNAiBhC,CAAC;AAGH,eAAO,MAAM,4BAA4B,6NAIxC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;2JAU/B,CAAC;AAGH,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,6NAElC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;uJAO/B,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import Button from '../Button';
|
|
3
|
+
import { StyledIcon } from '../Icon';
|
|
4
|
+
import Text from '../Text';
|
|
5
|
+
import { defaultThemeProp } from '../../theme';
|
|
6
|
+
import { StyledMetaList } from '../MetaList/MetaList';
|
|
7
|
+
import { ellipsisOverflow } from '../../styles/mixins';
|
|
8
|
+
export const relatedContentPanelMaxBlockSize = 'max(70vh)';
|
|
9
|
+
export const StyledRelatedContentPanel = styled.div(({ wide, widthVariable, share = 50, collapsed }) => {
|
|
10
|
+
let columns = 'minmax(0, 1fr)';
|
|
11
|
+
if (collapsed)
|
|
12
|
+
columns = 'minmax(0, 1fr) max-content';
|
|
13
|
+
else if (wide)
|
|
14
|
+
columns = `minmax(0, var(${widthVariable}, ${share}%)) minmax(0, 1fr)`;
|
|
15
|
+
return css `
|
|
16
|
+
position: relative;
|
|
17
|
+
display: grid;
|
|
18
|
+
grid-template-columns: ${columns};
|
|
19
|
+
grid-template-rows: minmax(0, 1fr);
|
|
20
|
+
min-inline-size: 0;
|
|
21
|
+
|
|
22
|
+
/* Grows with the regions, then clamps. */
|
|
23
|
+
block-size: auto;
|
|
24
|
+
min-block-size: 16rem;
|
|
25
|
+
max-block-size: ${relatedContentPanelMaxBlockSize};
|
|
26
|
+
|
|
27
|
+
/* A PDF has no intrinsic height. The panel, including its header, takes the max.
|
|
28
|
+
The native <object> viewer may be used as a fallback. */
|
|
29
|
+
&:has(object),
|
|
30
|
+
&:has([data-lightbox-pdf]) {
|
|
31
|
+
block-size: ${relatedContentPanelMaxBlockSize};
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
});
|
|
35
|
+
StyledRelatedContentPanel.defaultProps = defaultThemeProp;
|
|
36
|
+
export const StyledRelatedContentRegion = styled.div(({ theme, primary, overlay }) => css `
|
|
37
|
+
position: relative;
|
|
38
|
+
min-inline-size: 0;
|
|
39
|
+
min-block-size: 0;
|
|
40
|
+
overflow: auto;
|
|
41
|
+
|
|
42
|
+
/* Negative margin to account for overflow clipping of focus indicator.
|
|
43
|
+
The small-screen overlay already covers the primary region, so it does not need this inset. */
|
|
44
|
+
${!(overlay && !primary) &&
|
|
45
|
+
css `
|
|
46
|
+
padding-block: 0.3rem;
|
|
47
|
+
margin-block: -0.3rem;
|
|
48
|
+
${primary
|
|
49
|
+
? css `
|
|
50
|
+
padding-inline-start: 0.3rem;
|
|
51
|
+
margin-inline-start: -0.3rem;
|
|
52
|
+
`
|
|
53
|
+
: css `
|
|
54
|
+
padding-inline-end: 0.3rem;
|
|
55
|
+
margin-inline-end: -0.3rem;
|
|
56
|
+
`}
|
|
57
|
+
`}
|
|
58
|
+
|
|
59
|
+
${primary &&
|
|
60
|
+
css `
|
|
61
|
+
padding-inline-end: calc(2 * ${theme.base.spacing});
|
|
62
|
+
`}
|
|
63
|
+
|
|
64
|
+
${overlay &&
|
|
65
|
+
css `
|
|
66
|
+
grid-area: 1 / 1;
|
|
67
|
+
|
|
68
|
+
${!primary &&
|
|
69
|
+
css `
|
|
70
|
+
z-index: 1;
|
|
71
|
+
justify-self: end;
|
|
72
|
+
inline-size: 90%;
|
|
73
|
+
border-radius: ${theme.base['border-radius']};
|
|
74
|
+
box-shadow: ${theme.base.shadow.high};
|
|
75
|
+
`}
|
|
76
|
+
`}
|
|
77
|
+
`);
|
|
78
|
+
StyledRelatedContentRegion.defaultProps = defaultThemeProp;
|
|
79
|
+
export const StyledDivider = styled.div(({ widthVariable, share = 50 }) => css `
|
|
80
|
+
position: absolute;
|
|
81
|
+
inset-inline-start: var(${widthVariable}, ${share}%);
|
|
82
|
+
inset-block-start: 0;
|
|
83
|
+
inline-size: 0;
|
|
84
|
+
block-size: 100%;
|
|
85
|
+
`);
|
|
86
|
+
StyledDivider.defaultProps = defaultThemeProp;
|
|
87
|
+
export const StyledSecondaryHeaderContent = styled.div(({ theme }) => {
|
|
88
|
+
return css `
|
|
89
|
+
display: flex;
|
|
90
|
+
flex: 1;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
align-items: flex-start;
|
|
93
|
+
gap: calc(0.5 * ${theme.base.spacing});
|
|
94
|
+
min-inline-size: 0;
|
|
95
|
+
`;
|
|
96
|
+
});
|
|
97
|
+
StyledSecondaryHeaderContent.defaultProps = defaultThemeProp;
|
|
98
|
+
export const StyledSecondaryBody = styled.div `
|
|
99
|
+
position: relative;
|
|
100
|
+
min-block-size: 0;
|
|
101
|
+
`;
|
|
102
|
+
export const StyledSecondaryPanel = styled.div(({ theme, collapsed }) => {
|
|
103
|
+
return css `
|
|
104
|
+
position: relative;
|
|
105
|
+
box-sizing: border-box;
|
|
106
|
+
display: grid;
|
|
107
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
108
|
+
block-size: 100%;
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
border: ${theme.components.button['border-width']} solid ${theme.base.palette['border-line']};
|
|
111
|
+
border-radius: ${theme.base['border-radius']};
|
|
112
|
+
background-color: ${theme.components.card.background};
|
|
113
|
+
|
|
114
|
+
${collapsed &&
|
|
115
|
+
css `
|
|
116
|
+
min-inline-size: min-content;
|
|
117
|
+
min-block-size: min-content;
|
|
118
|
+
|
|
119
|
+
header {
|
|
120
|
+
border-block-end: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
${StyledSecondaryHeaderContent},
|
|
124
|
+
${StyledSecondaryBody} {
|
|
125
|
+
display: none;
|
|
126
|
+
}
|
|
127
|
+
`}
|
|
128
|
+
`;
|
|
129
|
+
});
|
|
130
|
+
StyledSecondaryPanel.defaultProps = defaultThemeProp;
|
|
131
|
+
export const StyledSecondaryHeader = styled.header(({ theme }) => {
|
|
132
|
+
return css `
|
|
133
|
+
display: flex;
|
|
134
|
+
align-items: flex-start;
|
|
135
|
+
gap: ${theme.base.spacing};
|
|
136
|
+
min-inline-size: 0;
|
|
137
|
+
padding: ${theme.base.spacing};
|
|
138
|
+
border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
139
|
+
background-color: ${theme.components.card.background};
|
|
140
|
+
color: ${theme.base.palette['foreground-color']};
|
|
141
|
+
font-weight: ${theme.base['font-weight']['semi-bold']};
|
|
142
|
+
text-align: start;
|
|
143
|
+
|
|
144
|
+
${StyledMetaList} {
|
|
145
|
+
max-inline-size: 100%;
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
148
|
+
});
|
|
149
|
+
StyledSecondaryHeader.defaultProps = defaultThemeProp;
|
|
150
|
+
export const StyledSecondaryHeaderActions = styled.div `
|
|
151
|
+
display: flex;
|
|
152
|
+
flex-shrink: 0;
|
|
153
|
+
margin-inline-start: auto;
|
|
154
|
+
`;
|
|
155
|
+
export const StyledCollapseButton = styled(Button)(({ theme }) => {
|
|
156
|
+
return css `
|
|
157
|
+
border: none;
|
|
158
|
+
box-shadow: ${theme.base.shadow.low};
|
|
159
|
+
|
|
160
|
+
${StyledIcon} {
|
|
161
|
+
width: 1.5rem;
|
|
162
|
+
height: 1.5rem;
|
|
163
|
+
}
|
|
164
|
+
`;
|
|
165
|
+
});
|
|
166
|
+
StyledCollapseButton.defaultProps = defaultThemeProp;
|
|
167
|
+
/** Fills the second region so the panel can collapse without unmounting. */
|
|
168
|
+
export const StyledSecondaryContent = styled.div `
|
|
169
|
+
block-size: 100%;
|
|
170
|
+
`;
|
|
171
|
+
export const StyledSecondaryTitle = styled(Text)(({ theme }) => {
|
|
172
|
+
return css `
|
|
173
|
+
max-inline-size: 100%;
|
|
174
|
+
color: inherit;
|
|
175
|
+
font-size: ${theme.base['font-size']};
|
|
176
|
+
${ellipsisOverflow};
|
|
177
|
+
`;
|
|
178
|
+
});
|
|
179
|
+
StyledSecondaryTitle.defaultProps = defaultThemeProp;
|
|
180
|
+
//# sourceMappingURL=RelatedContentPanel.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelatedContentPanel.styles.js","sourceRoot":"","sources":["../../../src/components/RelatedContent/RelatedContentPanel.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,CAAC,MAAM,+BAA+B,GAAG,WAAW,CAAC;AAa3D,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CACjD,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,GAAG,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACjD,IAAI,OAAO,GAAG,gBAA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,CAAC,CAAC;AACH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIrD,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC/D,OAAO,GAAG,CAAA;;kBAEM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG;;MAEjC,UAAU;;;;GAIb,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAE/C,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7D,OAAO,GAAG,CAAA;;;iBAGK,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC;MAClC,gBAAgB;GACnB,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport Button from '../Button';\nimport { StyledIcon } from '../Icon';\nimport Text from '../Text';\nimport { defaultThemeProp } from '../../theme';\nimport { StyledMetaList } from '../MetaList/MetaList';\nimport { ellipsisOverflow } from '../../styles/mixins';\n\nexport const relatedContentPanelMaxBlockSize = 'max(70vh)';\n\ninterface LayoutStyleProps {\n wide: boolean;\n /** Name of the custom property, set on the template element, holding the first region's percentage size. */\n widthVariable: string;\n share?: number;\n}\n\ninterface TemplateStyleProps extends LayoutStyleProps {\n collapsed?: boolean;\n}\n\nexport const StyledRelatedContentPanel = styled.div<TemplateStyleProps>(\n ({ wide, widthVariable, share = 50, collapsed }) => {\n let columns = 'minmax(0, 1fr)';\n if (collapsed) columns = 'minmax(0, 1fr) max-content';\n else if (wide) columns = `minmax(0, var(${widthVariable}, ${share}%)) minmax(0, 1fr)`;\n\n return css`\n position: relative;\n display: grid;\n grid-template-columns: ${columns};\n grid-template-rows: minmax(0, 1fr);\n min-inline-size: 0;\n\n /* Grows with the regions, then clamps. */\n block-size: auto;\n min-block-size: 16rem;\n max-block-size: ${relatedContentPanelMaxBlockSize};\n\n /* A PDF has no intrinsic height. The panel, including its header, takes the max.\n The native <object> viewer may be used as a fallback. */\n &:has(object),\n &:has([data-lightbox-pdf]) {\n block-size: ${relatedContentPanelMaxBlockSize};\n }\n `;\n }\n);\nStyledRelatedContentPanel.defaultProps = defaultThemeProp;\n\nexport const StyledRelatedContentRegion = styled.div<{\n primary?: boolean;\n /** Secondary region covers the primary region instead of sitting beside it. */\n overlay?: boolean;\n}>(\n ({ theme, primary, overlay }) => css`\n position: relative;\n min-inline-size: 0;\n min-block-size: 0;\n overflow: auto;\n\n /* Negative margin to account for overflow clipping of focus indicator.\n The small-screen overlay already covers the primary region, so it does not need this inset. */\n ${!(overlay && !primary) &&\n css`\n padding-block: 0.3rem;\n margin-block: -0.3rem;\n ${primary\n ? css`\n padding-inline-start: 0.3rem;\n margin-inline-start: -0.3rem;\n `\n : css`\n padding-inline-end: 0.3rem;\n margin-inline-end: -0.3rem;\n `}\n `}\n\n ${primary &&\n css`\n padding-inline-end: calc(2 * ${theme.base.spacing});\n `}\n\n ${overlay &&\n css`\n grid-area: 1 / 1;\n\n ${!primary &&\n css`\n z-index: 1;\n justify-self: end;\n inline-size: 90%;\n border-radius: ${theme.base['border-radius']};\n box-shadow: ${theme.base.shadow.high};\n `}\n `}\n `\n);\nStyledRelatedContentRegion.defaultProps = defaultThemeProp;\n\nexport const StyledDivider = styled.div<LayoutStyleProps>(\n ({ widthVariable, share = 50 }) => css`\n position: absolute;\n inset-inline-start: var(${widthVariable}, ${share}%);\n inset-block-start: 0;\n inline-size: 0;\n block-size: 100%;\n `\n);\nStyledDivider.defaultProps = defaultThemeProp;\n\nexport const StyledSecondaryHeaderContent = styled.div(({ theme }) => {\n return css`\n display: flex;\n flex: 1;\n flex-direction: column;\n align-items: flex-start;\n gap: calc(0.5 * ${theme.base.spacing});\n min-inline-size: 0;\n `;\n});\nStyledSecondaryHeaderContent.defaultProps = defaultThemeProp;\n\nexport const StyledSecondaryBody = styled.div`\n position: relative;\n min-block-size: 0;\n`;\n\nexport const StyledSecondaryPanel = styled.div<{ collapsed?: boolean }>(({ theme, collapsed }) => {\n return css`\n position: relative;\n box-sizing: border-box;\n display: grid;\n grid-template-rows: auto minmax(0, 1fr);\n block-size: 100%;\n overflow: hidden;\n border: ${theme.components.button['border-width']} solid ${theme.base.palette['border-line']};\n border-radius: ${theme.base['border-radius']};\n background-color: ${theme.components.card.background};\n\n ${collapsed &&\n css`\n min-inline-size: min-content;\n min-block-size: min-content;\n\n header {\n border-block-end: none;\n }\n\n ${StyledSecondaryHeaderContent},\n ${StyledSecondaryBody} {\n display: none;\n }\n `}\n `;\n});\nStyledSecondaryPanel.defaultProps = defaultThemeProp;\n\nexport const StyledSecondaryHeader = styled.header(({ theme }) => {\n return css`\n display: flex;\n align-items: flex-start;\n gap: ${theme.base.spacing};\n min-inline-size: 0;\n padding: ${theme.base.spacing};\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n background-color: ${theme.components.card.background};\n color: ${theme.base.palette['foreground-color']};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n text-align: start;\n\n ${StyledMetaList} {\n max-inline-size: 100%;\n }\n `;\n});\nStyledSecondaryHeader.defaultProps = defaultThemeProp;\n\nexport const StyledSecondaryHeaderActions = styled.div`\n display: flex;\n flex-shrink: 0;\n margin-inline-start: auto;\n`;\n\nexport const StyledCollapseButton = styled(Button)(({ theme }) => {\n return css`\n border: none;\n box-shadow: ${theme.base.shadow.low};\n\n ${StyledIcon} {\n width: 1.5rem;\n height: 1.5rem;\n }\n `;\n});\nStyledCollapseButton.defaultProps = defaultThemeProp;\n\n/** Fills the second region so the panel can collapse without unmounting. */\nexport const StyledSecondaryContent = styled.div`\n block-size: 100%;\n`;\n\nexport const StyledSecondaryTitle = styled(Text)(({ theme }) => {\n return css`\n max-inline-size: 100%;\n color: inherit;\n font-size: ${theme.base['font-size']};\n ${ellipsisOverflow};\n `;\n});\nStyledSecondaryTitle.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelatedContentPanel.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/RelatedContent/RelatedContentPanel.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,6BAA6B,gKAM/B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createTestIds } from '../../utils';
|
|
2
|
+
export const getRelatedContentPanelTestIds = createTestIds('related-content-panel', [
|
|
3
|
+
'header',
|
|
4
|
+
'title',
|
|
5
|
+
'metadata',
|
|
6
|
+
'collapse-toggle',
|
|
7
|
+
'secondary'
|
|
8
|
+
]);
|
|
9
|
+
//# sourceMappingURL=RelatedContentPanel.test-ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelatedContentPanel.test-ids.js","sourceRoot":"","sources":["../../../src/components/RelatedContent/RelatedContentPanel.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,6BAA6B,GAAG,aAAa,CAAC,uBAAuB,EAAE;IAClF,QAAQ;IACR,OAAO;IACP,UAAU;IACV,iBAAiB;IACjB,WAAW;CACH,CAAC,CAAC","sourcesContent":["import { createTestIds } from '../../utils';\n\nexport const getRelatedContentPanelTestIds = createTestIds('related-content-panel', [\n 'header',\n 'title',\n 'metadata',\n 'collapse-toggle',\n 'secondary'\n] as const);\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { TestIdProp } from '../../types';
|
|
3
|
+
export interface RelatedContentPanelSecondary {
|
|
4
|
+
/** Content in the second region, below its header. */
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
/** Title shown in a header above the content. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Items shown beneath the label in the header. */
|
|
9
|
+
metadata?: ReactNode[];
|
|
10
|
+
/** Collapses the second region. Defaults from the medium breakpoint when `onCollapse` is set. */
|
|
11
|
+
collapsed?: boolean;
|
|
12
|
+
/** Shows a collapse/expand button and reports toggles. Omit to hide the button. */
|
|
13
|
+
onCollapse?: (collapsed: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface RelatedContentPanelProps extends TestIdProp {
|
|
16
|
+
/** Content in the first region, before the resize handle. */
|
|
17
|
+
primary: ReactNode;
|
|
18
|
+
/** The second region, after the resize handle, with its optional header label and metadata. */
|
|
19
|
+
secondary: RelatedContentPanelSecondary;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=RelatedContentPanel.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelatedContentPanel.types.d.ts","sourceRoot":"","sources":["../../../src/components/RelatedContent/RelatedContentPanel.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,4BAA4B;IAC3C,sDAAsD;IACtD,OAAO,EAAE,SAAS,CAAC;IACnB,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;IACvB,iGAAiG;IACjG,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mFAAmF;IACnF,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,wBAAyB,SAAQ,UAAU;IAC1D,6DAA6D;IAC7D,OAAO,EAAE,SAAS,CAAC;IACnB,+FAA+F;IAC/F,SAAS,EAAE,4BAA4B,CAAC;CACzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelatedContentPanel.types.js","sourceRoot":"","sources":["../../../src/components/RelatedContent/RelatedContentPanel.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { TestIdProp } from '../../types';\n\nexport interface RelatedContentPanelSecondary {\n /** Content in the second region, below its header. */\n content: ReactNode;\n /** Title shown in a header above the content. */\n label?: string;\n /** Items shown beneath the label in the header. */\n metadata?: ReactNode[];\n /** Collapses the second region. Defaults from the medium breakpoint when `onCollapse` is set. */\n collapsed?: boolean;\n /** Shows a collapse/expand button and reports toggles. Omit to hide the button. */\n onCollapse?: (collapsed: boolean) => void;\n}\n\nexport interface RelatedContentPanelProps extends TestIdProp {\n /** Content in the first region, before the resize handle. */\n primary: ReactNode;\n /** The second region, after the resize handle, with its optional header label and metadata. */\n secondary: RelatedContentPanelSecondary;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as RelatedContentButton, StyledRelatedContentButton } from './RelatedContentButton';
|
|
2
|
+
export type { RelatedContentButtonProps } from './RelatedContentButton';
|
|
3
|
+
export { default as RelatedContentPanel } from './RelatedContentPanel';
|
|
4
|
+
export { StyledRelatedContentRegion } from './RelatedContentPanel.styles';
|
|
5
|
+
export type { RelatedContentPanelProps, RelatedContentPanelSecondary } from './RelatedContentPanel.types';
|
|
6
|
+
export { getRelatedContentPanelTestIds } from './RelatedContentPanel.test-ids';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RelatedContent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,oBAAoB,EAC/B,0BAA0B,EAC3B,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,YAAY,EACV,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as RelatedContentButton, StyledRelatedContentButton } from './RelatedContentButton';
|
|
2
|
+
export { default as RelatedContentPanel } from './RelatedContentPanel';
|
|
3
|
+
export { StyledRelatedContentRegion } from './RelatedContentPanel.styles';
|
|
4
|
+
export { getRelatedContentPanelTestIds } from './RelatedContentPanel.test-ids';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/RelatedContent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,oBAAoB,EAC/B,0BAA0B,EAC3B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAK1E,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["export {\n default as RelatedContentButton,\n StyledRelatedContentButton\n} from './RelatedContentButton';\nexport type { RelatedContentButtonProps } from './RelatedContentButton';\n\nexport { default as RelatedContentPanel } from './RelatedContentPanel';\nexport { StyledRelatedContentRegion } from './RelatedContentPanel.styles';\nexport type {\n RelatedContentPanelProps,\n RelatedContentPanelSecondary\n} from './RelatedContentPanel.types';\nexport { getRelatedContentPanelTestIds } from './RelatedContentPanel.test-ids';\n"]}
|
|
@@ -13,7 +13,7 @@ export declare const StyledSearchIcon: import("styled-components/dist/types").IS
|
|
|
13
13
|
export declare const StyledSearchTextInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("../Input").InputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ref"> & {
|
|
14
14
|
ref?: ((instance: HTMLInputElement | 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<HTMLInputElement> | null | undefined;
|
|
15
15
|
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<import("../Input").InputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>> & {
|
|
16
|
-
getTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
|
|
16
|
+
getTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "related-content", "suggestion-accept", "suggestion-reject"]>;
|
|
17
17
|
}, keyof import("react").Component<any, {}, any>>;
|
|
18
18
|
export declare const StyledSearchInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
19
19
|
hasFilters: boolean;
|
|
@@ -38,6 +38,8 @@ export interface SelectProps extends BaseProps, TestIdProp {
|
|
|
38
38
|
actions?: Action[];
|
|
39
39
|
/** Pass a heading and content to show additional information on the field. */
|
|
40
40
|
additionalInfo?: FormControlProps['additionalInfo'];
|
|
41
|
+
/** Button next to the label that shows the related content of the field. */
|
|
42
|
+
relatedContent?: FormControlProps['relatedContent'];
|
|
41
43
|
/** A ref to the select element. */
|
|
42
44
|
ref?: Ref<HTMLSelectElement>;
|
|
43
45
|
}
|
|
@@ -46,7 +48,7 @@ export declare const StyledSelect: import("styled-components/dist/types").IStyle
|
|
|
46
48
|
readOnly: boolean;
|
|
47
49
|
}>> & string;
|
|
48
50
|
declare const _default: ForwardRefForwardPropsComponent<SelectProps> & {
|
|
49
|
-
getTestIds: (testIdProp?: TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
|
|
51
|
+
getTestIds: (testIdProp?: TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "related-content", "suggestion-accept", "suggestion-reject"]>;
|
|
50
52
|
};
|
|
51
53
|
export default _default;
|
|
52
54
|
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,GAAG,EACH,SAAS,EACT,kBAAkB,EAGnB,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,+BAA+B,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGlG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAWvD,MAAM,WAAW,WAAY,SAAQ,SAAS,EAAE,UAAU;IACxD,oFAAoF;IACpF,QAAQ,EAAE,SAAS,CAAC;IACpB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;IACjD,6DAA6D;IAC7D,mBAAmB,CAAC,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;IAC9D;;;OAGG;IACH,EAAE,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC5B,oDAAoD;IACpD,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC,2DAA2D;IAC3D,KAAK,CAAC,E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
|
|
@@ -72,7 +72,7 @@ StyledSelect.defaultProps = defaultThemeProp;
|
|
|
72
72
|
const Select = forwardRef(function Select(props, ref) {
|
|
73
73
|
const uid = useUID();
|
|
74
74
|
const t = useI18n();
|
|
75
|
-
const { testId, additionalInfo, children, id = uid, label, labelHidden, info, status, required = false, disabled = false, readOnly = false, actions, onResolveSuggestion, ...restProps } = props;
|
|
75
|
+
const { testId, additionalInfo, relatedContent, children, id = uid, label, labelHidden, info, status, required = false, disabled = false, readOnly = false, actions, onResolveSuggestion, ...restProps } = props;
|
|
76
76
|
const testIds = useTestIds(testId, getSelectTestIds);
|
|
77
77
|
const Comp = (_jsx(StyledFormControl, { "data-testid": testIds.control, autoComplete: '_off', ...restProps, as: StyledSelect, hasSuggestion: status === 'pending' && !!onResolveSuggestion, id: id, hasStatus: !!status, status: status, required: required, disabled: disabled, label: label, readOnly: readOnly, ref: ref, onMouseDown: readOnly
|
|
78
78
|
? (e) => {
|
|
@@ -85,7 +85,7 @@ const Select = forwardRef(function Select(props, ref) {
|
|
|
85
85
|
e.preventDefault();
|
|
86
86
|
}
|
|
87
87
|
: undefined, children: children }));
|
|
88
|
-
return label ? (_jsx(FormField, { testId: testIds, label: _jsxs(_Fragment, { children: [label, readOnly && _jsx(VisuallyHiddenText, { children: ` ${t('read_only')}` })] }), labelHidden: labelHidden, id: id, info: info, status: status, required: required, disabled: disabled, readOnly: readOnly, actions: actions, onResolveSuggestion: onResolveSuggestion, additionalInfo: additionalInfo, children: Comp })) : (Comp);
|
|
88
|
+
return label ? (_jsx(FormField, { testId: testIds, label: _jsxs(_Fragment, { children: [label, readOnly && _jsx(VisuallyHiddenText, { children: ` ${t('read_only')}` })] }), labelHidden: labelHidden, id: id, info: info, status: status, required: required, disabled: disabled, readOnly: readOnly, actions: actions, onResolveSuggestion: onResolveSuggestion, additionalInfo: additionalInfo, relatedContent: relatedContent, children: Comp })) : (Comp);
|
|
89
89
|
});
|
|
90
90
|
export default withTestIds(Select, getSelectTestIds);
|
|
91
91
|
//# sourceMappingURL=Select.js.map
|