@flipdish/ui-library 0.32.0 → 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/Carousel/hooks/useCarouselScroll.cjs +81 -0
- package/dist/components/molecules/Carousel/hooks/useCarouselScroll.cjs.map +1 -0
- package/dist/components/molecules/Carousel/hooks/useCarouselScroll.d.ts +46 -0
- package/dist/components/molecules/Carousel/hooks/useCarouselScroll.d.ts.map +1 -0
- package/dist/components/molecules/Carousel/hooks/useCarouselScroll.js +79 -0
- package/dist/components/molecules/Carousel/hooks/useCarouselScroll.js.map +1 -0
- package/dist/components/molecules/Carousel/index.cjs +8 -55
- package/dist/components/molecules/Carousel/index.cjs.map +1 -1
- package/dist/components/molecules/Carousel/index.d.ts +3 -7
- package/dist/components/molecules/Carousel/index.d.ts.map +1 -1
- package/dist/components/molecules/Carousel/index.js +9 -56
- package/dist/components/molecules/Carousel/index.js.map +1 -1
- package/dist/components/molecules/CodeSnippet/codeSnippet.utils.cjs +17 -0
- package/dist/components/molecules/CodeSnippet/codeSnippet.utils.cjs.map +1 -0
- package/dist/components/molecules/CodeSnippet/codeSnippet.utils.d.ts +8 -0
- package/dist/components/molecules/CodeSnippet/codeSnippet.utils.d.ts.map +1 -0
- package/dist/components/molecules/CodeSnippet/codeSnippet.utils.js +15 -0
- package/dist/components/molecules/CodeSnippet/codeSnippet.utils.js.map +1 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetCollapse.cjs +29 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetCollapse.cjs.map +1 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetCollapse.d.ts +29 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetCollapse.d.ts.map +1 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetCollapse.js +27 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetCollapse.js.map +1 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetHighlight.cjs +23 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetHighlight.cjs.map +1 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetHighlight.d.ts +21 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetHighlight.d.ts.map +1 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetHighlight.js +21 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetHighlight.js.map +1 -0
- package/dist/components/molecules/CodeSnippet/index.cjs +7 -22
- package/dist/components/molecules/CodeSnippet/index.cjs.map +1 -1
- package/dist/components/molecules/CodeSnippet/index.d.ts.map +1 -1
- package/dist/components/molecules/CodeSnippet/index.js +8 -23
- package/dist/components/molecules/CodeSnippet/index.js.map +1 -1
- 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/DatePicker/calendarCell.utils.cjs +53 -0
- package/dist/components/organisms/DatePicker/calendarCell.utils.cjs.map +1 -0
- package/dist/components/organisms/DatePicker/calendarCell.utils.d.ts +70 -0
- package/dist/components/organisms/DatePicker/calendarCell.utils.d.ts.map +1 -0
- package/dist/components/organisms/DatePicker/calendarCell.utils.js +49 -0
- package/dist/components/organisms/DatePicker/calendarCell.utils.js.map +1 -0
- package/dist/components/organisms/DatePicker/components/Cell.cjs +24 -30
- package/dist/components/organisms/DatePicker/components/Cell.cjs.map +1 -1
- package/dist/components/organisms/DatePicker/components/Cell.d.ts.map +1 -1
- package/dist/components/organisms/DatePicker/components/Cell.js +25 -31
- package/dist/components/organisms/DatePicker/components/Cell.js.map +1 -1
- package/dist/components/organisms/FileUpload/fileUpload.utils.cjs +69 -0
- package/dist/components/organisms/FileUpload/fileUpload.utils.cjs.map +1 -0
- package/dist/components/organisms/FileUpload/fileUpload.utils.d.ts +46 -0
- package/dist/components/organisms/FileUpload/fileUpload.utils.d.ts.map +1 -0
- package/dist/components/organisms/FileUpload/fileUpload.utils.js +65 -0
- package/dist/components/organisms/FileUpload/fileUpload.utils.js.map +1 -0
- package/dist/components/organisms/FileUpload/index.cjs +15 -66
- package/dist/components/organisms/FileUpload/index.cjs.map +1 -1
- package/dist/components/organisms/FileUpload/index.d.ts.map +1 -1
- package/dist/components/organisms/FileUpload/index.js +13 -64
- package/dist/components/organisms/FileUpload/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/components/organisms/TreeView/index.cjs +11 -26
- package/dist/components/organisms/TreeView/index.cjs.map +1 -1
- package/dist/components/organisms/TreeView/index.d.ts.map +1 -1
- package/dist/components/organisms/TreeView/index.js +12 -27
- package/dist/components/organisms/TreeView/index.js.map +1 -1
- package/dist/components/organisms/TreeView/treeView.utils.cjs +40 -0
- package/dist/components/organisms/TreeView/treeView.utils.cjs.map +1 -1
- package/dist/components/organisms/TreeView/treeView.utils.d.ts +37 -0
- package/dist/components/organisms/TreeView/treeView.utils.d.ts.map +1 -1
- package/dist/components/organisms/TreeView/treeView.utils.js +39 -1
- package/dist/components/organisms/TreeView/treeView.utils.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 +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelContent.cjs","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelContent.tsx"],"sourcesContent":[null],"names":["useTestIdPrefix","_jsx","joinTestId","cx"],"mappings":";;;;;;AAWA;AACO,MAAM,gBAAgB,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,KAAK,EAAyB,KAAI;AAC5G,IAAA,MAAM,MAAM,GAAGA,2BAAe,EAAE;
|
|
1
|
+
{"version":3,"file":"SidePanelContent.cjs","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelContent.tsx"],"sourcesContent":[null],"names":["useTestIdPrefix","_jsx","joinTestId","cx"],"mappings":";;;;;;AAWA;AACO,MAAM,gBAAgB,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,KAAK,EAAyB,KAAI;AAC5G,IAAA,MAAM,MAAM,GAAGA,2BAAe,EAAE;IAEhC,QACEC,2BACM,KAAK,EAAA,aAAA,EACI,UAAU,KAAK,MAAM,GAAGC,sBAAU,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,SAAS,CAAC;;QAE/E,SAAS,EAAEC,KAAE,CAAC,6EAA6E,EAAE,SAAS,CAAC,EAAA,CACvG;AAEN;AACA,gBAAgB,CAAC,WAAW,GAAG,kBAAkB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelContent.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelContent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,KAAK,CAAC,GAAG;IACjE,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB;yDAAwD,qBAAqB;;
|
|
1
|
+
{"version":3,"file":"SidePanelContent.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelContent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,KAAK,CAAC,GAAG;IACjE,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB;yDAAwD,qBAAqB;;CAWzG,CAAC"}
|
|
@@ -5,7 +5,9 @@ import { useTestIdPrefix, joinTestId } from '@flipdish/ui-library/utilities/test
|
|
|
5
5
|
/** The scrolling body. It takes the height the header and footer leave. */
|
|
6
6
|
const SidePanelContent = ({ className, 'data-testid': dataTestId, ...props }) => {
|
|
7
7
|
const prefix = useTestIdPrefix();
|
|
8
|
-
return (jsx("div", { ...props, "data-testid": dataTestId ?? (prefix ? joinTestId(prefix, 'content') : undefined),
|
|
8
|
+
return (jsx("div", { ...props, "data-testid": dataTestId ?? (prefix ? joinTestId(prefix, 'content') : undefined),
|
|
9
|
+
// The header carries the space above; this carries the space below, so the last item never sits on the footer.
|
|
10
|
+
className: cx('flex min-h-0 w-full flex-1 flex-col gap-6 overflow-y-auto px-4 pb-6 lg:px-6', className) }));
|
|
9
11
|
};
|
|
10
12
|
SidePanelContent.displayName = 'SidePanelContent';
|
|
11
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelContent.js","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelContent.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;AAWA;AACO,MAAM,gBAAgB,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,KAAK,EAAyB,KAAI;AAC5G,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE;
|
|
1
|
+
{"version":3,"file":"SidePanelContent.js","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelContent.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;AAWA;AACO,MAAM,gBAAgB,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,KAAK,EAAyB,KAAI;AAC5G,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE;IAEhC,QACEA,gBACM,KAAK,EAAA,aAAA,EACI,UAAU,KAAK,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,SAAS,CAAC;;QAE/E,SAAS,EAAE,EAAE,CAAC,6EAA6E,EAAE,SAAS,CAAC,EAAA,CACvG;AAEN;AACA,gBAAgB,CAAC,WAAW,GAAG,kBAAkB;;"}
|
|
@@ -4,10 +4,10 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
5
5
|
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
6
6
|
|
|
7
|
-
/** Pinned actions under the content, such as a message input. */
|
|
8
|
-
const SidePanelFooter = ({ className, 'data-testid': dataTestId, ...props }) => {
|
|
7
|
+
/** Pinned actions under the content, such as a message input or a primary button. */
|
|
8
|
+
const SidePanelFooter = ({ className, variant = 'plain', 'data-testid': dataTestId, ...props }) => {
|
|
9
9
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
10
|
-
return (jsxRuntime.jsx("footer", { ...props, "data-testid": dataTestId ?? (prefix ? testIdUtils.joinTestId(prefix, 'footer') : undefined), className: cx.cx('w-full px-4 pb-4 lg:px-6 lg:pb-5', className) }));
|
|
10
|
+
return (jsxRuntime.jsx("footer", { ...props, "data-testid": dataTestId ?? (prefix ? testIdUtils.joinTestId(prefix, 'footer') : undefined), className: cx.cx('w-full px-4 pb-4 lg:px-6 lg:pb-5', variant === 'actions' && 'flex items-center justify-end gap-3 border-t border-secondary pt-4', className) }));
|
|
11
11
|
};
|
|
12
12
|
SidePanelFooter.displayName = 'SidePanelFooter';
|
|
13
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelFooter.cjs","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelFooter.tsx"],"sourcesContent":[null],"names":["useTestIdPrefix","_jsx","joinTestId","cx"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"SidePanelFooter.cjs","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelFooter.tsx"],"sourcesContent":[null],"names":["useTestIdPrefix","_jsx","joinTestId","cx"],"mappings":";;;;;;AAgBA;MACa,eAAe,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,KAAK,EAAwB,KAAI;AAC7H,IAAA,MAAM,MAAM,GAAGA,2BAAe,EAAE;AAEhC,IAAA,QACEC,cAAA,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,CACX,kCAAkC,EAClC,OAAO,KAAK,SAAS,IAAI,oEAAoE,EAC7F,SAAS,CACV,EAAA,CACD;AAEN;AACA,eAAe,CAAC,WAAW,GAAG,iBAAiB;;"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef } from 'react';
|
|
2
2
|
export type SidePanelFooterProps = ComponentPropsWithRef<'footer'> & {
|
|
3
|
+
/**
|
|
4
|
+
* `plain` pads the content, for a message input. `actions` adds the top border of the design's
|
|
5
|
+
* action bar and right-aligns its children, for one or two buttons.
|
|
6
|
+
*/
|
|
7
|
+
variant?: 'plain' | 'actions';
|
|
3
8
|
/** Overrides the footer's `data-testid` (defaults to `<root>--footer`). */
|
|
4
9
|
'data-testid'?: string;
|
|
5
10
|
};
|
|
6
|
-
/** Pinned actions under the content, such as a message input. */
|
|
11
|
+
/** Pinned actions under the content, such as a message input or a primary button. */
|
|
7
12
|
export declare const SidePanelFooter: {
|
|
8
|
-
({ className, "data-testid": dataTestId, ...props }: SidePanelFooterProps): import("react").JSX.Element;
|
|
13
|
+
({ className, variant, "data-testid": dataTestId, ...props }: SidePanelFooterProps): import("react").JSX.Element;
|
|
9
14
|
displayName: string;
|
|
10
15
|
};
|
|
11
16
|
//# sourceMappingURL=SidePanelFooter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelFooter.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelFooter.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,GAAG;IACnE,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"SidePanelFooter.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelFooter.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,GAAG;IACnE;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,eAAe;kEAA2E,oBAAoB;;CAc1H,CAAC"}
|
|
@@ -2,10 +2,10 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
3
3
|
import { useTestIdPrefix, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
4
4
|
|
|
5
|
-
/** Pinned actions under the content, such as a message input. */
|
|
6
|
-
const SidePanelFooter = ({ className, 'data-testid': dataTestId, ...props }) => {
|
|
5
|
+
/** Pinned actions under the content, such as a message input or a primary button. */
|
|
6
|
+
const SidePanelFooter = ({ className, variant = 'plain', 'data-testid': dataTestId, ...props }) => {
|
|
7
7
|
const prefix = useTestIdPrefix();
|
|
8
|
-
return (jsx("footer", { ...props, "data-testid": dataTestId ?? (prefix ? joinTestId(prefix, 'footer') : undefined), className: cx('w-full px-4 pb-4 lg:px-6 lg:pb-5', className) }));
|
|
8
|
+
return (jsx("footer", { ...props, "data-testid": dataTestId ?? (prefix ? joinTestId(prefix, 'footer') : undefined), className: cx('w-full px-4 pb-4 lg:px-6 lg:pb-5', variant === 'actions' && 'flex items-center justify-end gap-3 border-t border-secondary pt-4', className) }));
|
|
9
9
|
};
|
|
10
10
|
SidePanelFooter.displayName = 'SidePanelFooter';
|
|
11
11
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelFooter.js","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelFooter.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"SidePanelFooter.js","sources":["../../../../../src/components/organisms/SidePanel/components/SidePanelFooter.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;AAgBA;MACa,eAAe,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,KAAK,EAAwB,KAAI;AAC7H,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE;AAEhC,IAAA,QACEA,GAAA,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,CACX,kCAAkC,EAClC,OAAO,KAAK,SAAS,IAAI,oEAAoE,EAC7F,SAAS,CACV,EAAA,CACD;AAEN;AACA,eAAe,CAAC,WAAW,GAAG,iBAAiB;;"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var uiIcons = require('@flipdish/ui-icons');
|
|
4
5
|
var CloseButton = require('@flipdish/ui-library/components/atoms/CloseButton');
|
|
6
|
+
var UtilityButton = require('@flipdish/ui-library/components/atoms/UtilityButton');
|
|
5
7
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
6
8
|
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
7
9
|
var React = require('react');
|
|
8
10
|
var SidePanel_context = require('../providers/SidePanel.context.cjs');
|
|
9
11
|
|
|
10
|
-
/** Title area with a close button, which closes the panel unless `onClose` is passed. */
|
|
11
|
-
const SidePanelHeader = ({ className, children, onClose, closeLabel, 'data-testid': dataTestId, ...props }) => {
|
|
12
|
+
/** Title area with a close button, which closes the panel unless `onClose` is passed, and an optional back button. */
|
|
13
|
+
const SidePanelHeader = ({ className, children, onClose, closeLabel, onBack, backLabel = 'Back', 'data-testid': dataTestId, ...props }) => {
|
|
12
14
|
const panel = React.useContext(SidePanel_context.SidePanelContext);
|
|
13
15
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
14
|
-
return (jsxRuntime.jsxs("header", { ...props, "data-testid": dataTestId ?? (prefix ? testIdUtils.joinTestId(prefix, 'header') : undefined), className: cx.cx('relative w-full px-4 pt-6 pb-8 lg:px-6', className), children: [
|
|
16
|
+
return (jsxRuntime.jsxs("header", { ...props, "data-testid": dataTestId ?? (prefix ? testIdUtils.joinTestId(prefix, 'header') : undefined), className: cx.cx('relative w-full px-4 pt-6 pb-8 lg:px-6', onBack && 'flex items-center gap-3', className), children: [onBack && (jsxRuntime.jsx(UtilityButton.ButtonUtility, { icon: uiIcons.ArrowLeft, tooltip: backLabel, color: "tertiary", size: "sm",
|
|
17
|
+
// 32px tall in a 28px title line: pulled in so the header is as tall as one without a back button.
|
|
18
|
+
className: "-my-0.5", onClick: onBack, "data-testid": prefix ? testIdUtils.joinTestId(prefix, 'back') : undefined })), onBack ? jsxRuntime.jsx("div", { className: "min-w-0 flex-1 pr-12", children: children }) : children, jsxRuntime.jsx(CloseButton.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 ? testIdUtils.joinTestId(prefix, 'close') : undefined })] }));
|
|
15
19
|
};
|
|
16
20
|
SidePanelHeader.displayName = 'SidePanelHeader';
|
|
17
21
|
|
|
@@ -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/Sid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nB,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,YAAY,EAAE,SAAS,EACvB,QAAQ,EACR,SAAS,EACT,UAAU,EACV,MAAM,EACN,SAAS,EACT,kBAAkB,GACG,KAAI;AACzB,IAAA,MAAM,QAAQ,GAAGA,YAAM,CAAc,IAAI,CAAC;AAC1C,IAAA,MAAM,SAAS,GAAGC,kBAAY,EAAE;AAChC,IAAA,MAAM,kBAAkB,GAAGC,sBAAgB,EAAE;AAC7C,IAAA,MAAM,EAAE,cAAc,EAAE,GAAGC,2BAAa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,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;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,YAAY,EAAE,SAAS,EACvB,QAAQ,EACR,SAAS,EACT,UAAU,EACV,MAAM,EACN,SAAS,EACT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AC,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,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,UAAU,EAAwB,KAAI;AACxH,IAAA,MAAM,SAAS,GAAGA,YAAM,CAAqB,IAAI,CAAC;AAClD,IAAA,MAAM,iBAAiB,GAAGA,YAAM,CAAiB,IAAI,CAAC;AACtD,IAAA,MAAM,iBAAiB,GAAGA,YAAM,CAAC,SAAS,CAAC;;IAE3C,MAAM,CAAC,k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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":[],"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,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS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I;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,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,GAAGA,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAC3G,IAAA,MAAM,SAAS,GAAGC,6B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AAO,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,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAM/D,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,YAAY,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,YAAY,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8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M,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,CAAC,gBAAgB,CAAC;;IAEnD,MAAM,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC;IAEzE,MAAM,UAAU,GAAG,kBAAkB,IAAI,MAAM,IAAI,CAAC,SAAS;IAC7D,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,cAAc,IAAI,CAAC,UAAU;YAAE;QACpC,cAAc,CAAC,IAAI,CAAC;AACpB,QAAA,OAAO,MAAM,cAAc,CAAC,KAAK,CAAC;AACpC,IAAA,CAAC,EAAE,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;AAEhC,IAAA,IAAI,CAAC,kBAAkB;AAAE,QAAA,OAAO,IAAI;AAEpC,IAAA,QACEA,GAAA,CAAC,gBAAgB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAA,QAAA,EACtFA,IAAC,cAAc,EAAA,EAAC,KAAK,EAAE,UAAU,EAAA,QAAA,EAC/BA,GAAA,CAAC,eAAe,EAAA,EAAC,OAAO,EAAE,KAAK,EAAA,QAAA,EAC5B,MAAM,KACLA,GAAA,CAAC,eAAe,EAAA,EAAA,YAAA,EAEF,SAAS,EACrB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,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,GAAG,eAAe;AAClC,SAAS,CAAC,OAAO,GAAG,gBAAgB;AACpC,SAAS,CAAC,MAAM,GAAG,eAAe;;"}
|
|
@@ -138,32 +138,17 @@ const TreeViewItemContent = ({ icon: Icon, action, children, className }) => {
|
|
|
138
138
|
if (!collectionRef.current) {
|
|
139
139
|
collectionRef.current = collection;
|
|
140
140
|
}
|
|
141
|
-
const isIndeterminate =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
ctxSelectedKeys
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
})();
|
|
153
|
-
/* Connector lines — walk up from current item, prepending the connector for each ancestor level */
|
|
154
|
-
const connectors = [];
|
|
155
|
-
if (showConnectors && itemKey != null && level > 1) {
|
|
156
|
-
let key = itemKey;
|
|
157
|
-
for (let depth = 0; depth < level - 1; depth++) {
|
|
158
|
-
const node = collection.getItem(key);
|
|
159
|
-
if (!node?.parentKey)
|
|
160
|
-
break;
|
|
161
|
-
const siblings = [...(collection.getChildren?.(node.parentKey) ?? [])];
|
|
162
|
-
const isLast = siblings[siblings.length - 1]?.key === key;
|
|
163
|
-
connectors.unshift(jsxRuntime.jsx(Connector, { size: size, type: isLast ? (depth === 0 ? 'end' : 'none') : 'line' }, depth));
|
|
164
|
-
key = node.parentKey;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
141
|
+
const isIndeterminate = treeView_utils.isTreeItemIndeterminate({
|
|
142
|
+
itemKey,
|
|
143
|
+
collection,
|
|
144
|
+
selectedKeys: ctxSelectedKeys,
|
|
145
|
+
isSelected,
|
|
146
|
+
selectionMode,
|
|
147
|
+
hasChildItems,
|
|
148
|
+
});
|
|
149
|
+
const connectors = showConnectors && itemKey != null
|
|
150
|
+
? treeView_utils.getTreeConnectors(itemKey, level, collection).map(({ depth, type }) => jsxRuntime.jsx(Connector, { size: size, type: type }, depth))
|
|
151
|
+
: [];
|
|
167
152
|
const paddingLeft = showConnectors && level > 1 ? BASE_PADDING : BASE_PADDING + (level - 1) * INDENT_SIZE;
|
|
168
153
|
return (jsxRuntime.jsxs("div", { className: cx.cx('flex w-full cursor-pointer items-center gap-2 rounded-sm -outline-offset-2 outline-focus-ring transition duration-100 ease-linear', size === 'sm' ? 'py-1.5 pr-2' : 'py-2 pr-2', isDropTarget && 'bg-secondary_hover outline-2', !isDropTarget && (isSelected || isIndeterminate) && 'bg-secondary hover:bg-secondary_hover', !isDropTarget && !isSelected && !isIndeterminate && 'hover:bg-primary_hover', isDisabled && 'cursor-not-allowed opacity-50', isFocusVisible && 'outline-2', className), style: { paddingLeft }, children: [connectors, hasChildItems && (jsxRuntime.jsx(reactAriaComponents.Button, { slot: "chevron", "data-testid": chevronTestId, className: "flex shrink-0 items-center justify-center outline-hidden", children: isExpanded ? jsxRuntime.jsx(uiIcons.ChevronDown, { className: "size-4 text-fg-quaternary" }) : jsxRuntime.jsx(uiIcons.ChevronRight, { className: "size-4 text-fg-quaternary" }) })), selectionMode !== 'none' && (jsxRuntime.jsx(reactAriaComponents.Checkbox, { slot: "selection", "data-testid": checkboxTestId, className: "flex shrink-0 items-center justify-center outline-hidden", children: ({ isSelected: checkSelected, isDisabled: checkDisabled, isFocusVisible: checkFocus }) => (jsxRuntime.jsx(Checkbox.CheckboxBase, { size: "sm", isSelected: checkSelected || isIndeterminate, isIndeterminate: isIndeterminate, isDisabled: checkDisabled, isFocusVisible: checkFocus })) })), jsxRuntime.jsxs("div", { className: cx.cx('flex min-w-0 flex-1 items-center', size === 'sm' ? 'gap-1.5' : 'gap-2'), children: [Icon &&
|
|
169
154
|
(componentGuard_utils.isReactComponent(Icon) ? (jsxRuntime.jsx(Icon, { className: cx.cx('shrink-0 text-fg-quaternary', size === 'sm' ? 'size-4' : 'size-5') })) : React.isValidElement(Icon) ? (Icon) : null), jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate text-sm font-semibold text-tertiary", children: children }), action && (jsxRuntime.jsx("span", { "data-testid": actionTestId, className: "contents", children: action })), allowsDragging && (jsxRuntime.jsx(reactAriaComponents.Button, { slot: "drag", "data-testid": dragTestId, className: cx.cx('shrink-0 cursor-grab outline-hidden', !isSelected && 'hidden'), children: jsxRuntime.jsx(uiIcons.DotsGrid, { className: "size-4 text-fg-quaternary" }) }))] })] }));
|