@equinor/subsurface-app-management 1.1.16 → 1.1.18

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.
@@ -1 +1 @@
1
- import{jsxs as t,Fragment as r,jsx as e}from"react/jsx-runtime";import{useMemo as i}from"react";import{Typography as o,Button as n}from"@equinor/eds-core-react";import{DIALOG_EDGE_MARGIN as a,TUTORIAL_LOCALSTORAGE_VALUE_STRING as l}from"./TutorialProvider.const.js";import{useGetTutorialSasToken as s,useTutorial as m}from"./TutorialProvider.hooks.js";import{DialogImage as c,DialogWrapper as p,StyledTutorialDialog as d,DialogContent as u,DialogActions as g,NavigateSteps as T}from"./TutorialProvider.styles.js";import{getBestPositionWithoutOverlap as h}from"./TutorialProvider.utils.js";import f from"./TutorialStepIndicator.js";import"../../api/core/OpenAPI.js";import"../../api/models/ApplicationCategory.js";import"../../api/models/ServiceNowUrgency.js";import{TutorialPosition as v}from"../../api/models/TutorialPosition.js";const P=()=>{const{data:P}=s(),{activeTutorial:j,currentStep:x,setCurrentStep:y,setActiveTutorial:S,dialogRef:k,allElementsToHighlight:O,customStepComponents:$,isLastStep:C,currentStepObject:R,setAllElementsToHighlight:B,shortNameFromParams:E,viewportWidth:I,clearSearchParam:w}=m(),H=i((()=>{if(R)return R.key&&$?$.find((t=>t.key===R.key))?.element:void 0===R.key||null===R.key?t(r,{children:[e(o,{children:R.title}),e(o,{children:R.body}),R.imgUrl&&P&&e(c,{"data-testid":"tutorial-image",alt:"tutorial-image",src:`${R.imgUrl}?${P}`})]}):void 0}),[R,$,P]),L=i((()=>{if(j&&I&&O&&k.current)return j.steps[x].position?j.steps[x].position:j.dynamicPositioning?h(O[x].getBoundingClientRect(),k.current.getBoundingClientRect()):v.BOTTOM_RIGHT}),[j,I,O,k,x]),N=i((()=>{if(L&&L!==v.CENTER)switch(L){case v.TOP_LEFT:return{marginTop:`${a}px`,marginLeft:`${a}px`};case v.TOP_RIGHT:return{marginTop:`${a}px`,marginRight:`${a}px`};case v.BOTTOM_LEFT:return{marginBottom:`${a}px`,marginLeft:`${a}px`};case v.BOTTOM_RIGHT:default:return{marginBottom:`${a}px`,marginRight:`${a}px`}}}),[L]),_=()=>{E&&w(),j&&(window.localStorage.setItem(j?.shortName,l),S(void 0),k.current?.close(),y(0),B(void 0))};return e(p,{children:e(d,{"data-testid":"tutorial-dialog",ref:k,style:N??void 0,children:t(u,{children:[H,e(f,{steps:j?.steps??[],currentStep:x}),t(g,{children:[e(n,{variant:"ghost",onClick:()=>{_()},children:"Skip"}),t(T,{children:[x&&0!==x?e(n,{variant:"ghost",onClick:()=>{y((t=>t-1))},children:"Previous"}):null,e(n,{variant:"outlined",onClick:()=>{C?_():y((t=>t+1))},children:C?"Done":"Next"})]})]})]})})})};export{P as default};
1
+ import{jsxs as t,Fragment as r,jsx as i}from"react/jsx-runtime";import{useMemo as e}from"react";import{Button as o}from"@equinor/eds-core-react";import{DIALOG_EDGE_MARGIN as a,TUTORIAL_LOCALSTORAGE_VALUE_STRING as n}from"./TutorialProvider.const.js";import{useGetTutorialSasToken as s,useTutorial as l}from"./TutorialProvider.hooks.js";import{DialogTypography as m,DialogImage as c,DialogWrapper as p,StyledTutorialDialog as d,DialogContent as u,DialogActions as g,NavigateSteps as h}from"./TutorialProvider.styles.js";import{getBestPositionWithoutOverlap as T}from"./TutorialProvider.utils.js";import f from"./TutorialStepIndicator.js";import"../../api/core/OpenAPI.js";import"../../api/models/ApplicationCategory.js";import"../../api/models/ServiceNowUrgency.js";import{TutorialPosition as v}from"../../api/models/TutorialPosition.js";const y=()=>{const{data:y}=s(),{activeTutorial:P,currentStep:j,setCurrentStep:x,setActiveTutorial:S,dialogRef:k,allElementsToHighlight:O,customStepComponents:$,isLastStep:C,currentStepObject:R,setAllElementsToHighlight:B,shortNameFromParams:E,viewportWidth:I,clearSearchParam:_}=l(),w=e((()=>{if(R)return R.key&&$?$.find((t=>t.key===R.key))?.element:void 0===R.key||null===R.key?t(r,{children:[i(m,{variant:"h5",children:R.title}),i(m,{group:"paragraph",variant:"body_short",children:R.body}),R.imgUrl&&y&&i(c,{"data-testid":"tutorial-image",alt:"tutorial-image",src:`${R.imgUrl}?${y}`})]}):void 0}),[R,$,y]),H=e((()=>{if(P&&I&&O&&k.current)return P.steps[j].position?P.steps[j].position:P.dynamicPositioning?T(O[j].getBoundingClientRect(),k.current.getBoundingClientRect()):v.BOTTOM_RIGHT}),[P,I,O,k,j]),L=e((()=>{if(H&&H!==v.CENTER)switch(H){case v.TOP_LEFT:return{marginTop:`${a}px`,marginLeft:`${a}px`};case v.TOP_RIGHT:return{marginTop:`${a}px`,marginRight:`${a}px`};case v.BOTTOM_LEFT:return{marginBottom:`${a}px`,marginLeft:`${a}px`};case v.BOTTOM_RIGHT:default:return{marginBottom:`${a}px`,marginRight:`${a}px`}}}),[H]),N=()=>{E&&_(),P&&(window.localStorage.setItem(P?.shortName,n),S(void 0),k.current?.close(),x(0),B(void 0))};return i(p,{children:i(d,{"data-testid":"tutorial-dialog",ref:k,style:L??void 0,children:t(u,{children:[w,i(f,{steps:P?.steps??[],currentStep:j}),t(g,{children:[i(o,{variant:"ghost",onClick:()=>{N()},children:"Skip"}),t(h,{children:[j&&0!==j?i(o,{variant:"ghost",onClick:()=>{x((t=>t-1))},children:"Previous"}):null,i(o,{variant:"outlined",onClick:()=>{C?N():x((t=>t+1))},children:C?"Done":"Next"})]})]})]})})})};export{y as default};
@@ -2,6 +2,9 @@ export declare const Highlighter: import("styled-components/dist/types").IStyled
2
2
  export declare const DialogWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
