@harpercollins/harpercollins-design-system 1.16.0 → 1.16.5
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/cjs/index.cjs +3 -11
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/types/src/components/overlay/Drawer/Drawer.d.ts +3 -5
- package/dist/cjs/types/src/hooks/useSentryFeedbackOpen.d.ts +7 -0
- package/dist/cjs/types/src/hooks/useSentryFeedbackOpen.stories.d.ts +16 -0
- package/dist/esm/index.js +3 -11
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/overlay/Drawer/Drawer.d.ts +3 -5
- package/dist/esm/types/src/hooks/useSentryFeedbackOpen.d.ts +7 -0
- package/dist/esm/types/src/hooks/useSentryFeedbackOpen.stories.d.ts +16 -0
- package/dist/index.d.ts +3 -6
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
import { DrawerProps } from "@mui/joy";
|
|
3
|
+
export interface ModalWindowProps extends Omit<DrawerProps, "open" | "anchor"> {
|
|
3
4
|
side: "left" | "right";
|
|
4
5
|
size?: "sm" | "md" | "lg";
|
|
5
6
|
open: boolean;
|
|
@@ -7,10 +8,7 @@ export interface ModalWindowProps {
|
|
|
7
8
|
onCloseCompleted?: () => void;
|
|
8
9
|
closeRequested?: boolean;
|
|
9
10
|
closeBlocked?: boolean;
|
|
10
|
-
disableGutters?: boolean;
|
|
11
11
|
showCloseButton?: boolean;
|
|
12
12
|
}
|
|
13
|
-
declare const Modal: React.ForwardRefExoticComponent<ModalWindowProps &
|
|
14
|
-
children?: React.ReactNode | undefined;
|
|
15
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
declare const Modal: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<ModalWindowProps>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
14
|
export default Modal;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook to determine if the Sentry feedback dialog is open.
|
|
3
|
+
* We are using MutationObserver to watch for changes in the shadow DOM of the Sentry feedback container because Sentry doesn't provide a direct API to check if the feedback dialog is open.
|
|
4
|
+
* @returns {boolean} - Returns true if the Sentry feedback dialog is open, false otherwise.
|
|
5
|
+
*/
|
|
6
|
+
declare function useSentryFeedbackOpen(): boolean;
|
|
7
|
+
export default useSentryFeedbackOpen;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example component to demonstrate useSentryFeedbackOpen hook.
|
|
3
|
+
*/
|
|
4
|
+
export declare function Demo(): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const _default: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: typeof Demo;
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
package/dist/esm/index.js
CHANGED
|
@@ -157,15 +157,7 @@ const pw={prefix:"fas",iconName:"circle-notch",icon:[512,512,[],"f1ce","M222.7 3
|
|
|
157
157
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
158
158
|
* Copyright 2024 Fonticons, Inc.
|
|
159
159
|
*/const vC={prefix:"far",iconName:"user",icon:[448,512,[128100,62144],"f007","M304 128a80 80 0 1 0 -160 0 80 80 0 1 0 160 0zM96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM49.3 464l349.5 0c-8.9-63.3-63.3-112-129-112l-91.4 0c-65.7 0-120.1 48.7-129 112zM0 482.3C0 383.8 79.8 304 178.3 304l91.4 0C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7L29.7 512C13.3 512 0 498.7 0 482.3z"]},bC={prefix:"far",iconName:"circle-question",icon:[512,512,[62108,"question-circle"],"f059","M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm169.8-90.7c7.9-22.3 29.1-37.3 52.8-37.3l58.3 0c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24l0-13.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1l-58.3 0c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"]},yC={prefix:"far",iconName:"clock",icon:[512,512,[128339,"clock-four"],"f017","M464 256A208 208 0 1 1 48 256a208 208 0 1 1 416 0zM0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256zM232 120l0 136c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2 280 120c0-13.3-10.7-24-24-24s-24 10.7-24 24z"]};function wC(t){return e(wi,{...t})}const xC=cw.div`
|
|
160
|
-
|
|
161
|
-
padding-left: ${({$disableGutters:e})=>e?"0":"60px"};
|
|
162
|
-
padding-right: ${({$disableGutters:e})=>e?"0":"60px"};
|
|
163
|
-
padding-top: ${({$disableGutters:e})=>e?"0":"40px"};
|
|
164
|
-
|
|
165
|
-
@media only screen and (max-width: 600px) {
|
|
166
|
-
padding-left: ${({$disableGutters:e})=>e?"0":"30px"};
|
|
167
|
-
padding-right: ${({$disableGutters:e})=>e?"0":"30px"};
|
|
168
|
-
}
|
|
160
|
+
height: 100vh;
|
|
169
161
|
|
|
170
162
|
h2 {
|
|
171
163
|
font-size: var(--font-size--xlarge);
|
|
@@ -330,7 +322,7 @@ const pw={prefix:"fas",iconName:"circle-notch",icon:[512,512,[],"f1ce","M222.7 3
|
|
|
330
322
|
}
|
|
331
323
|
`,MC=cw.div`
|
|
332
324
|
position: relative;
|
|
333
|
-
`;let zC=1;const $C=a((({children:n,side:r,size:a="md",open:i=!1,closeBlocked:l,onClose:d=()=>{},onCloseCompleted:u=()=>{},closeRequested:p=!1,
|
|
325
|
+
`;let zC=1;const $C=a((({children:n,side:r,size:a="md",open:i=!1,closeBlocked:l,onClose:d=()=>{},onCloseCompleted:u=()=>{},closeRequested:p=!1,showCloseButton:f=!1,...m},h)=>{const g=c(null);g.current||(g.current=`overlay-${zC}`,zC+=1);const v=c(null),[b,y]=o.useState(!1);o.useEffect((()=>{if(b){const e=setTimeout(u,200);return()=>{clearTimeout(e)}}return()=>{}})),s((()=>{p&&y(!0)}),[p]),g.current||(g.current=`modal-${zC}`,zC+=1),s((()=>{document.body.style.overflow=i?"hidden":"auto"}),[i]),s((()=>{const e=e=>{"Escape"===e.key&&(e.preventDefault(),d())};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[d]);return e(Th,{open:i&&!b,anchor:r,className:`${r} ${i?"open":"closing"}`,size:a,...m,children:e(IC,{children:t(PC,{ref:v,children:[l&&t(NC,{role:"alert","aria-live":"assertive",children:[e(dC,{icon:Dw}),t("p",{children:[e("strong",{children:"You have unsaved changes."})," Please save or cancel before closing."]})]}),e(MC,{ref:h,children:t(xC,{children:[f&&e(tm,{sx:{display:"flex",justifyContent:"flex-end",padding:"1rem"},children:e(hp,{onClick:()=>d(),color:"neutral",children:e(dC,{icon:kw,size:"lg"})})}),n]})})]})})})})),AC=cw(Ld)`
|
|
334
326
|
text-transform: uppercase;
|
|
335
327
|
font-size: var(--font-size--xsmall);
|
|
336
328
|
font-weight: var(--font-weight--bold);
|
|
@@ -422,7 +414,7 @@ const pw={prefix:"fas",iconName:"circle-notch",icon:[512,512,[],"f1ce","M222.7 3
|
|
|
422
414
|
opacity: 1;
|
|
423
415
|
}
|
|
424
416
|
}
|
|
425
|
-
`;function QC({apps:a,currentApp:i,leftSide:l,rightSide:s,myAccountMenu:c,workspaces:d,workspacesMenu:u,currentWorkspace:p,helpButton:f,mobileMenuPrimary:m,mobileMenuSecondary:h,user:g,logoUrl:v}){const[b,y]=o.useState([{isOpen:!1,id:"primary"},{isOpen:!1,id:"secondary"}]),x=(e,t)=>{y(b?.map((n=>n.id===e?{...n,isOpen:t}:n)))},k=e=>b.find((t=>t.id===e))?.isOpen,S=m?t(n,{children:[e(XC,{onClick:()=>x("primary",!0),children:e(dC,{icon:fw,size:"md"})}),e($C,{open:k("primary"),onClose:()=>{x("primary",!1)},side:"left",
|
|
417
|
+
`;function QC({apps:a,currentApp:i,leftSide:l,rightSide:s,myAccountMenu:c,workspaces:d,workspacesMenu:u,currentWorkspace:p,helpButton:f,mobileMenuPrimary:m,mobileMenuSecondary:h,user:g,logoUrl:v}){const[b,y]=o.useState([{isOpen:!1,id:"primary"},{isOpen:!1,id:"secondary"}]),x=(e,t)=>{y(b?.map((n=>n.id===e?{...n,isOpen:t}:n)))},k=e=>b.find((t=>t.id===e))?.isOpen,S=m?t(n,{children:[e(XC,{onClick:()=>x("primary",!0),children:e(dC,{icon:fw,size:"md"})}),e($C,{open:k("primary"),onClose:()=>{x("primary",!1)},side:"left",size:"lg",showCloseButton:!0,children:e(tm,{role:"presentation",onClick:()=>x("primary",!1),onKeyDown:()=>x("primary",!1),children:m})})]}):null,C=Array.isArray(d)&&d.length>0?e("div",{style:d.length<=1?{pointerEvents:"none"}:void 0,children:t(wC,{children:[e(GC,{size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation()},children:p}),t(FC,{placement:"bottom-start",children:[e(AC,{sticky:!0,children:"Workspaces"}),u]})]})}):null,O=t(YC,{children:[s,C,f?e(wC,{children:e(GC,{size:"sm",href:f.href,component:f.as,"aria-label":f.text,startDecorator:e(dC,{icon:bC,size:"sm"}),children:f.text||"Help"})}):null,g&&c?t(wC,{children:[e(GC,{size:"sm",startDecorator:e(dC,{icon:vC,size:"sm"}),children:g?.displayName?g.displayName:"My Account"}),c]}):null]}),D=t(tm,{sx:{display:{xs:"flex",md:"none"}},children:[e(XC,{onClick:()=>x("secondary",!0),color:"neutral",children:e(dC,{icon:bw,size:"md"})}),e($C,{open:k("secondary"),onClose:()=>{x("secondary",!1)},side:"right",size:"lg",showCloseButton:!0,children:e(tm,{role:"presentation",onClick:()=>x("secondary",!1),onKeyDown:()=>x("secondary",!1),children:h})})]}),_=(()=>{const e=ar(Ya);return"production"!==process.env.NODE_ENV&&r.useDebugValue(e),e[w]||e})(),{logoFillColour:T}=_.palette.appbar;return t(HC,{children:[t(tm,{sx:{display:"flex",alignItems:"center",gap:"1rem"},children:[e(tm,{sx:{display:{xs:"flex",md:"none"}},children:S}),t(WC,{href:v||"/",children:[e(tm,{sx:{display:{xs:"none",md:"flex"}},children:e(BC,{fillColour:T})}),e(tm,{sx:{display:{xs:"flex",md:"none"}},children:e(VC,{fillColour:T})})]}),e(JC,{apps:a,currentApp:i})]}),t(tm,{sx:{display:"flex"},children:[e(KC,{children:l}),e(tm,{sx:{display:{xs:"none",md:"flex"}},children:O}),h&&D]})]})}function ZC({id:r,options:a,onChange:i,name:l,...s}){const[c,d]=o.useState(s.defaultValue),[u,p]=o.useState(s.defaultValue?.value);return t(n,{children:[e(zf,{...s,sx:{"--Input-minHeight":"2.6rem"},id:r,options:a,onChange:(e,t,n)=>{d(t),p(t?t?.value:""),i&&i(e,t,n)},getOptionLabel:e=>e.label,isOptionEqualToValue:(e,t)=>e.value===t.value,value:c,renderOption:s.renderOption,name:""}),e(Gp,{name:l,value:u,type:"hidden",sx:{display:"none"}})]})}function eO(t){return e(au,{...t})}const tO=cw.button`
|
|
426
418
|
float: right;
|
|
427
419
|
border: none;
|
|
428
420
|
background: none;
|