@flipdish/ui-library 0.32.1 → 0.33.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/dist/components/atoms/Avatar/components/AvatarLabelGroup.cjs +6 -4
- package/dist/components/atoms/Avatar/components/AvatarLabelGroup.cjs.map +1 -1
- package/dist/components/atoms/Avatar/components/AvatarLabelGroup.d.ts +7 -1
- package/dist/components/atoms/Avatar/components/AvatarLabelGroup.d.ts.map +1 -1
- package/dist/components/atoms/Avatar/components/AvatarLabelGroup.js +6 -4
- package/dist/components/atoms/Avatar/components/AvatarLabelGroup.js.map +1 -1
- package/dist/components/atoms/Badge/badge.types.cjs.map +1 -1
- package/dist/components/atoms/Badge/badge.types.d.ts +2 -1
- package/dist/components/atoms/Badge/badge.types.d.ts.map +1 -1
- package/dist/components/atoms/Badge/badge.types.js.map +1 -1
- package/dist/components/atoms/Badge/index.cjs +2 -1
- package/dist/components/atoms/Badge/index.cjs.map +1 -1
- package/dist/components/atoms/Badge/index.d.ts.map +1 -1
- package/dist/components/atoms/Badge/index.js +2 -1
- package/dist/components/atoms/Badge/index.js.map +1 -1
- package/dist/components/atoms/Card/index.cjs +28 -0
- package/dist/components/atoms/Card/index.cjs.map +1 -0
- package/dist/components/atoms/Card/index.d.ts +20 -0
- package/dist/components/atoms/Card/index.d.ts.map +1 -0
- package/dist/components/atoms/Card/index.js +26 -0
- package/dist/components/atoms/Card/index.js.map +1 -0
- package/dist/components/atoms/CopyButton/index.cjs +27 -0
- package/dist/components/atoms/CopyButton/index.cjs.map +1 -0
- package/dist/components/atoms/CopyButton/index.d.ts +28 -0
- package/dist/components/atoms/CopyButton/index.d.ts.map +1 -0
- package/dist/components/atoms/CopyButton/index.js +25 -0
- package/dist/components/atoms/CopyButton/index.js.map +1 -0
- package/dist/components/atoms/Flag/flag.types.d.ts +6 -0
- package/dist/components/atoms/Flag/flag.types.d.ts.map +1 -0
- package/dist/components/atoms/Flag/flag.utils.cjs +45 -0
- package/dist/components/atoms/Flag/flag.utils.cjs.map +1 -0
- package/dist/components/atoms/Flag/flag.utils.d.ts +15 -0
- package/dist/components/atoms/Flag/flag.utils.d.ts.map +1 -0
- package/dist/components/atoms/Flag/flag.utils.js +42 -0
- package/dist/components/atoms/Flag/flag.utils.js.map +1 -0
- package/dist/components/atoms/Flag/index.cjs +47 -0
- package/dist/components/atoms/Flag/index.cjs.map +1 -0
- package/dist/components/atoms/Flag/index.d.ts +27 -0
- package/dist/components/atoms/Flag/index.d.ts.map +1 -0
- package/dist/components/atoms/Flag/index.js +45 -0
- package/dist/components/atoms/Flag/index.js.map +1 -0
- package/dist/components/atoms/SearchInput/index.cjs +32 -0
- package/dist/components/atoms/SearchInput/index.cjs.map +1 -0
- package/dist/components/atoms/SearchInput/index.d.ts +40 -0
- package/dist/components/atoms/SearchInput/index.d.ts.map +1 -0
- package/dist/components/atoms/SearchInput/index.js +30 -0
- package/dist/components/atoms/SearchInput/index.js.map +1 -0
- package/dist/components/molecules/DetailList/detailList.types.d.ts +15 -0
- package/dist/components/molecules/DetailList/detailList.types.d.ts.map +1 -0
- package/dist/components/molecules/DetailList/index.cjs +32 -0
- package/dist/components/molecules/DetailList/index.cjs.map +1 -0
- package/dist/components/molecules/DetailList/index.d.ts +26 -0
- package/dist/components/molecules/DetailList/index.d.ts.map +1 -0
- package/dist/components/molecules/DetailList/index.js +30 -0
- package/dist/components/molecules/DetailList/index.js.map +1 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.cjs +43 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.cjs.map +1 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.d.ts +24 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.d.ts.map +1 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.js +41 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.js.map +1 -0
- package/dist/components/molecules/RadioGroup/index.cjs +2 -0
- package/dist/components/molecules/RadioGroup/index.cjs.map +1 -1
- package/dist/components/molecules/RadioGroup/index.d.ts +2 -0
- package/dist/components/molecules/RadioGroup/index.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroup/index.js +1 -0
- package/dist/components/molecules/RadioGroup/index.js.map +1 -1
- package/dist/components/molecules/RadioGroup/radioGroup.types.d.ts +17 -1
- package/dist/components/molecules/RadioGroup/radioGroup.types.d.ts.map +1 -1
- package/dist/components/organisms/ApplicationHeader/applicationHeader.types.d.ts +8 -2
- package/dist/components/organisms/ApplicationHeader/applicationHeader.types.d.ts.map +1 -1
- package/dist/components/organisms/ApplicationHeader/components/AvatarButton.cjs +4 -1
- package/dist/components/organisms/ApplicationHeader/components/AvatarButton.cjs.map +1 -1
- package/dist/components/organisms/ApplicationHeader/components/AvatarButton.d.ts +2 -1
- package/dist/components/organisms/ApplicationHeader/components/AvatarButton.d.ts.map +1 -1
- package/dist/components/organisms/ApplicationHeader/components/AvatarButton.js +4 -1
- package/dist/components/organisms/ApplicationHeader/components/AvatarButton.js.map +1 -1
- package/dist/components/organisms/ApplicationHeader/index.cjs +1 -1
- package/dist/components/organisms/ApplicationHeader/index.cjs.map +1 -1
- package/dist/components/organisms/ApplicationHeader/index.d.ts.map +1 -1
- package/dist/components/organisms/ApplicationHeader/index.js +1 -1
- package/dist/components/organisms/ApplicationHeader/index.js.map +1 -1
- package/dist/components/organisms/HeaderNavigation/index.cjs +2 -3
- package/dist/components/organisms/HeaderNavigation/index.cjs.map +1 -1
- package/dist/components/organisms/HeaderNavigation/index.d.ts.map +1 -1
- package/dist/components/organisms/HeaderNavigation/index.js +2 -3
- package/dist/components/organisms/HeaderNavigation/index.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.cjs +3 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.js +3 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.cjs +3 -3
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.d.ts +7 -2
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.js +3 -3
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.cjs +7 -3
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.d.ts +6 -2
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.js +7 -3
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.cjs +8 -3
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.d.ts +2 -1
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.js +8 -3
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.js.map +1 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.cjs +12 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.d.ts +3 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.js +13 -2
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.js.map +1 -1
- package/dist/components/organisms/SidePanel/index.cjs +2 -2
- package/dist/components/organisms/SidePanel/index.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/index.d.ts +3 -1
- package/dist/components/organisms/SidePanel/index.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/index.js +2 -2
- package/dist/components/organisms/SidePanel/index.js.map +1 -1
- package/dist/native/components/atoms/Card/index.d.ts +12 -0
- package/dist/native/components/atoms/CopyButton/index.d.ts +12 -0
- package/dist/native/components/atoms/Flag/index.d.ts +12 -0
- package/dist/native/components/atoms/SearchInput/index.d.ts +12 -0
- package/dist/native/components/molecules/DetailList/index.d.ts +12 -0
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelHeader.cjs","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelHeader.tsx"],"sourcesContent":[null],"names":["useContext","SidePanelContext","useTestIdPrefix","_jsxs","joinTestId","cx","_jsx","CloseButton"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SidePanelHeader.cjs","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelHeader.tsx"],"sourcesContent":[null],"names":["useContext","SidePanelContext","useTestIdPrefix","_jsxs","joinTestId","cx","_jsx","ButtonUtility","ArrowLeft","CloseButton"],"mappings":";;;;;;;;;;;AAwBA;AACO,MAAM,eAAe,GAAG,CAAC,EAC9B,SAAS,EACT,QAAQ,EACR,OAAO,EACP,UAAU,EACV,MAAM,EACN,SAAS,GAAG,MAAM,EAClB,aAAa,EAAE,UAAU,EACzB,GAAG,KAAK,EACa,KAAI;AACzB,IAAA,MAAM,KAAK,GAAGA,gBAAU,CAACC,kCAAgB,CAAC;AAC1C,IAAA,MAAM,MAAM,GAAGC,2BAAe,EAAE;IAEhC,QACEC,eAAA,CAAA,QAAA,EAAA,EAAA,GACM,KAAK,EAAA,aAAA,EACI,UAAU,KAAK,MAAM,GAAGC,sBAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC,EAC9E,SAAS,EAAEC,KAAE,CAAC,wCAAwC,EAAE,MAAM,IAAI,yBAAyB,EAAE,SAAS,CAAC,EAAA,QAAA,EAAA,CAEtG,MAAM,KACLC,cAAA,CAACC,2BAAa,EAAA,EACZ,IAAI,EAAEC,iBAAS,EACf,OAAO,EAAE,SAAS,EAClB,KAAK,EAAC,UAAU,EAChB,IAAI,EAAC,IAAI;;gBAET,SAAS,EAAC,SAAS,EACnB,OAAO,EAAE,MAAM,EAAA,aAAA,EACF,MAAM,GAAGJ,sBAAU,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAAA,CAC5D,CACH,EACA,MAAM,GAAGE,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,sBAAsB,YAAE,QAAQ,EAAA,CAAO,GAAG,QAAQ,EAC3EA,cAAA,CAACG,uBAAW,EAAA,EACV,IAAI,EAAC,IAAI,EACT,KAAK,EAAE,UAAU,KAAK,KAAK,GAAG,CAAA,MAAA,EAAS,KAAK,CAAC,KAAK,EAAE,GAAG,SAAS,CAAC,EACjE,SAAS,EAAC,iCAAiC,EAC3C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,EAAA,aAAA,EACnB,MAAM,GAAGL,sBAAU,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAA,CAC7D,CAAA,EAAA,CACK;AAEb;AACA,eAAe,CAAC,WAAW,GAAG,iBAAiB;;"}
|
|
@@ -4,12 +4,16 @@ export interface SidePanelHeaderProps extends ComponentPropsWithRef<'header'> {
|
|
|
4
4
|
onClose?: () => void;
|
|
5
5
|
/** Accessible name of the close button. Defaults to "Close" followed by the panel's `aria-label`. */
|
|
6
6
|
closeLabel?: string;
|
|
7
|
+
/** Shows a back button before the title, for a panel that is the second step of a flow; called when it is pressed. */
|
|
8
|
+
onBack?: () => void;
|
|
9
|
+
/** Accessible name of the back button. Defaults to "Back". */
|
|
10
|
+
backLabel?: string;
|
|
7
11
|
/** Overrides the header's `data-testid` (defaults to `<root>--header`). */
|
|
8
12
|
'data-testid'?: string;
|
|
9
13
|
}
|
|
10
|
-
/** Title area with a close button, which closes the panel unless `onClose` is passed. */
|
|
14
|
+
/** Title area with a close button, which closes the panel unless `onClose` is passed, and an optional back button. */
|
|
11
15
|
export declare const SidePanelHeader: {
|
|
12
|
-
({ className, children, onClose, closeLabel, "data-testid": dataTestId, ...props }: SidePanelHeaderProps): import("react").JSX.Element;
|
|
16
|
+
({ className, children, onClose, closeLabel, onBack, backLabel, "data-testid": dataTestId, ...props }: SidePanelHeaderProps): import("react").JSX.Element;
|
|
13
17
|
displayName: string;
|
|
14
18
|
};
|
|
15
19
|
//# sourceMappingURL=SidePanelHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelHeader.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelHeader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SidePanelHeader.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelHeader.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAInD,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB,CAAC,QAAQ,CAAC;IAC3E,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,qGAAqG;IACrG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sHAAsH;IACtH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,sHAAsH;AACtH,eAAO,MAAM,eAAe;2GASzB,oBAAoB;;CAgCtB,CAAC"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ArrowLeft } from '@flipdish/ui-icons';
|
|
2
3
|
import { CloseButton } from '@flipdish/ui-library/components/atoms/CloseButton';
|
|
4
|
+
import { ButtonUtility } from '@flipdish/ui-library/components/atoms/UtilityButton';
|
|
3
5
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
4
6
|
import { useTestIdPrefix, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
5
7
|
import { useContext } from 'react';
|
|
6
8
|
import { SidePanelContext } from '../providers/SidePanel.context.js';
|
|
7
9
|
|
|
8
|
-
/** Title area with a close button, which closes the panel unless `onClose` is passed. */
|
|
9
|
-
const SidePanelHeader = ({ className, children, onClose, closeLabel, 'data-testid': dataTestId, ...props }) => {
|
|
10
|
+
/** Title area with a close button, which closes the panel unless `onClose` is passed, and an optional back button. */
|
|
11
|
+
const SidePanelHeader = ({ className, children, onClose, closeLabel, onBack, backLabel = 'Back', 'data-testid': dataTestId, ...props }) => {
|
|
10
12
|
const panel = useContext(SidePanelContext);
|
|
11
13
|
const prefix = useTestIdPrefix();
|
|
12
|
-
return (jsxs("header", { ...props, "data-testid": dataTestId ?? (prefix ? joinTestId(prefix, 'header') : undefined), className: cx('relative w-full px-4 pt-6 pb-8 lg:px-6', className), children: [
|
|
14
|
+
return (jsxs("header", { ...props, "data-testid": dataTestId ?? (prefix ? joinTestId(prefix, 'header') : undefined), className: cx('relative w-full px-4 pt-6 pb-8 lg:px-6', onBack && 'flex items-center gap-3', className), children: [onBack && (jsx(ButtonUtility, { icon: ArrowLeft, tooltip: backLabel, color: "tertiary", size: "sm",
|
|
15
|
+
// 32px tall in a 28px title line: pulled in so the header is as tall as one without a back button.
|
|
16
|
+
className: "-my-0.5", onClick: onBack, "data-testid": prefix ? joinTestId(prefix, 'back') : undefined })), onBack ? jsx("div", { className: "min-w-0 flex-1 pr-12", children: children }) : children, jsx(CloseButton, { size: "md", label: closeLabel ?? (panel ? `Close ${panel.label}` : undefined), className: "absolute top-3 right-3 shrink-0", onClick: onClose ?? panel?.close, "data-testid": prefix ? joinTestId(prefix, 'close') : undefined })] }));
|
|
13
17
|
};
|
|
14
18
|
SidePanelHeader.displayName = 'SidePanelHeader';
|
|
15
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelHeader.js","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelHeader.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SidePanelHeader.js","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelHeader.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;AAwBA;AACO,MAAM,eAAe,GAAG,CAAC,EAC9B,SAAS,EACT,QAAQ,EACR,OAAO,EACP,UAAU,EACV,MAAM,EACN,SAAS,GAAG,MAAM,EAClB,aAAa,EAAE,UAAU,EACzB,GAAG,KAAK,EACa,KAAI;AACzB,IAAA,MAAM,KAAK,GAAG,UAAU,CAAC,gBAAgB,CAAC;AAC1C,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE;IAEhC,QACEA,IAAA,CAAA,QAAA,EAAA,EAAA,GACM,KAAK,EAAA,aAAA,EACI,UAAU,KAAK,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC,EAC9E,SAAS,EAAE,EAAE,CAAC,wCAAwC,EAAE,MAAM,IAAI,yBAAyB,EAAE,SAAS,CAAC,EAAA,QAAA,EAAA,CAEtG,MAAM,KACLC,GAAA,CAAC,aAAa,EAAA,EACZ,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,SAAS,EAClB,KAAK,EAAC,UAAU,EAChB,IAAI,EAAC,IAAI;;gBAET,SAAS,EAAC,SAAS,EACnB,OAAO,EAAE,MAAM,EAAA,aAAA,EACF,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAAA,CAC5D,CACH,EACA,MAAM,GAAGA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,sBAAsB,YAAE,QAAQ,EAAA,CAAO,GAAG,QAAQ,EAC3EA,GAAA,CAAC,WAAW,EAAA,EACV,IAAI,EAAC,IAAI,EACT,KAAK,EAAE,UAAU,KAAK,KAAK,GAAG,CAAA,MAAA,EAAS,KAAK,CAAC,KAAK,EAAE,GAAG,SAAS,CAAC,EACjE,SAAS,EAAC,iCAAiC,EAC3C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,EAAA,aAAA,EACnB,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAA,CAC7D,CAAA,EAAA,CACK;AAEb;AACA,eAAe,CAAC,WAAW,GAAG,iBAAiB;;"}
|
|
@@ -18,11 +18,16 @@ const FULL_PAGE = {
|
|
|
18
18
|
open: { width: '100%', x: 0 },
|
|
19
19
|
};
|
|
20
20
|
/** The rendered region. A component of its own so it can tell, while animating out, that it is leaving. */
|
|
21
|
-
const SidePanelRegion = ({ 'aria-label': ariaLabel, children, className, testId, isDesktop, shouldFocusOnMount }) => {
|
|
21
|
+
const SidePanelRegion = ({ 'aria-label': ariaLabel, children, className, contentKey, testId, isDesktop, shouldFocusOnMount, }) => {
|
|
22
22
|
const panelRef = React.useRef(null);
|
|
23
23
|
const isPresent = react.useIsPresent();
|
|
24
24
|
const shouldReduceMotion = react.useReducedMotion();
|
|
25
|
-
const { onFocusCapture } = usePanelFocus.usePanelFocus({ panelRef, isPresent, isDesktop, shouldFocusOnMount });
|
|
25
|
+
const { onFocusCapture } = usePanelFocus.usePanelFocus({ panelRef, isPresent, isDesktop, shouldFocusOnMount, contentKey });
|
|
26
|
+
// The first content arrives with the panel's own opening animation; only a later swap fades in.
|
|
27
|
+
const firstContentKey = React.useRef(contentKey);
|
|
28
|
+
const hasSwappedContent = React.useRef(false);
|
|
29
|
+
if (firstContentKey.current !== contentKey)
|
|
30
|
+
hasSwappedContent.current = true;
|
|
26
31
|
// Crossing the breakpoint while open swaps the layout at once; only opening and closing animate.
|
|
27
32
|
const previousIsDesktop = React.useRef(isDesktop);
|
|
28
33
|
const hasCrossedBreakpoint = previousIsDesktop.current !== isDesktop;
|
|
@@ -34,7 +39,7 @@ const SidePanelRegion = ({ 'aria-label': ariaLabel, children, className, testId,
|
|
|
34
39
|
// Focusable by script only, so opening can land on the region without adding a tab stop.
|
|
35
40
|
tabIndex: -1, onFocusCapture: onFocusCapture, initial: motionStates.closed, animate: motionStates.open, exit: motionStates.closed, transition: shouldReduceMotion || hasCrossedBreakpoint ? { duration: 0 } : SPRING,
|
|
36
41
|
// overflow-hidden clips the fixed-width content while the panel's own width animates.
|
|
37
|
-
className: cx.cx('flex h-full min-h-0 shrink-0 overflow-hidden bg-secondary outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2', !isDesktop && 'absolute inset-y-0 right-0 z-10', className), children: jsxRuntime.jsx("div", { className: cx.cx('flex h-full shrink-0 flex-col', isDesktop ? 'w-100 border-l border-secondary' : 'w-full'), children: children }) }));
|
|
42
|
+
className: cx.cx('flex h-full min-h-0 shrink-0 overflow-hidden bg-secondary outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2', !isDesktop && 'absolute inset-y-0 right-0 z-10', className), children: jsxRuntime.jsx("div", { className: cx.cx('flex h-full shrink-0 flex-col', isDesktop ? 'w-100 border-l border-secondary' : 'w-full'), children: jsxRuntime.jsx("div", { className: cx.cx('flex min-h-0 flex-1 flex-col', hasSwappedContent.current && 'animate-in fade-in duration-200 motion-reduce:animate-none'), children: children }, contentKey) }) }));
|
|
38
43
|
};
|
|
39
44
|
|
|
40
45
|
exports.SIDE_PANEL_WIDTH = SIDE_PANEL_WIDTH;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelRegion.cjs","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelRegion.tsx"],"sourcesContent":[null],"names":["useRef","useIsPresent","useReducedMotion","usePanelFocus","useEffect","_jsx","motion","cx"],"mappings":";;;;;;;;AAQA;AACO,MAAM,gBAAgB,GAAG;AAEhC,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAW;AAElF,MAAM,MAAM,GAAG;IACb,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IAC1B,IAAI,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,EAAE;CAC/B;AAEV,MAAM,SAAS,GAAG;IAChB,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE;IACpC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE;CACrB;
|
|
1
|
+
{"version":3,"file":"SidePanelRegion.cjs","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelRegion.tsx"],"sourcesContent":[null],"names":["useRef","useIsPresent","useReducedMotion","usePanelFocus","useEffect","_jsx","motion","cx"],"mappings":";;;;;;;;AAQA;AACO,MAAM,gBAAgB,GAAG;AAEhC,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAW;AAElF,MAAM,MAAM,GAAG;IACb,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IAC1B,IAAI,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,EAAE;CAC/B;AAEV,MAAM,SAAS,GAAG;IAChB,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE;IACpC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE;CACrB;AAYV;MACa,eAAe,GAAG,CAAC,EAC9B,YA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E,QAAQ,EAAE,CAAC,EAAE,GAAG,MAAM;;QAEjF,SAAS,EAAEC,KAAE,CACX,sIAAsI,EACtI,CAAC,SAAS,IAAI,iCAAiC,EAC/C,SAAS,CACV,YAGDF,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAEE,KAAE,CAAC,+BAA+B,EAAE,SAAS,GAAG,iCAAiC,GAAG,QAAQ,CAAC,EAAA,QAAA,EAE3GF,cAAA,CAAA,KAAA,EAAA,EAEE,SAAS,EAAEE,KAAE,CAAC,8BAA8B,EAAE,iBAAiB,CAAC,OAAO,IAAI,4DAA4D,CAAC,EAAA,QAAA,EAEvI,QAAQ,EAAA,EAHJ,UAAU,CAIX,EAAA,CACF,EAAA,CACO;AAEnB;;;"}
|
|
@@ -5,11 +5,12 @@ interface SidePanelRegionProps {
|
|
|
5
5
|
'aria-label': string;
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
className?: string;
|
|
8
|
+
contentKey?: string;
|
|
8
9
|
testId: string;
|
|
9
10
|
isDesktop: boolean;
|
|
10
11
|
shouldFocusOnMount: boolean;
|
|
11
12
|
}
|
|
12
13
|
/** The rendered region. A component of its own so it can tell, while animating out, that it is leaving. */
|
|
13
|
-
export declare const SidePanelRegion: ({ "aria-label": ariaLabel, children, className, testId, isDesktop, shouldFocusOnMount }: SidePanelRegionProps) => import("react").JSX.Element;
|
|
14
|
+
export declare const SidePanelRegion: ({ "aria-label": ariaLabel, children, className, contentKey, testId, isDesktop, shouldFocusOnMount, }: SidePanelRegionProps) => import("react").JSX.Element;
|
|
14
15
|
export {};
|
|
15
16
|
//# sourceMappingURL=SidePanelRegion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelRegion.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelRegion.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,4GAA4G;AAC5G,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAcpC,UAAU,oBAAoB;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAED,2GAA2G;AAC3G,eAAO,MAAM,eAAe,GAAI,
|
|
1
|
+
{"version":3,"file":"SidePanelRegion.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelRegion.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,4GAA4G;AAC5G,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAcpC,UAAU,oBAAoB;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAED,2GAA2G;AAC3G,eAAO,MAAM,eAAe,GAAI,sGAQ7B,oBAAoB,gCAmDtB,CAAC"}
|
|
@@ -16,11 +16,16 @@ const FULL_PAGE = {
|
|
|
16
16
|
open: { width: '100%', x: 0 },
|
|
17
17
|
};
|
|
18
18
|
/** The rendered region. A component of its own so it can tell, while animating out, that it is leaving. */
|
|
19
|
-
const SidePanelRegion = ({ 'aria-label': ariaLabel, children, className, testId, isDesktop, shouldFocusOnMount }) => {
|
|
19
|
+
const SidePanelRegion = ({ 'aria-label': ariaLabel, children, className, contentKey, testId, isDesktop, shouldFocusOnMount, }) => {
|
|
20
20
|
const panelRef = useRef(null);
|
|
21
21
|
const isPresent = useIsPresent();
|
|
22
22
|
const shouldReduceMotion = useReducedMotion();
|
|
23
|
-
const { onFocusCapture } = usePanelFocus({ panelRef, isPresent, isDesktop, shouldFocusOnMount });
|
|
23
|
+
const { onFocusCapture } = usePanelFocus({ panelRef, isPresent, isDesktop, shouldFocusOnMount, contentKey });
|
|
24
|
+
// The first content arrives with the panel's own opening animation; only a later swap fades in.
|
|
25
|
+
const firstContentKey = useRef(contentKey);
|
|
26
|
+
const hasSwappedContent = useRef(false);
|
|
27
|
+
if (firstContentKey.current !== contentKey)
|
|
28
|
+
hasSwappedContent.current = true;
|
|
24
29
|
// Crossing the breakpoint while open swaps the layout at once; only opening and closing animate.
|
|
25
30
|
const previousIsDesktop = useRef(isDesktop);
|
|
26
31
|
const hasCrossedBreakpoint = previousIsDesktop.current !== isDesktop;
|
|
@@ -32,7 +37,7 @@ const SidePanelRegion = ({ 'aria-label': ariaLabel, children, className, testId,
|
|
|
32
37
|
// Focusable by script only, so opening can land on the region without adding a tab stop.
|
|
33
38
|
tabIndex: -1, onFocusCapture: onFocusCapture, initial: motionStates.closed, animate: motionStates.open, exit: motionStates.closed, transition: shouldReduceMotion || hasCrossedBreakpoint ? { duration: 0 } : SPRING,
|
|
34
39
|
// overflow-hidden clips the fixed-width content while the panel's own width animates.
|
|
35
|
-
className: cx('flex h-full min-h-0 shrink-0 overflow-hidden bg-secondary outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2', !isDesktop && 'absolute inset-y-0 right-0 z-10', className), children: jsx("div", { className: cx('flex h-full shrink-0 flex-col', isDesktop ? 'w-100 border-l border-secondary' : 'w-full'), children: children }) }));
|
|
40
|
+
className: cx('flex h-full min-h-0 shrink-0 overflow-hidden bg-secondary outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2', !isDesktop && 'absolute inset-y-0 right-0 z-10', className), children: jsx("div", { className: cx('flex h-full shrink-0 flex-col', isDesktop ? 'w-100 border-l border-secondary' : 'w-full'), children: jsx("div", { className: cx('flex min-h-0 flex-1 flex-col', hasSwappedContent.current && 'animate-in fade-in duration-200 motion-reduce:animate-none'), children: children }, contentKey) }) }));
|
|
36
41
|
};
|
|
37
42
|
|
|
38
43
|
export { SIDE_PANEL_WIDTH, SidePanelRegion };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelRegion.js","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelRegion.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;AAQA;AACO,MAAM,gBAAgB,GAAG;AAEhC,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAW;AAElF,MAAM,MAAM,GAAG;IACb,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IAC1B,IAAI,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,EAAE;CAC/B;AAEV,MAAM,SAAS,GAAG;IAChB,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE;IACpC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE;CACrB;
|
|
1
|
+
{"version":3,"file":"SidePanelRegion.js","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelRegion.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;AAQA;AACO,MAAM,gBAAgB,GAAG;AAEhC,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAW;AAElF,MAAM,MAAM,GAAG;IACb,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IAC1B,IAAI,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,EAAE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AA,QAAQ,EAAE,EAAE,EACZ,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,YAAY,CAAC,MAAM,EAC5B,OAAO,EAAE,YAAY,CAAC,IAAI,EAC1B,IAAI,EAAE,YAAY,CAAC,MAAM,EACzB,UAAU,EAAE,kBAAkB,IAAI,oBAAoB,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,MAAM;;QAEjF,SAAS,EAAE,EAAE,CACX,sIAAsI,EACtI,CAAC,SAAS,IAAI,iCAAiC,EAC/C,SAAS,CACV,YAGDA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,GAAG,iCAAiC,GAAG,QAAQ,CAAC,EAAA,QAAA,EAE3GA,GAAA,CAAA,KAAA,EAAA,EAEE,SAAS,EAAE,EAAE,CAAC,8BAA8B,EAAE,iBAAiB,CAAC,OAAO,IAAI,4DAA4D,CAAC,EAAA,QAAA,EAEvI,QAAQ,EAAA,EAHJ,UAAU,CAIX,EAAA,CACF,EAAA,CACO;AAEnB;;"}
|
|
@@ -15,7 +15,7 @@ const focusableSiblingBefore = (panel) => {
|
|
|
15
15
|
*
|
|
16
16
|
* @returns a capture-phase focus handler to spread onto the panel element
|
|
17
17
|
*/
|
|
18
|
-
const usePanelFocus = ({ panelRef, isPresent, isDesktop, shouldFocusOnMount }) => {
|
|
18
|
+
const usePanelFocus = ({ panelRef, isPresent, isDesktop, shouldFocusOnMount, contentKey }) => {
|
|
19
19
|
const openerRef = React.useRef(null);
|
|
20
20
|
const previousIsPresent = React.useRef(null);
|
|
21
21
|
const previousIsDesktop = React.useRef(isDesktop);
|
|
@@ -63,6 +63,17 @@ const usePanelFocus = ({ panelRef, isPresent, isDesktop, shouldFocusOnMount }) =
|
|
|
63
63
|
panel.focus({ preventScroll: true });
|
|
64
64
|
}
|
|
65
65
|
}, [panelRef, isDesktop]);
|
|
66
|
+
// Swapping content unmounts whatever held focus, which drops it on the page. The region takes it, so Tab stays inside and
|
|
67
|
+
// closing can still hand it back. Content that focuses itself on mount (an `autoFocus` input) has done so by now and keeps it.
|
|
68
|
+
const previousContentKey = React.useRef(contentKey);
|
|
69
|
+
React.useLayoutEffect(() => {
|
|
70
|
+
if (previousContentKey.current === contentKey)
|
|
71
|
+
return;
|
|
72
|
+
previousContentKey.current = contentKey;
|
|
73
|
+
const panel = panelRef.current;
|
|
74
|
+
if (panel && isPresent && focus_utils.getFocusedElement() === null)
|
|
75
|
+
panel.focus({ preventScroll: true });
|
|
76
|
+
}, [panelRef, contentKey, isPresent]);
|
|
66
77
|
// A panel that was open on load has no opener, so closing hands focus back to wherever it first came in from.
|
|
67
78
|
const onFocusCapture = (event) => {
|
|
68
79
|
const from = event.relatedTarget;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePanelFocus.cjs","sources":["../../../../../src/components/organisms/SidePanel/hooks/usePanelFocus.ts"],"sourcesContent":[null],"names":["useRef","useState","getFocusedElement","useEffect"],"mappings":";;;;;AAMA;AACA,MAAM,sBAAsB,GAAG,CAAC,KAAkB,KAAwB;AACxE,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,sBAAsB;AAE5C,IAAA,OAAO,OAAO,YAAY,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI;AACjF,CAAC;
|
|
1
|
+
{"version":3,"file":"usePanelFocus.cjs","sources":["../../../../../src/components/organisms/SidePanel/hooks/usePanelFocus.ts"],"sourcesContent":[null],"names":["useRef","useState","getFocusedElement","useEffect","useLayoutEffect"],"mappings":";;;;;AAMA;AACA,MAAM,sBAAsB,GAAG,CAAC,KAAkB,KAAwB;AACxE,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,sBAAsB;AAE5C,IAAA,OAAO,OAAO,YAAY,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI;AACjF,CAAC;AAcD;;;;;;AAMG;AACI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AS,CAAC,CAAC;;AAGrC,IAAA,MAAM,cAAc,GAAG,CAAC,KAA8B,KAAI;AACxD,QAAA,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa;AAChC,QAAA,IAAI,SAAS,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,YAAY,WAAW,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC;AAAE,YAAA,SAAS,CAAC,OAAO,GAAG,IAAI;AAChI,IAAA,CAAC;IAED,OAAO,EAAE,cAAc,EAAE;AAC3B;;"}
|
|
@@ -7,6 +7,8 @@ interface UsePanelFocusOptions {
|
|
|
7
7
|
isDesktop: boolean;
|
|
8
8
|
/** False for a panel that is open on the first render, which must not pull focus away from the page. */
|
|
9
9
|
shouldFocusOnMount: boolean;
|
|
10
|
+
/** Identifies the content shown; a change means the content, and whatever held focus in it, was replaced. */
|
|
11
|
+
contentKey?: string;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Hands focus into the panel when it opens and back to the control that opened it when it closes,
|
|
@@ -15,7 +17,7 @@ interface UsePanelFocusOptions {
|
|
|
15
17
|
*
|
|
16
18
|
* @returns a capture-phase focus handler to spread onto the panel element
|
|
17
19
|
*/
|
|
18
|
-
export declare const usePanelFocus: ({ panelRef, isPresent, isDesktop, shouldFocusOnMount }: UsePanelFocusOptions) => {
|
|
20
|
+
export declare const usePanelFocus: ({ panelRef, isPresent, isDesktop, shouldFocusOnMount, contentKey }: UsePanelFocusOptions) => {
|
|
19
21
|
onFocusCapture: (event: FocusEvent<HTMLElement>) => void;
|
|
20
22
|
};
|
|
21
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePanelFocus.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SidePanel/hooks/usePanelFocus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAWnD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACxC,kEAAkE;IAClE,SAAS,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAC;IACnB,wGAAwG;IACxG,kBAAkB,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"usePanelFocus.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SidePanel/hooks/usePanelFocus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAWnD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACxC,kEAAkE;IAClE,SAAS,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAC;IACnB,wGAAwG;IACxG,kBAAkB,EAAE,OAAO,CAAC;IAC5B,6GAA6G;IAC7G,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,oEAAoE,oBAAoB;4BA6DrF,UAAU,CAAC,WAAW,CAAC;CAMvD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useRef, useState, useEffect } from 'react';
|
|
1
|
+
import { useRef, useState, useEffect, useLayoutEffect } from 'react';
|
|
2
2
|
import { getFocusedElement } from '../../../../utilities/__internal__/focusUtils/focus.utils.js';
|
|
3
3
|
|
|
4
4
|
/** The element before the panel when it can take focus, such as `AppShell`'s scroll area. */
|
|
@@ -13,7 +13,7 @@ const focusableSiblingBefore = (panel) => {
|
|
|
13
13
|
*
|
|
14
14
|
* @returns a capture-phase focus handler to spread onto the panel element
|
|
15
15
|
*/
|
|
16
|
-
const usePanelFocus = ({ panelRef, isPresent, isDesktop, shouldFocusOnMount }) => {
|
|
16
|
+
const usePanelFocus = ({ panelRef, isPresent, isDesktop, shouldFocusOnMount, contentKey }) => {
|
|
17
17
|
const openerRef = useRef(null);
|
|
18
18
|
const previousIsPresent = useRef(null);
|
|
19
19
|
const previousIsDesktop = useRef(isDesktop);
|
|
@@ -61,6 +61,17 @@ const usePanelFocus = ({ panelRef, isPresent, isDesktop, shouldFocusOnMount }) =
|
|
|
61
61
|
panel.focus({ preventScroll: true });
|
|
62
62
|
}
|
|
63
63
|
}, [panelRef, isDesktop]);
|
|
64
|
+
// Swapping content unmounts whatever held focus, which drops it on the page. The region takes it, so Tab stays inside and
|
|
65
|
+
// closing can still hand it back. Content that focuses itself on mount (an `autoFocus` input) has done so by now and keeps it.
|
|
66
|
+
const previousContentKey = useRef(contentKey);
|
|
67
|
+
useLayoutEffect(() => {
|
|
68
|
+
if (previousContentKey.current === contentKey)
|
|
69
|
+
return;
|
|
70
|
+
previousContentKey.current = contentKey;
|
|
71
|
+
const panel = panelRef.current;
|
|
72
|
+
if (panel && isPresent && getFocusedElement() === null)
|
|
73
|
+
panel.focus({ preventScroll: true });
|
|
74
|
+
}, [panelRef, contentKey, isPresent]);
|
|
64
75
|
// A panel that was open on load has no opener, so closing hands focus back to wherever it first came in from.
|
|
65
76
|
const onFocusCapture = (event) => {
|
|
66
77
|
const from = event.relatedTarget;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePanelFocus.js","sources":["../../../../../src/components/organisms/SidePanel/hooks/usePanelFocus.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAMA;AACA,MAAM,sBAAsB,GAAG,CAAC,KAAkB,KAAwB;AACxE,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,sBAAsB;AAE5C,IAAA,OAAO,OAAO,YAAY,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI;AACjF,CAAC;
|
|
1
|
+
{"version":3,"file":"usePanelFocus.js","sources":["../../../../../src/components/organisms/SidePanel/hooks/usePanelFocus.ts"],"sourcesContent":[null],"names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QAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO;AAC9B,QAAA,IAAI,KAAK,IAAI,SAAS,IAAI,iBAAiB,EAAE,KAAK,IAAI;YAAE,KAAK,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;IAC9F,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;;AAGrC,IAAA,MAAM,cAAc,GAAG,CAAC,KAA8B,KAAI;AACxD,QAAA,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa;AAChC,QAAA,IAAI,SAAS,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,YAAY,WAAW,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC;AAAE,YAAA,SAAS,CAAC,OAAO,GAAG,IAAI;AAChI,IAAA,CAAC;IAED,OAAO,EAAE,cAAc,EAAE;AAC3B;;"}
|
|
@@ -13,7 +13,7 @@ var useOpenOnMount = require('./hooks/useOpenOnMount.cjs');
|
|
|
13
13
|
var PageCover_context = require('./providers/PageCover.context.cjs');
|
|
14
14
|
var SidePanel_context = require('./providers/SidePanel.context.cjs');
|
|
15
15
|
|
|
16
|
-
const SidePanelRoot = ({ isOpen, onOpenChange, 'aria-label': ariaLabel, children, className, 'data-testid': dataTestId, }) => {
|
|
16
|
+
const SidePanelRoot = ({ isOpen, onOpenChange, 'aria-label': ariaLabel, children, contentKey, className, 'data-testid': dataTestId, }) => {
|
|
17
17
|
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'side-panel', rootName: 'side-panel' });
|
|
18
18
|
const isDesktop = useBreakpoints.useBreakpoints('lg');
|
|
19
19
|
const setPageCovered = React.useContext(PageCover_context.PageCoverContext);
|
|
@@ -28,7 +28,7 @@ const SidePanelRoot = ({ isOpen, onOpenChange, 'aria-label': ariaLabel, children
|
|
|
28
28
|
}, [setPageCovered, coversPage]);
|
|
29
29
|
if (!canMeasureViewport)
|
|
30
30
|
return null;
|
|
31
|
-
return (jsxRuntime.jsx(SidePanel_context.SidePanelContext.Provider, { value: { close: () => onOpenChange(false), label: ariaLabel }, children: jsxRuntime.jsx(testIdUtils.TestIdProvider, { value: rootTestId, children: jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: isOpen && (jsxRuntime.jsx(SidePanelRegion.SidePanelRegion, { "aria-label": ariaLabel, className: className, testId: rootTestId, isDesktop: isDesktop, shouldFocusOnMount: shouldFocusOnMount, children: children }, "side-panel")) }) }) }));
|
|
31
|
+
return (jsxRuntime.jsx(SidePanel_context.SidePanelContext.Provider, { value: { close: () => onOpenChange(false), label: ariaLabel }, children: jsxRuntime.jsx(testIdUtils.TestIdProvider, { value: rootTestId, children: jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: isOpen && (jsxRuntime.jsx(SidePanelRegion.SidePanelRegion, { "aria-label": ariaLabel, className: className, contentKey: contentKey, testId: rootTestId, isDesktop: isDesktop, shouldFocusOnMount: shouldFocusOnMount, children: children }, "side-panel")) }) }) }));
|
|
32
32
|
};
|
|
33
33
|
SidePanelRoot.displayName = 'SidePanel';
|
|
34
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/SidePanel/index.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useBreakpoints","useContext","PageCoverContext","useOpenOnMount","useEffect","_jsx","SidePanelContext","TestIdProvider","AnimatePresence","SidePanelRegion","SidePanelHeader","SidePanelContent","SidePanelFooter"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/SidePanel/index.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useBreakpoints","useContext","PageCoverContext","useOpenOnMount","useEffect","_jsx","SidePanelContext","TestIdProvider","AnimatePresence","SidePanelRegion","SidePanelHeader","SidePanelContent","SidePanelFooter"],"mappings":";;;;;;;;;;;;;;;AA0CA,MAAM,aAA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E,UAAU,EAClB,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EAAA,QAAA,EAErC,QAAQ,EAAA,EARL,YAAY,CASA,CACnB,EAAA,CACe,EAAA,CACH,EAAA,CACS;AAEhC,CAAC;AACD,aAAa,CAAC,WAAW,GAAG,WAAW;AAEvC;;;;;;;AAOG;AACH,MAAM,SAAS,GAAG;AAMlB,SAAS,CAAC,MAAM,GAAGC,+BAAe;AAClC,SAAS,CAAC,OAAO,GAAGC,iCAAgB;AACpC,SAAS,CAAC,MAAM,GAAGC,+BAAe;;;"}
|
|
@@ -20,13 +20,15 @@ export interface SidePanelProps {
|
|
|
20
20
|
'aria-label': string;
|
|
21
21
|
/** Compose `SidePanel.Header`, `SidePanel.Content` and `SidePanel.Footer`. */
|
|
22
22
|
children: ReactNode;
|
|
23
|
+
/** Identifies the content shown; when it changes while the panel is open, the new content fades in instead of jumping into place. */
|
|
24
|
+
contentKey?: string;
|
|
23
25
|
/** Extra classes merged onto the panel. */
|
|
24
26
|
className?: string;
|
|
25
27
|
/** Overrides the root `data-testid` (defaults to `fd-side-panel`). Descendants derive their ids from this prefix. */
|
|
26
28
|
'data-testid'?: string;
|
|
27
29
|
}
|
|
28
30
|
declare const SidePanelRoot: {
|
|
29
|
-
({ isOpen, onOpenChange, "aria-label": ariaLabel, children, className, "data-testid": dataTestId, }: SidePanelProps): ReactNode;
|
|
31
|
+
({ isOpen, onOpenChange, "aria-label": ariaLabel, children, contentKey, className, "data-testid": dataTestId, }: SidePanelProps): ReactNode;
|
|
30
32
|
displayName: string;
|
|
31
33
|
};
|
|
32
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/SidePanel/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,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;;OAKG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB,oEAAoE;IACpE,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,QAAQ,EAAE,SAAS,CAAC;IACpB,qIAAqI;IACrI,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qHAAqH;IACrH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,aAAa;qHAQhB,cAAc,GAAG,SAAS;;CAqC5B,CAAC;AAGF;;;;;;;GAOG;AACH,QAAA,MAAM,SAAS,EAAoB,OAAO,aAAa,GAAG;IACxD,MAAM,EAAE,OAAO,eAAe,CAAC;IAC/B,OAAO,EAAE,OAAO,gBAAgB,CAAC;IACjC,MAAM,EAAE,OAAO,eAAe,CAAC;CAChC,CAAC;AAMF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -12,7 +12,7 @@ import { useOpenOnMount } from './hooks/useOpenOnMount.js';
|
|
|
12
12
|
import { PageCoverContext } from './providers/PageCover.context.js';
|
|
13
13
|
import { SidePanelContext } from './providers/SidePanel.context.js';
|
|
14
14
|
|
|
15
|
-
const SidePanelRoot = ({ isOpen, onOpenChange, 'aria-label': ariaLabel, children, className, 'data-testid': dataTestId, }) => {
|
|
15
|
+
const SidePanelRoot = ({ isOpen, onOpenChange, 'aria-label': ariaLabel, children, contentKey, className, 'data-testid': dataTestId, }) => {
|
|
16
16
|
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'side-panel', rootName: 'side-panel' });
|
|
17
17
|
const isDesktop = useBreakpoints('lg');
|
|
18
18
|
const setPageCovered = useContext(PageCoverContext);
|
|
@@ -27,7 +27,7 @@ const SidePanelRoot = ({ isOpen, onOpenChange, 'aria-label': ariaLabel, children
|
|
|
27
27
|
}, [setPageCovered, coversPage]);
|
|
28
28
|
if (!canMeasureViewport)
|
|
29
29
|
return null;
|
|
30
|
-
return (jsx(SidePanelContext.Provider, { value: { close: () => onOpenChange(false), label: ariaLabel }, children: jsx(TestIdProvider, { value: rootTestId, children: jsx(AnimatePresence, { initial: false, children: isOpen && (jsx(SidePanelRegion, { "aria-label": ariaLabel, className: className, testId: rootTestId, isDesktop: isDesktop, shouldFocusOnMount: shouldFocusOnMount, children: children }, "side-panel")) }) }) }));
|
|
30
|
+
return (jsx(SidePanelContext.Provider, { value: { close: () => onOpenChange(false), label: ariaLabel }, children: jsx(TestIdProvider, { value: rootTestId, children: jsx(AnimatePresence, { initial: false, children: isOpen && (jsx(SidePanelRegion, { "aria-label": ariaLabel, className: className, contentKey: contentKey, testId: rootTestId, isDesktop: isDesktop, shouldFocusOnMount: shouldFocusOnMount, children: children }, "side-panel")) }) }) }));
|
|
31
31
|
};
|
|
32
32
|
SidePanelRoot.displayName = 'SidePanel';
|
|
33
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/SidePanel/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/SidePanel/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;AA0CA,MAAM,aAAa,GAAG,CAAC,EACrB,MAAM,EACN,YAAY,EACZ,YAAY,EAAE,SAAS,EACvB,QAAQ,EACR,UAAU,EACV,SAAS,EACT,aAAa,EAAE,UAAU,GACV,KAAe;AAC9B,IAAA,MAAM,UAAU,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAC3G,IAAA,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,CAAC;AACtC,IAAA,MAAM,cAAc,GAAG,UAAU,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,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Card` has no React Native implementation.
|
|
3
|
+
*
|
|
4
|
+
* This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
|
|
5
|
+
* that importing `@flipdish/ui-library/components/atoms/Card` from React Native fails at
|
|
6
|
+
* compile time rather than resolving to the web build's types. There is no
|
|
7
|
+
* matching `index.js`, so Metro cannot bundle this module either.
|
|
8
|
+
*
|
|
9
|
+
* To make `Card` available on React Native, add an `index.native.tsx` beside
|
|
10
|
+
* its `index.tsx` — the build picks it up automatically and this stub disappears.
|
|
11
|
+
*/
|
|
12
|
+
export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `CopyButton` has no React Native implementation.
|
|
3
|
+
*
|
|
4
|
+
* This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
|
|
5
|
+
* that importing `@flipdish/ui-library/components/atoms/CopyButton` from React Native fails at
|
|
6
|
+
* compile time rather than resolving to the web build's types. There is no
|
|
7
|
+
* matching `index.js`, so Metro cannot bundle this module either.
|
|
8
|
+
*
|
|
9
|
+
* To make `CopyButton` available on React Native, add an `index.native.tsx` beside
|
|
10
|
+
* its `index.tsx` — the build picks it up automatically and this stub disappears.
|
|
11
|
+
*/
|
|
12
|
+
export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Flag` has no React Native implementation.
|
|
3
|
+
*
|
|
4
|
+
* This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
|
|
5
|
+
* that importing `@flipdish/ui-library/components/atoms/Flag` from React Native fails at
|
|
6
|
+
* compile time rather than resolving to the web build's types. There is no
|
|
7
|
+
* matching `index.js`, so Metro cannot bundle this module either.
|
|
8
|
+
*
|
|
9
|
+
* To make `Flag` available on React Native, add an `index.native.tsx` beside
|
|
10
|
+
* its `index.tsx` — the build picks it up automatically and this stub disappears.
|
|
11
|
+
*/
|
|
12
|
+
export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `SearchInput` has no React Native implementation.
|
|
3
|
+
*
|
|
4
|
+
* This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
|
|
5
|
+
* that importing `@flipdish/ui-library/components/atoms/SearchInput` from React Native fails at
|
|
6
|
+
* compile time rather than resolving to the web build's types. There is no
|
|
7
|
+
* matching `index.js`, so Metro cannot bundle this module either.
|
|
8
|
+
*
|
|
9
|
+
* To make `SearchInput` available on React Native, add an `index.native.tsx` beside
|
|
10
|
+
* its `index.tsx` — the build picks it up automatically and this stub disappears.
|
|
11
|
+
*/
|
|
12
|
+
export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `DetailList` has no React Native implementation.
|
|
3
|
+
*
|
|
4
|
+
* This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
|
|
5
|
+
* that importing `@flipdish/ui-library/components/molecules/DetailList` from React Native fails at
|
|
6
|
+
* compile time rather than resolving to the web build's types. There is no
|
|
7
|
+
* matching `index.js`, so Metro cannot bundle this module either.
|
|
8
|
+
*
|
|
9
|
+
* To make `DetailList` available on React Native, add an `index.native.tsx` beside
|
|
10
|
+
* its `index.tsx` — the build picks it up automatically and this stub disappears.
|
|
11
|
+
*/
|
|
12
|
+
export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flipdish/ui-library",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Flipdish Design System — atomic-design component library (Tailwind v4 + UntitledUI + React Aria).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"imports": {
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
"@react-aria/utils": "^3.34.1",
|
|
99
99
|
"@react-stately/utils": "^3.12.1",
|
|
100
100
|
"@react-types/shared": "^3.36.0",
|
|
101
|
+
"country-flag-icons": "^1.6.20",
|
|
101
102
|
"react-error-boundary": "^4.1.2",
|
|
102
103
|
"tailwindcss-animate": "^1.0.7",
|
|
103
104
|
"tailwindcss-react-aria-components": "^2.1.1"
|