3
  export declare const StyledTutorialDialog: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>, never>> & string;
4
4
  export declare const DialogContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
+ export declare const DialogTypography: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<({
6
+ as?: import("react").ElementType | undefined;
7
+ } & (import("@equinor/eds-core-react").TypographyProps & Omit<any, "token" | "id" | "children" | "bold" | "link" | "group" | "style" | "slot" | "title" | "suppressHydrationWarning" | "className" | "color" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "nonce" | "spellCheck" | "translate" | "radioGroup" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "variant" | "italic" | "lines">)) & import("styled-components/dist/types").BaseObject, import("styled-components/dist/types").BaseObject>> & string & Omit<import("@equinor/eds-utils").OverridableComponent<import("@equinor/eds-core-react").TypographyProps, HTMLElement>, keyof import("react").Component<any, {}, any>>;
5
8
  export declare const DialogImage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never>> & string;
6
9
  export declare const DialogActions: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
10
  export declare const NavigateSteps: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -1,35 +1,35 @@
1
- import{Dialog as o}from"@equinor/eds-core-react";import{tokens as i}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import t,{keyframes as e}from"styled-components";const{elevation:a,shape:n,spacings:r}=i,d=e`
1
+ import{Typography as o,Dialog as i}from"@equinor/eds-core-react";import{tokens as t}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import e,{keyframes as a}from"styled-components";const{elevation:n,shape:r,spacings:d}=t,s=a`
2
2
  from {
3
3
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0);
4
4
  }
5
5
  to {
6
6
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
7
7
  }
8
- `,s=t.div`
8
+ `,m=e.div`
9
9
  position: absolute;
10
10
  z-index: 10000;
11
11
  pointer-events: none;
12
12
  transition: top, left, width, height;
13
13
  transition-duration: 300ms;
14
14
  border-radius: 4px;
15
- animation: ${d} 300ms;
15
+ animation: ${s} 300ms;
16
16
  animation-fill-mode: forwards;
17
- `,m=t.div`
17
+ `,p=e.div`
18
18
  position: absolute;
19
19
  right: 24px;
20
20
  bottom: 24px;
21
21
  background: transparent;
22
- `,l=e`
22
+ `,l=a`
23
23
  from {
24
24
  opacity: 0;
25
25
  }
26
26
  to {
27
27
  opacity: 1;
28
28
  }
29
- `,p=t.dialog`
29
+ `,c=e.dialog`
30
30
  border: none;
31
- box-shadow: ${a.above_scrim};
32
- border-radius: ${n.corners.borderRadius};
31
+ box-shadow: ${n.above_scrim};
32
+ border-radius: ${r.corners.borderRadius};
33
33
  transition: all;
34
34
  transition-duration: 300ms;
35
35
  animation: ${l} 300ms;
@@ -37,29 +37,32 @@ import{Dialog as o}from"@equinor/eds-core-react";import{tokens as i}from"../../n
37
37
  &::backdrop {
38
38
  background: transparent;
39
39
  }
40
- `,c=t.div`
40
+ `,f=e.div`
41
41
  display: flex;
42
42
  flex-direction: column;
43
- gap: ${r.comfortable.large};
43
+ gap: ${d.comfortable.large};
44
+ width: fit-content;
45
+ `,x=e(o)`
44
46
  width: 300px;
45
- `,f=t.img`
47
+ `,b=e.img`
46
48
  max-height: 300px;
47
49
  min-height: 50px;
50
+ max-width: 300px;
48
51
  object-fit: contain;
49
- `,b=t.div`
52
+ `,g=e.div`
50
53
  display: flex;
51
54
  justify-content: space-between;
52
- `,x=t.div`
55
+ `,h=e.div`
53
56
  display: flex;
54
- gap: ${r.comfortable.medium};
55
- `,g=t(o)`
57
+ gap: ${d.comfortable.medium};
58
+ `,u=e(i)`
56
59
  width: 300px;
57
60
  height: fit-content;
58
61
  display: flex;
59
62
  flex-direction: column;
60
- padding: ${r.comfortable.medium};
61
- gap: ${r.comfortable.large};
63
+ padding: ${d.comfortable.medium};
64
+ gap: ${d.comfortable.large};
62
65
  button {
63
66
  align-self: flex-end;
64
67
  }
65
- `;export{b as DialogActions,c as DialogContent,f as DialogImage,m as DialogWrapper,s as Highlighter,x as NavigateSteps,p as StyledTutorialDialog,g as TutorialErrorDialog};
68
+ `;export{g as DialogActions,f as DialogContent,b as DialogImage,x as DialogTypography,p as DialogWrapper,m as Highlighter,h as NavigateSteps,c as StyledTutorialDialog,u as TutorialErrorDialog};
@@ -1 +1 @@
1
- import{jsxs as t,jsx as r,Fragment as o}from"react/jsx-runtime";import{useRef as e,useMemo as i,useCallback as n,useEffect as l}from"react";import{useLocation as a}from"react-router";import{Typography as s,Button as h}from"@equinor/eds-core-react";import m from"./TutorialDialog.js";import{HIGHLIGHT_PADDING as p,TUTORIAL_HIGHLIGHTER_DATATEST_ID as c}from"./TutorialProvider.const.js";import{useTutorial as u,useGetTutorialsForApp as d}from"./TutorialProvider.hooks.js";import{TutorialErrorDialog as f,Highlighter as g}from"./TutorialProvider.styles.js";import{EnvironmentType as w}from"../../types/Environment.js";const v=()=>{const{pathname:v}=a(),{activeTutorial:T,setActiveTutorial:P,dialogRef:j,allElementsToHighlight:x,shortNameFromParams:N,tutorialError:b,tutorialsFromProps:C,currentStep:k,viewportWidth:E,setTutorialError:I,clearSearchParam:$,appName:y,environmentName:D}=u(),R=e(!1),{data:S}=d(y),B=i((()=>{if(!(S||C&&0!==C.length))return[];const t=[];return C&&t.push(...C),S&&t.push(...S),t}),[S,C]),F=i((()=>{if(!x||!T||!E)return;const t=x[k],r=t.getBoundingClientRect();return t&&t.scrollIntoView({behavior:"smooth",block:"center"}),{top:r.top-p+window.scrollY,left:r.left-p,height:r.height+2*p,width:r.width+2*p}}),[T,x,k,E]),O=i((()=>B.filter((t=>t.path===v))),[B,v]),U=n((t=>{R.current||(P(t),R.current=!0)}),[P]);l((()=>{F&&!j.current?.open&&j.current?.showModal()}),[j,F]),l((()=>{if(O.length<1)return;const t=O.find((t=>!window.localStorage.getItem(t.shortName)||N&&O.some((t=>t.shortName===N))));t&&U(t)}),[U,N,O]);const q=()=>{$(),I(!1),P(void 0)};return(T?.showInProd||D!==w.PRODUCTION)&&(T?.willPopUp||N)?b&&N?t(f,{open:!0,isDismissable:!0,onClose:q,children:[r(s,{children:"There was a problem starting this tutorial. Please report this in using the feedback function in the Top Bar."}),r(h,{variant:"outlined",onClick:q,children:"Close"})]}):b?null:t(o,{children:[F&&r(g,{"data-testid":c,style:{top:`${F.top}px`,left:`${F.left}px`,width:`${F.width}px`,height:`${F.height}px`}}),r(m,{})]}):null};export{v as default};
1
+ import{jsxs as t,jsx as r,Fragment as o}from"react/jsx-runtime";import{useRef as e,useMemo as i,useCallback as n,useEffect as l}from"react";import{useLocation as a}from"react-router";import{Typography as s,Button as h}from"@equinor/eds-core-react";import p from"./TutorialDialog.js";import{HIGHLIGHT_PADDING as m,TUTORIAL_HIGHLIGHTER_DATATEST_ID as c}from"./TutorialProvider.const.js";import{useTutorial as u,useGetTutorialsForApp as d}from"./TutorialProvider.hooks.js";import{TutorialErrorDialog as f,Highlighter as g}from"./TutorialProvider.styles.js";import{EnvironmentType as w}from"../../types/Environment.js";const v=()=>{const{pathname:v}=a(),{activeTutorial:P,setActiveTutorial:T,dialogRef:j,allElementsToHighlight:x,shortNameFromParams:N,tutorialError:b,tutorialsFromProps:C,currentStep:k,viewportWidth:E,setTutorialError:I,clearSearchParam:$,appName:y,environmentName:D}=u(),R=e(!1),{data:S}=d(y),U=i((()=>{if(!(S||C&&0!==C.length))return[];const t=[];return C&&t.push(...C),S&&t.push(...S),t}),[S,C]),B=i((()=>{if(!x||!P||!E)return;const t=x[k],r=t.getBoundingClientRect();return t&&t.scrollIntoView({behavior:"smooth",block:"center"}),{top:r.top-m+window.scrollY,left:r.left-m,height:r.height+2*m,width:r.width+2*m}}),[P,x,k,E]),F=i((()=>U.filter((t=>v.includes(t.path)))),[U,v]),O=n((t=>{R.current||(T(t),R.current=!0)}),[T]);l((()=>{B&&!j.current?.open&&j.current?.showModal()}),[j,B]),l((()=>{if(F.length<1)return;const t=F.find((t=>t.shortName===N)),r=F.find((t=>!window.localStorage.getItem(t.shortName)&&t.willPopUp));t?O(t):r&&O(r)}),[O,N,F]);const q=()=>{$(),I(!1),T(void 0)};return(P?.showInProd||D!==w.PRODUCTION)&&(P?.willPopUp||N)?b&&N?t(f,{open:!0,isDismissable:!0,onClose:q,children:[r(s,{children:"There was a problem starting this tutorial. Please report this in using the feedback function in the Top Bar."}),r(h,{variant:"outlined",onClick:q,children:"Close"})]}):b?null:t(o,{children:[B&&r(g,{"data-testid":c,style:{top:`${B.top}px`,left:`${B.left}px`,width:`${B.width}px`,height:`${B.height}px`}}),r(p,{})]}):null};export{v as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/subsurface-app-management",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "description": "React Typescript components/hooks to communicate with equinor/sam",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",