@equinor/amplify-component-lib 13.2.5-beta.1 → 13.2.6
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/atoms/hooks/useLocalStorage.d.ts +2 -2
- package/dist/atoms/hooks/useLocalStorage.js +1 -1
- package/dist/atoms/hooks/useSelect.d.ts +3 -3
- package/dist/atoms/index.d.ts +1 -1
- package/dist/atoms/index.js +1 -1
- package/dist/atoms/style/index.d.ts +1 -1
- package/dist/atoms/style/index.js +1 -1
- package/dist/atoms/utils/auth_environment.d.ts +0 -1
- package/dist/atoms/utils/auth_environment.js +1 -1
- package/dist/deprecated/ExpandingIconButton/ExpandingIconButton.d.ts +3 -3
- package/dist/deprecated/IconToggleButton.d.ts +3 -3
- package/dist/deprecated/OldStepper/OldStepLine.js +1 -1
- package/dist/deprecated/OldStepper/OldStepper.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/molecules/AnimatedCheckmark/AnimatedCheckmark.d.ts +1 -1
- package/dist/molecules/ApplicationIcon/ApplicationIcon.d.ts +1 -1
- package/dist/molecules/Badge/Badge.d.ts +1 -1
- package/dist/molecules/Button/Button.d.ts +2 -2
- package/dist/molecules/Button/Button.js +1 -1
- package/dist/molecules/Button/IconButton/IconButton.d.ts +9 -3
- package/dist/molecules/Button/IconButton/IconButton.js +1 -1
- package/dist/molecules/Button/IconButton/IconButton.utils.js +1 -0
- package/dist/molecules/Button/types.d.ts +2 -2
- package/dist/molecules/Chip/Chip.d.ts +1 -1
- package/dist/molecules/Chip/Chip.styles.js +1 -1
- package/dist/molecules/Confetti/Confetti.types.d.ts +1 -1
- package/dist/molecules/Confetti/utils/seasonalColors.js +1 -1
- package/dist/molecules/DatePicker/DatePicker.d.ts +3 -3
- package/dist/molecules/DateRangePicker/DateRangePicker.d.ts +3 -3
- package/dist/molecules/Dialog/Dialog.d.ts +2 -2
- package/dist/molecules/EquinorLogo/EquinorLogo.d.ts +2 -2
- package/dist/molecules/FileProgress/CompactFileProgress.js +1 -1
- package/dist/molecules/FileProgress/FileProgress.types.d.ts +1 -1
- package/dist/molecules/IconCell/IconCell.d.ts +3 -3
- package/dist/molecules/IconCell/IconCell.styles.js +3 -3
- package/dist/molecules/IconCell/IconCell.utils.js +1 -1
- package/dist/molecules/ListItem/ListItem.d.ts +2 -2
- package/dist/molecules/OptionDrawer/OptionDrawer.d.ts +3 -3
- package/dist/molecules/OptionalTooltip/OptionalTooltip.d.ts +4 -4
- package/dist/molecules/ProfileAvatar/ProfileAvatar.d.ts +2 -2
- package/dist/molecules/ProfileAvatar/ProfileAvatar.js +1 -1
- package/dist/molecules/RichTextEditor/MenuBar/MenuBar.d.ts +7 -7
- package/dist/molecules/RichTextEditor/custom-extensions/AmplifyKit.js +1 -1
- package/dist/molecules/RichTextEditor/index.d.ts +7 -7
- package/dist/molecules/RichTextEditor/index.js +1 -1
- package/dist/molecules/Search/Search.d.ts +2 -2
- package/dist/molecules/Select/ComboBox/ComboBox.d.ts +2 -2
- package/dist/molecules/Select/PersistentComboBox/PersistentComboBox.d.ts +2 -2
- package/dist/molecules/Select/Select.styles.d.ts +5 -5
- package/dist/molecules/Select/Select.styles.js +1 -1
- package/dist/molecules/Select/Select.types.d.ts +1 -1
- package/dist/molecules/Select/SelectMenuItem.utils.js +1 -1
- package/dist/molecules/Select/SingleSelect/SingleSelect.d.ts +2 -2
- package/dist/molecules/SelectionControls/Checkbox/Checkbox.d.ts +2 -2
- package/dist/molecules/SelectionControls/Switch/Switch.d.ts +2 -2
- package/dist/molecules/Skeleton/SkeletonBase/SkeletonBase.d.ts +4 -4
- package/dist/molecules/Stepper/Step/Step.js +1 -1
- package/dist/molecules/Stepper/StepLine.js +1 -1
- package/dist/molecules/Stepper/Stepper.js +1 -1
- package/dist/molecules/Tabs/Tabs.d.ts +2 -2
- package/dist/molecules/Waves/Waves.d.ts +1 -1
- package/dist/molecules/index.d.ts +1 -1
- package/dist/molecules/index.js +1 -1
- package/dist/organisms/DataGrid/DataGrid.d.ts +2 -2
- package/dist/organisms/Faq/Faq.d.ts +1 -1
- package/dist/organisms/Faq/Faq.utils.js +1 -1
- package/dist/organisms/FieldSelector/ChangingField.js +1 -1
- package/dist/organisms/Filter/AutoCompleteText.js +1 -1
- package/dist/organisms/Filter/Filter.d.ts +2 -2
- package/dist/organisms/Filter/Filter.types.d.ts +1 -1
- package/dist/organisms/Filter/QuickFilter.d.ts +2 -2
- package/dist/organisms/Filter/SortMenu.d.ts +2 -2
- package/dist/organisms/SideBar/MenuItem/CollapsableMenuItem.js +4 -1
- package/dist/organisms/SideBar/MenuItem/MenuItem.d.ts +1 -1
- package/dist/organisms/SideBar/SideBar.d.ts +2 -2
- package/dist/organisms/SideBar/index.d.ts +1 -1
- package/dist/organisms/Status/Action.d.ts +2 -2
- package/dist/organisms/Status/Description.d.ts +2 -2
- package/dist/organisms/Status/MissingAccesses.d.ts +2 -2
- package/dist/organisms/Status/Title.d.ts +2 -2
- package/dist/organisms/Status/collections/BadRequest.d.ts +2 -2
- package/dist/organisms/Status/collections/GenericError.d.ts +2 -2
- package/dist/organisms/Status/collections/MissingPermissions.d.ts +2 -2
- package/dist/organisms/Status/collections/PageNotFound.d.ts +2 -2
- package/dist/organisms/Status/collections/ServerError.d.ts +2 -2
- package/dist/organisms/Status/index.d.ts +1 -1
- package/dist/organisms/ToggleGroup/ToggleGroup.d.ts +2 -2
- package/dist/organisms/ToggleGroup/ToggleGroupOption.d.ts +2 -2
- package/dist/organisms/ToggleGroup/ToggleGroupOption.js +1 -1
- package/dist/organisms/TopBar/Account/Account.d.ts +1 -1
- package/dist/organisms/TopBar/Account/AccountButton.js +1 -1
- package/dist/organisms/TopBar/Actions.d.ts +2 -2
- package/dist/organisms/TopBar/FieldMenu/FieldMenu.d.ts +3 -3
- package/dist/organisms/TopBar/Guidelines/Colorbox.d.ts +2 -2
- package/dist/organisms/TopBar/Guidelines/Guidelines.d.ts +1 -1
- package/dist/organisms/TopBar/Notifications/NotificationProvider.d.ts +2 -2
- package/dist/organisms/TopBar/Notifications/NotificationsTemplate/Notifications.types.d.ts +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/Feedback.utils.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/LockedInputTooltip.js +2 -2
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/Severity.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/UploadFile/ImageFile.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/UploadFile/UploadFile.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/ResponsePage/ResponsePage.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/ResponsePage/ResponseStatus.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/ResponsePage/Success.js +1 -1
- package/dist/organisms/TopBar/Resources/Resources.d.ts +1 -1
- package/dist/organisms/TopBar/Tutorials/TutorialItem.js +1 -1
- package/dist/organisms/TopBar/index.d.ts +1 -1
- package/dist/organisms/index.d.ts +1 -1
- package/dist/organisms/index.js +1 -1
- package/dist/providers/AuthProvider/AuthProvider.d.ts +3 -26
- package/dist/providers/AuthProvider/AuthProvider.js +1 -1
- package/dist/providers/AuthProvider/AuthProviderInner.js +1 -1
- package/dist/providers/LoadingProvider.js +1 -1
- package/dist/providers/SnackbarProvider/SnackbarProvider.d.ts +1 -1
- package/dist/providers/StepperProvider.d.ts +1 -1
- package/dist/providers/StepperProvider.js +1 -1
- package/dist/providers/TableOfContentsProvider.d.ts +1 -1
- package/dist/providers/TutorialHighlightingProvider/TutorialHighlightingProviderInner.js +1 -1
- package/package.json +1 -1
|
@@ -6,4 +6,4 @@ import{spacings as e}from"../../../atoms/style/spacings.js";import{useAuth as t}
|
|
|
6
6
|
background: ${({$variant:e})=>s(e).chipBackground};
|
|
7
7
|
outline: none;
|
|
8
8
|
padding: 0;
|
|
9
|
-
`,h=l(({onClick:e,environmentToggle:n},s)=>{let{account:l,photo:u}=t(),{data:h}=i(),g=n.length>0,_=n.map(e=>o(e.value)),v=h?.roles?.sort()??[];return f(p,{children:[v.at(0)&&d(m,{$variant:`impersonate`,children:v[0]}),v.length>1&&d(m,{$variant:`impersonate`,children:`+${v.length-1}`}),g&&_.at(0)&&d(m,{$variant:`environment`,children:_[0]}),_.length>1&&d(m,{$variant:`environment`,children:`+${_.length-1}`}),d(a,{ref:s,onClick:e,children:g&&h?d(c,{size:36,variant:`combined`}):g?d(c,{size:36,name:n.map(e=>e.value).join(`, `),variant:`environment`}):h?d(c,{size:36,variant:`impersonate`}):d(r,{size:36,name:l?.name,url:u})})]})});h.displayName=`AccountButton`;export{h as AccountButton
|
|
9
|
+
`,h=l(({onClick:e,environmentToggle:n},s)=>{let{account:l,photo:u}=t(),{data:h}=i(),g=n.length>0,_=n.map(e=>o(e.value)),v=h?.roles?.sort()??[];return f(p,{children:[v.at(0)&&d(m,{$variant:`impersonate`,children:v[0]}),v.length>1&&d(m,{$variant:`impersonate`,children:`+${v.length-1}`}),g&&_.at(0)&&d(m,{$variant:`environment`,children:_[0]}),_.length>1&&d(m,{$variant:`environment`,children:`+${_.length-1}`}),d(a,{ref:s,onClick:e,children:g&&h?d(c,{size:36,variant:`combined`}):g?d(c,{size:36,name:n.map(e=>e.value).join(`, `),variant:`environment`}):h?d(c,{size:36,variant:`impersonate`}):d(r,{size:36,name:l?.name,url:u})})]})});h.displayName=`AccountButton`;export{h as AccountButton};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react214 from "react";
|
|
2
2
|
import { HTMLAttributes } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/organisms/TopBar/Actions.d.ts
|
|
5
|
-
declare const Actions:
|
|
5
|
+
declare const Actions: react214.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react214.RefAttributes<HTMLDivElement>>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Actions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Field } from "../../../atoms/types/Field.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react212 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/organisms/TopBar/FieldMenu/FieldMenu.d.ts
|
|
5
5
|
interface FieldMenuProps {
|
|
@@ -8,6 +8,6 @@ interface FieldMenuProps {
|
|
|
8
8
|
itemNameSingular?: string;
|
|
9
9
|
showAccessITLink?: boolean;
|
|
10
10
|
}
|
|
11
|
-
declare const FieldMenu:
|
|
11
|
+
declare const FieldMenu: react212.ForwardRefExoticComponent<FieldMenuProps & react212.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { FieldMenu
|
|
13
|
+
export { FieldMenu };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react237 from "react";
|
|
2
2
|
import * as styled_components61 from "styled-components";
|
|
3
3
|
import * as styled_components_dist_types46 from "styled-components/dist/types";
|
|
4
4
|
|
|
@@ -6,6 +6,6 @@ import * as styled_components_dist_types46 from "styled-components/dist/types";
|
|
|
6
6
|
interface ColorboxProps {
|
|
7
7
|
$color: string;
|
|
8
8
|
}
|
|
9
|
-
declare const Colorbox: styled_components_dist_types46.IStyledComponentBase<"web", styled_components61.FastOmit<styled_components61.FastOmit<
|
|
9
|
+
declare const Colorbox: styled_components_dist_types46.IStyledComponentBase<"web", styled_components61.FastOmit<styled_components61.FastOmit<react237.DetailedHTMLProps<react237.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$color"> & ColorboxProps, never> & Partial<Pick<styled_components61.FastOmit<react237.DetailedHTMLProps<react237.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$color"> & ColorboxProps, never>>> & string;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Colorbox };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react186 from "react";
|
|
2
2
|
import { Dispatch, FC, ReactNode, SetStateAction } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/organisms/TopBar/Notifications/NotificationProvider.d.ts
|
|
@@ -6,7 +6,7 @@ interface NotificationContext {
|
|
|
6
6
|
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
7
7
|
isOpen: boolean;
|
|
8
8
|
}
|
|
9
|
-
declare const NotificationContext:
|
|
9
|
+
declare const NotificationContext: react186.Context<NotificationContext | undefined>;
|
|
10
10
|
declare const useNotification: () => NotificationContext;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { useNotification };
|
|
@@ -83,4 +83,4 @@ type ExperienceReadyToPublishTypes = {
|
|
|
83
83
|
notificationType: NotificationsTypes.EXPERIENCE_READY_TO_PUBLISH;
|
|
84
84
|
} & NotificationDto;
|
|
85
85
|
//#endregion
|
|
86
|
-
export { DefaultNotificationTypes, Due3WeeksTypes, ExperienceReadyToPublishTypes, MergeBranchOrcaTypes,
|
|
86
|
+
export { DefaultNotificationTypes, Due3WeeksTypes, ExperienceReadyToPublishTypes, MergeBranchOrcaTypes, ReadyToReportNotificationTypes, RequestChangeOrcaTypes, RequestReviewOrcaTypes, ReviewQANotificationsTypes };
|
|
@@ -5,4 +5,4 @@ import"../../../../atoms/enums/Environment.js";import{environment as e}from"../.
|
|
|
5
5
|
${e.description} \n \n User agent string: ${navigator.userAgent}`},p=(e,t)=>{let n=t?`selfservice?id=ticket&table=incident&sys_id=`:`now/nav/ui/classic/params/target/incident.do%3Fsys_id%3D`;return`https://equinor${s(import.meta.env.VITE_ENVIRONMENT_NAME)===`production`?``:`test`}.service-now.com/${n}${e}`},m=()=>{if(navigator.userAgent.includes(`Edg`))return`Edge`;if(navigator.userAgent.includes(`Chrome`))return`Chrome`;if(navigator.userAgent.includes(`Safari`))return`Safari`;if(navigator.userAgent.includes(`Firefox`))return`Firefox`},h=e=>{let t=e;e===`Edge`&&(t=`Edg`);let n=RegExp(`${t}/(\\d+(?:\\.\\d+)+)`);return navigator.userAgent.match(n)?.[1]},g=()=>{let e=m();return e?`${e} (${h(e)})`:`Not found`},_=(e,r,i,s,l)=>{let u=i===a.BUG?`:bug: Bug report`:`:bulb: Suggestion`,f=[],m=[];m.push({type:`mrkdwn`,text:`*Title* \n ${e.title}`}),f.push({type:`mrkdwn`,text:` ${t(new Date,{format:`DD. month YYYY`})}`}),e.url&&f.push({type:`mrkdwn`,text:`*<${e.url}|Error URL>*`}),e.urgency&&m.push({type:`mrkdwn`,text:`*Severity* \n ${c(e)} ${d(e.urgency)}`});let h=[{type:`header`,text:{type:`plain_text`,text:u,emoji:!0}},{type:`section`,fields:f},{type:`section`,fields:m},{type:`section`,fields:[{type:`mrkdwn`,text:`*Application*
|
|
6
6
|
`+o(import.meta.env.VITE_NAME)},{type:`mrkdwn`,text:`*User* \n ${s}`}]},{type:`section`,fields:[{type:`mrkdwn`,text:`*Browser*
|
|
7
7
|
`+g()},{type:`mrkdwn`,text:`*Field* \n ${n(r??`Not found`)}`}]},{type:`section`,text:{type:`mrkdwn`,text:`*Description*
|
|
8
|
-
`+e.description}}];return l&&h.push({type:`section`,text:{type:`mrkdwn`,text:`*<${p(l)}|:link: Click to open the ticket in Service Now>*`}}),h.push({type:`divider`}),JSON.stringify(h)};export{f as createServiceNowDescription,p as createServiceNowUrl,_ as createSlackMessage,g as getBrowserInfo,u as getServiceNowUrgencyNumber,
|
|
8
|
+
`+e.description}}];return l&&h.push({type:`section`,text:{type:`mrkdwn`,text:`*<${p(l)}|:link: Click to open the ticket in Service Now>*`}}),h.push({type:`divider`}),JSON.stringify(h)};export{f as createServiceNowDescription,p as createServiceNowUrl,_ as createSlackMessage,g as getBrowserInfo,u as getServiceNowUrgencyNumber,d as getUrgencyDisplayText,l as readUploadedFileAsText};
|
|
@@ -2,6 +2,6 @@ import{OptionalTooltip as e}from"../../../../../molecules/OptionalTooltip/Option
|
|
|
2
2
|
white-space: break-spaces;
|
|
3
3
|
text-align: center;
|
|
4
4
|
width: 400px;
|
|
5
|
-
`,o=t(({show:e,children:t},r)=>{
|
|
5
|
+
`,o=t(({show:e,children:t},r)=>i(a,{title:n(()=>e?`The report was successfully submitted to ServiceNow.
|
|
6
6
|
This field is locked so you can retry sending it to the development team.
|
|
7
|
-
To reset the form, use the button in the bottom left corner.`:``,[e])
|
|
7
|
+
To reset the form, use the button in the bottom left corner.`:``,[e]),children:i(`div`,{ref:r,children:t})}));o.displayName=`LockedInputTooltip`;export{o as LockedInputTooltip};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{SingleSelect as e}from"../../../../../molecules/Select/SingleSelect/SingleSelect.js";import{SORTED_BUG_SEVERITY_OPTIONS as t}from"../Feedback.const.js";import{getUrgencyDisplayText as n}from"../Feedback.utils.js";import{useFeedbackContext as r}from"../hooks/useFeedbackContext.js";import{LockedInputTooltip as i}from"./LockedInputTooltip.js";import a from"styled-components";import{jsx as o}from"react/jsx-runtime";const s=a.div`
|
|
2
2
|
grid-column: 1/2;
|
|
3
|
-
`,c=t.map(e=>({value:e,label:n(e)})),l=()=>{let{serviceNowSuccess:t,feedbackContent:a,updateFeedback:l}=r()
|
|
3
|
+
`,c=t.map(e=>({value:e,label:n(e)})),l=()=>{let{serviceNowSuccess:t,feedbackContent:a,updateFeedback:l}=r();return o(s,{children:o(i,{show:t,children:o(e,{items:c,label:`Severity`,meta:`optional`,clearable:!0,disabled:t,value:a.urgency?{value:a.urgency,label:n(a.urgency)}:void 0,placeholder:`Select error impact`,onSelect:e=>{l(`urgency`,e?.value)}})})})};export{l as Severity};
|
|
@@ -4,4 +4,4 @@ import{tokens as e}from"../../../../../../node_modules/@equinor/eds-tokens/dist/
|
|
|
4
4
|
width: 82px;
|
|
5
5
|
height: 82px;
|
|
6
6
|
position: relative;
|
|
7
|
-
`,_=e=>{let[u,_]=c(``),{error:v,onDelete:y}=e,b=s(()=>{if(!v)return;let t=e.errors[0].code,n=e.errors[0].message;return t===`file-too-large`?n=n.replace(/(\d+ bytes)/,`1MB`):t===`file-invalid-type`&&(n=n.replace(/(\w+\/\w+,)/g,``).replaceAll(`,`,`, `)),`${e.errors[0].code} \n${n}`},[v,e]),x=s(()=>e.file.name,[v,e]),S=s(()=>v?e.errors.find(e=>e.code.includes(`invalid`))?`Invalid file type`:e.errors.find(e=>e.code.includes(`large`))?`Invalid file size`:`Error`:``,[v,e]);return o(()=>{v||(async e=>{
|
|
7
|
+
`,_=e=>{let[u,_]=c(``),{error:v,onDelete:y}=e,b=s(()=>{if(!v)return;let t=e.errors[0].code,n=e.errors[0].message;return t===`file-too-large`?n=n.replace(/(\d+ bytes)/,`1MB`):t===`file-invalid-type`&&(n=n.replace(/(\w+\/\w+,)/g,``).replaceAll(`,`,`, `)),`${e.errors[0].code} \n${n}`},[v,e]),x=s(()=>e.file.name,[v,e]),S=s(()=>v?e.errors.find(e=>e.code.includes(`invalid`))?`Invalid file type`:e.errors.find(e=>e.code.includes(`large`))?`Invalid file size`:`Error`:``,[v,e]);return o(()=>{v||(async e=>{_(await t(e))})(e.file)},[v,e]),f(g,{children:[d(r,{title:`${x}${v?`: `+b:``}`,children:v?f(a,{children:[d(l,{data:m,color:h.interactive.warning__text.rgba}),d(`div`,{children:S})]}):d(i,{children:d(`img`,{src:u,alt:`Uploaded file: ${x}`})})}),d(n,{"data-testid":`attachment-delete-button`,onClick:y,children:d(l,{color:h.text.static_icons__tertiary.rgba,data:p,size:24})})]})};export{_ as ImageFile};
|
|
@@ -2,4 +2,4 @@ import{FileUploadArea as e}from"../../../../../../molecules/FileUploadArea/FileU
|
|
|
2
2
|
grid-column: 1/3;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
|
-
`;function d(e,t){if(e.length===0||e.length===1)return e;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++)t(e[n],e[r])&&e.splice(n,1);return e}const f=()=>{let{feedbackAttachments:s,setFeedbackAttachments:f}=n(),[p,m]=o([]),h=(e,t)=>{if(e.length>=1){let t=e.filter(e=>!e.name.startsWith(`.`));new FileReader().readAsDataURL(e[0]);let n=[];s&&n.push(...s)
|
|
5
|
+
`;function d(e,t){if(e.length===0||e.length===1)return e;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++)t(e[n],e[r])&&e.splice(n,1);return e}const f=()=>{let{feedbackAttachments:s,setFeedbackAttachments:f}=n(),[p,m]=o([]),h=(e,t)=>{if(e.length>=1){let t=e.filter(e=>!e.name.startsWith(`.`));new FileReader().readAsDataURL(e[0]);let n=[];s&&n.push(...s),f(d([...t,...n],(e,t)=>e.name===t.name&&e.size===t.size))}m(t)},g=e=>{f(s?.filter(t=>t.name!==e.name&&t.size!==e.size)??[])},_=e=>{m(p?.filter(t=>t.file.name===e.file.name&&t.file.size!==e.file.size)??[])};return l(u,{children:[c(i,{group:`input`,variant:`label`,children:`Attachments (.jpg, .jpeg, .png) (max 1 MB)`}),l(r,{children:[c(e,{maxSize:t,onDrop:h,accept:{"image/jpeg":[`.jpeg`,`.jpg`],"image/png":[`.png`]},size:`small`}),s?.map(e=>c(a,{onDelete:()=>g(e),file:e},e.name+e.size)),p.map(e=>c(a,{...e,onDelete:()=>_(e),error:!0},e.file.name+e.file.size))]})]})};export{f as UploadFile};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{spacings as e}from"../../../../../atoms/style/spacings.js";import{useFeedbackContext as t}from"../hooks/useFeedbackContext.js";import{ContentWrapper as n}from"../Feedback.styles.js";import{AnimateChangeInHeight as r}from"./AnimateChangeInHeight.js";import
|
|
1
|
+
import{spacings as e}from"../../../../../atoms/style/spacings.js";import{useFeedbackContext as t}from"../hooks/useFeedbackContext.js";import{ContentWrapper as n}from"../Feedback.styles.js";import{AnimateChangeInHeight as r}from"./AnimateChangeInHeight.js";import i from"./ResponseStatus.js";import{Success as a}from"./Success.js";import{useEffect as o,useState as s}from"react";import{Button as c}from"@equinor/eds-core-react";import l from"styled-components";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{motion as f}from"motion/react";const p=l(f.div)`
|
|
2
2
|
display: flex;
|
|
3
3
|
gap: ${e.large};
|
|
4
4
|
height: auto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useFeedbackContext as e}from"../hooks/useFeedbackContext.js";import{RequestStatus as t}from"./RequestStatus.js";import{Fragment as n,jsx as r,jsxs as i}from"react/jsx-runtime";import{WorkItemType as a}from"@equinor/subsurface-app-management";const o=()=>{let{serviceNowRequestResponse:o,workItemRequestResponse:s,selectedType:c}=e();return i(n,{children:[c===a.BUG&&r(t,{title:`Service Now`,requestStatus:o}),r(t,{title:`Development team`,requestStatus:s})]})};export{o as
|
|
1
|
+
import{useFeedbackContext as e}from"../hooks/useFeedbackContext.js";import{RequestStatus as t}from"./RequestStatus.js";import{Fragment as n,jsx as r,jsxs as i}from"react/jsx-runtime";import{WorkItemType as a}from"@equinor/subsurface-app-management";const o=()=>{let{serviceNowRequestResponse:o,workItemRequestResponse:s,selectedType:c}=e();return i(n,{children:[c===a.BUG&&r(t,{title:`Service Now`,requestStatus:o}),r(t,{title:`Development team`,requestStatus:s})]})};export{o as default};
|
|
@@ -6,4 +6,4 @@ import{tokens as e}from"../../../../../node_modules/@equinor/eds-tokens/dist/esm
|
|
|
6
6
|
padding-left: ${t.large};
|
|
7
7
|
font-weight: 400;
|
|
8
8
|
font-size: 16px;
|
|
9
|
-
`,d=()=>{let{selectedType:e,serviceNowUrl:t}=n();return o(l,{children:[a(r,{variant:`h3`,children:`Thank you, we have received your ${e===s.BUG?`report!`:`suggestion!`}`}),e===s.BUG&&t.length>0&&a(u,{href:t,children:`See ticket in ServiceNow`})]})};export{
|
|
9
|
+
`,d=()=>{let{selectedType:e,serviceNowUrl:t}=n();return o(l,{children:[a(r,{variant:`h3`,children:`Thank you, we have received your ${e===s.BUG?`report!`:`suggestion!`}`}),e===s.BUG&&t.length>0&&a(u,{href:t,children:`See ticket in ServiceNow`})]})};export{d as Success};
|
|
@@ -18,4 +18,4 @@ import{animation as e}from"../../../atoms/style/animation.js";import{colors as t
|
|
|
18
18
|
&:hover {
|
|
19
19
|
background: ${t.interactive.primary__hover_alt.rgba};
|
|
20
20
|
}
|
|
21
|
-
`,f=({onTutorialStart:e,onClose:n,id:a,name:f})=>{let{startTutorial:p,seenTutorialIDs:m}=u()
|
|
21
|
+
`,f=({onTutorialStart:e,onClose:n,id:a,name:f})=>{let{startTutorial:p,seenTutorialIDs:m}=u();return s(d,{onClick:()=>{p(a),e?.(a),n()},children:[m.includes(a)&&s(`header`,{children:[o(r,{data:c,size:16,color:t.interactive.primary__resting.rgba}),o(i,{varinat:`caption`,children:`COMPLETED`})]}),o(i,{variant:`h4`,children:f}),o(r,{data:l,color:t.interactive.primary__resting.rgba})]})};export{f as TutorialItem};
|
|
@@ -24,4 +24,4 @@ import { Faq } from "./Faq/Faq.js";
|
|
|
24
24
|
import { ReleaseNotesPage } from "./ReleaseNotesPage/ReleaseNotesPage.js";
|
|
25
25
|
import { Card as Card$1, CardProps } from "@equinor/eds-core-react";
|
|
26
26
|
import { EdsDataGridProps as DataGridProps } from "@equinor/eds-data-grid-react";
|
|
27
|
-
export {
|
|
27
|
+
export { Card$1 as Card, type CardProps, type DataGridProps };
|
package/dist/organisms/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"./Status/index.js";import"./Status/collections/MissingAccessToApp.js";import"./DataGrid/DataGrid.js";import"./Template/Template.js";import"./FieldSelector/FieldSelector.js";import"./Filter/index.js";import"./SideBar/index.js";import"./ReleaseNote/ReleaseNote.js";import"./TopBar/index.js";import"./Status/collections/BadRequest.js";import"./Status/collections/GenericError.js";import"./Status/collections/MissingPermissions.js";import"./Status/collections/PageNotFound.js";import"./Status/collections/ServerError.js";import"./Status/collections/ApiResponseError.js";import"./SideSheet/SideSheet.js";import"./TableOfContents/TableOfContents.js";import"./PageTitle/PageTitle.js";import"./ToggleGroup/index.js";import"./Faq/Faq.js";import"./ReleaseNotesPage/ReleaseNotesPage.js";import{Card as e}from"@equinor/eds-core-react";export{e as Card};
|
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
import { FC, ReactElement, ReactNode } from "react";
|
|
2
|
-
import { AccountInfo
|
|
2
|
+
import { AccountInfo } from "@azure/msal-browser";
|
|
3
3
|
|
|
4
4
|
//#region src/providers/AuthProvider/AuthProvider.d.ts
|
|
5
|
-
type AuthState = 'loading' | 'authorized' | 'unauthorized'
|
|
5
|
+
type AuthState = 'loading' | 'authorized' | 'unauthorized';
|
|
6
6
|
interface AuthContextType {
|
|
7
7
|
account: AccountInfo | undefined;
|
|
8
8
|
photo: string | undefined;
|
|
9
9
|
roles: string[] | undefined;
|
|
10
10
|
logout: () => void;
|
|
11
11
|
authState: AuthState;
|
|
12
|
-
/**
|
|
13
|
-
* Trigger an interactive popup login. Useful when silent auth cannot
|
|
14
|
-
* complete (e.g. embedded in an iframe where third-party cookies are
|
|
15
|
-
* blocked). On success the context transitions to `authorized` in place,
|
|
16
|
-
* with roles populated, without requiring a page reload.
|
|
17
|
-
*/
|
|
18
|
-
login: () => Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* Acquire a token interactively (popup) for the given scopes, falling back
|
|
21
|
-
* to the configured API scope when none are provided.
|
|
22
|
-
*/
|
|
23
|
-
acquireToken: (scopes?: string[]) => Promise<AuthenticationResult | null>;
|
|
24
12
|
}
|
|
25
13
|
declare const useAuth: () => AuthContextType;
|
|
26
14
|
interface AuthProviderProps {
|
|
@@ -29,13 +17,6 @@ interface AuthProviderProps {
|
|
|
29
17
|
unauthorizedComponent?: ReactElement;
|
|
30
18
|
withoutLoader?: boolean;
|
|
31
19
|
withoutBackend?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Redirect URI used only for interactive popups (`login`, `acquireToken`).
|
|
34
|
-
* Point this at a minimal blank page (served by the app and registered as a
|
|
35
|
-
* SPA redirect URI in Azure AD) so the sign-in popup resolves without booting
|
|
36
|
-
* the full app. Falls back to `window.location.origin` when omitted.
|
|
37
|
-
*/
|
|
38
|
-
popupRedirectUri?: string;
|
|
39
20
|
}
|
|
40
21
|
/**
|
|
41
22
|
* @param children - ReactNode
|
|
@@ -43,11 +24,7 @@ interface AuthProviderProps {
|
|
|
43
24
|
* @param unauthorizedComponent - Component to show if user is unauthorized
|
|
44
25
|
* @param withoutLoader - Hide loader from AuthProvider
|
|
45
26
|
* @param withoutBackend - Will not attempt to get roles from backend
|
|
46
|
-
* @param popupRedirectUri - Redirect URI used only for interactive popups
|
|
47
|
-
* (`login`, `acquireToken`). Point this at a minimal blank page so the
|
|
48
|
-
* sign-in popup resolves without booting the full app. Falls back to
|
|
49
|
-
* `window.location.origin` when omitted.
|
|
50
27
|
*/
|
|
51
28
|
declare const AuthProvider: FC<AuthProviderProps>;
|
|
52
29
|
//#endregion
|
|
53
|
-
export {
|
|
30
|
+
export { AuthProvider, useAuth };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{auth as e,environment as t}from"../../atoms/utils/auth_environment.js";import{AuthProviderInner as n}from"./AuthProviderInner.js";import{createContext as r,useContext as i,useMemo as a,useState as o}from"react";import{MsalProvider as s}from"@azure/msal-react";import{jsx as c}from"react/jsx-runtime";
|
|
1
|
+
import{auth as e,environment as t}from"../../atoms/utils/auth_environment.js";import{AuthProviderInner as n}from"./AuthProviderInner.js";import{createContext as r,useContext as i,useMemo as a,useState as o}from"react";import{MsalProvider as s}from"@azure/msal-react";import{jsx as c}from"react/jsx-runtime";const{msalApp:l}=e,{getIsMock:u,getMockUserPhoto:d,getMockRoles:f}=t,p=r(void 0),m=()=>{let e=i(p);if(e===void 0)throw Error(`useAuth must be used within a AuthContext provider`);return e},h={homeAccountId:`mock-home-account-id`,environment:`mock`,tenantId:`mock-tenant-id`,username:`MOCK@equinor.com`,localAccountId:`mock-local-account-id`,name:`Mock mocksnes`,idToken:`fake`,idTokenClaims:{id:`claim`},nativeAccountId:`accountid`,authorityType:`authority`,tenantProfiles:new Map},g=({children:e,loadingComponent:t,unauthorizedComponent:r,withoutLoader:i=!1,withoutBackend:m=!1})=>{let[g,_]=o(void 0),[v,y]=o(),[b,x]=o(`loading`),[S,C]=o(),w=a(()=>u(import.meta.env.VITE_IS_MOCK),[]),T=a(()=>d(import.meta.env.VITE_MOCK_USER_PHOTO),[]),E=a(()=>f(import.meta.env.VITE_MOCK_ROLES),[]);return w?(b===`loading`&&setTimeout(()=>{x(`authorized`)},1e3),c(p.Provider,{value:{roles:E,account:h,photo:T,logout:()=>console.log(`Logged out the user!`),authState:b},children:e})):c(p.Provider,{value:{roles:v,account:g,photo:S,logout:()=>l.logoutRedirect(),authState:b},children:c(s,{instance:l,children:c(n,{loadingComponent:t,unauthorizedComponent:r,account:g,setAccount:_,setRoles:y,setPhoto:C,authState:b,setAuthState:x,withoutLoader:i,withoutBackend:m,children:e})})})};export{g as AuthProvider,m as useAuth};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{auth as e,environment as t}from"../../atoms/utils/auth_environment.js";import{FullPageSpinner as n}from"../../molecules/FullPageSpinner/FullPageSpinner.js";import{MissingAccessToApp as r}from"../../organisms/Status/collections/MissingAccessToApp.js";import{useEffect as i,useRef as a,useState as o}from"react";import{useMsal as s,useMsalAuthentication as c}from"@azure/msal-react";import{BrowserAuthError as l,BrowserAuthErrorCodes as u,InteractionRequiredAuthError as d,InteractionType as f}from"@azure/msal-browser";import{jsx as p}from"react/jsx-runtime";import{jwtDecode as m}from"jwt-decode";const{GRAPH_ENDPOINTS:h,GRAPH_REQUESTS_LOGIN:g,GRAPH_REQUESTS_PHOTO:_,GRAPH_REQUESTS_BACKEND:v,fetchMsGraph:y,isInIframe:b}=e,{getApiScope:x}=t,S=({children:e,account:t,setAccount:S,setPhoto:C,setRoles:w,authState:T,setAuthState:E,withoutLoader:D,loadingComponent:O,unauthorizedComponent:k,withoutBackend:A})=>{let{instance:j,accounts:M,inProgress:N}=s(),{login:P,result:F,error:I,acquireToken:L}=c(f.Silent,g),[R,z]=o(!1),B=a(!1);return i(()=>{R||(async()=>{console.log(`[AuthProvider] Initializing`),await j.initialize(),console.log(`[AuthProvider] Finished initializing`),z(!0)})().catch(e=>{console.error(`[AuthProvider] Error during initialization`,e)})},[j,R]),i(()=>{R&&(I instanceof d&&!b()&&T!==`unauthorized`?(console.error(I),console.log(`[AuthProvider] No account found, need to login via. redirect`),P(f.Redirect,g).catch(e=>{console.error(`[AuthProvider] Error during login`,e)})):
|
|
1
|
+
import{auth as e,environment as t}from"../../atoms/utils/auth_environment.js";import{FullPageSpinner as n}from"../../molecules/FullPageSpinner/FullPageSpinner.js";import{MissingAccessToApp as r}from"../../organisms/Status/collections/MissingAccessToApp.js";import{useEffect as i,useRef as a,useState as o}from"react";import{useMsal as s,useMsalAuthentication as c}from"@azure/msal-react";import{BrowserAuthError as l,BrowserAuthErrorCodes as u,InteractionRequiredAuthError as d,InteractionType as f}from"@azure/msal-browser";import{jsx as p}from"react/jsx-runtime";import{jwtDecode as m}from"jwt-decode";const{GRAPH_ENDPOINTS:h,GRAPH_REQUESTS_LOGIN:g,GRAPH_REQUESTS_PHOTO:_,GRAPH_REQUESTS_BACKEND:v,fetchMsGraph:y,isInIframe:b}=e,{getApiScope:x}=t,S=({children:e,account:t,setAccount:S,setPhoto:C,setRoles:w,authState:T,setAuthState:E,withoutLoader:D,loadingComponent:O,unauthorizedComponent:k,withoutBackend:A})=>{let{instance:j,accounts:M,inProgress:N}=s(),{login:P,result:F,error:I,acquireToken:L}=c(f.Silent,g),[R,z]=o(!1),B=a(!1);return i(()=>{R||(async()=>{console.log(`[AuthProvider] Initializing`),await j.initialize(),console.log(`[AuthProvider] Finished initializing`),z(!0)})().catch(e=>{console.error(`[AuthProvider] Error during initialization`,e)})},[j,R]),i(()=>{R&&(I instanceof d&&!b()&&T!==`unauthorized`?(console.error(I),console.log(`[AuthProvider] No account found, need to login via. redirect`),P(f.Redirect,g).catch(e=>{console.error(`[AuthProvider] Error during login`,e)})):F?.account&&!t?(console.log(`[AuthProvider] Found account in useMsalAuth result, setting that one as active`),j.setActiveAccount(F.account),S(F.account)):M.length>0&&!t?(console.log(`[AuthProvider] Found account in accounts array, setting that one as active`),j.setActiveAccount(M[0]),S(M[0])):I instanceof l&&I.errorCode===u.monitorWindowTimeout?(console.error(I),console.log(`[AuthProvider] Trying to login again via. redirect due to monitor window timeout`),P(f.Redirect,g).catch(e=>{console.error(`[AuthProvider] Error during login`,e)})):I&&console.error(`[AuthProvider] Unexpected error:`,I))},[t,M,I,j,R,P,F,S,T]),i(()=>{if(!t||!R||B.current||N!==`none`)return;B.current=!0;let e=async()=>{try{let e=await L(f.Silent,_);if(e){let t=await y(h.PHOTO,e.accessToken);if(t.status===404)return null;let n=await t.blob();C((window.URL??window.webkitURL).createObjectURL(n))}}catch(e){console.error(e)}},n=async()=>{try{let e=await L(f.Silent,v(x(import.meta.env.VITE_API_SCOPE)));if(console.log(`[AuthProvider] Successfully acquired token`),e&&e.accessToken){console.log(`[AuthProvider] Decoding token`);let t=m(e.accessToken);if(console.log(`[AuthProvider] Token was valid`),t.roles)console.log(`[AuthProvider] Found roles`),w(t.roles);else throw Error(`Could not find roles in token`);E(`authorized`)}}catch(e){console.error(`[AuthProvider] Token error when trying to get roles!`,e),E(`unauthorized`)}};(async()=>{await e(),A?E(`authorized`):await n()})()},[t,L,I,R,N,E,C,w,A]),T===`unauthorized`?k??p(r,{}):D?e:T===`loading`||t===void 0?O??p(n,{variant:`application`}):e};export{S as AuthProviderInner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FullPageSpinner as e}from"../molecules/FullPageSpinner/FullPageSpinner.js";import{useAuth as t}from"./AuthProvider/AuthProvider.js";import{useEffect as n,useState as r}from"react";import{jsx as i}from"react/jsx-runtime";import{SAM_QUERIES as a}from"@equinor/subsurface-app-management";import{useIsFetching as o}from"@tanstack/react-query";const s=({customQueryKeys:s=[],children:c})=>{let{authState:l}=t(),u=o({predicate:e=>a.some(t=>e.queryKey.includes(t))||s.some(t=>e.queryKey.includes(t))})>0,[d,f]=r(!0);return n(()=>{l===`authorized`&&!u&&d&&f(!1)},[l,u,d]),l===`
|
|
1
|
+
import{FullPageSpinner as e}from"../molecules/FullPageSpinner/FullPageSpinner.js";import{useAuth as t}from"./AuthProvider/AuthProvider.js";import{useEffect as n,useState as r}from"react";import{jsx as i}from"react/jsx-runtime";import{SAM_QUERIES as a}from"@equinor/subsurface-app-management";import{useIsFetching as o}from"@tanstack/react-query";const s=({customQueryKeys:s=[],children:c})=>{let{authState:l}=t(),u=o({predicate:e=>a.some(t=>e.queryKey.includes(t))||s.some(t=>e.queryKey.includes(t))})>0,[d,f]=r(!0);return n(()=>{l===`authorized`&&!u&&d&&f(!1)},[l,u,d]),l===`authorized`?d?i(e,{variant:`application`,fixedPosition:!0,children:c}):c:i(e,{variant:`application`,fixedPosition:!0})};export{s as LoadingProvider};
|
|
@@ -29,4 +29,4 @@ type SnackbarProviderProps = {
|
|
|
29
29
|
*/
|
|
30
30
|
declare const SnackbarProvider: FC<SnackbarProviderProps>;
|
|
31
31
|
//#endregion
|
|
32
|
-
export {
|
|
32
|
+
export { SnackbarProvider, useSnackbar };
|
|
@@ -56,4 +56,4 @@ interface StepperProviderWithoutSyncToURLParamProps extends StepperProviderProps
|
|
|
56
56
|
*/
|
|
57
57
|
declare const StepperProvider: FC<StepperProviderSyncedToURLParamProps | StepperProviderWithoutSyncToURLParamProps>;
|
|
58
58
|
//#endregion
|
|
59
|
-
export { StepperProvider,
|
|
59
|
+
export { StepperProvider, useStepper };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext as e,useCallback as t,useContext as n,useState as r}from"react";import{jsx as i}from"react/jsx-runtime";import{useLocation as a,useNavigate as o,useParams as s}from"@tanstack/react-router";const c=e(void 0);function l(){let e=n(c);if(!e)throw Error(`useStepper must be used within a StepperProvider`);return e}const u=({steps:e,children:n,isStepDisabled:l,...u})=>{let{step:d}=s({strict:!1}),f=o(),p=a().pathname.split(`/`).slice(0,-1).join(`/`),m=u.syncToURLParam?Number(d):u?.initialStep??0;if(u.syncToURLParam&&d&&isNaN(Number(d)))throw Error(`Step URL param must be a valid number when using "syncToURLParam"`);if(e.length<2)throw Error(`Stepper must have at least 2 steps`);let[h,g]=r(m),_=u.syncToURLParam?Number(d):h,[v,y]=r(0);if(m>=e.length||m<0)throw Error(`initialStep must be a valid index of the steps array`);let b=t=>{if(t===_)return;if(t>_){v!==0&&y(0);return}let n=e.at(t);if(n&&`subSteps`in n&&n.subSteps&&n.subSteps.length>0){y(n.subSteps.length-1);return}v!==0&&y(0)},x=e=>{b(e),u.syncToURLParam?f({to:`${p}/${e}`}):g(e)},S=()=>{if(`subSteps`in e[_]&&e[_].subSteps&&v<e[_].subSteps.length-1){y(e=>e+1);return}_!==e.length-1&&x(_+1)},C=()=>{if(v>0&&`subSteps`in e[_]&&e[_].subSteps&&e[_].subSteps.length>0){y(e=>e-1);return}_!==0&&x(_-1)},w=t(t=>l?l({step:e[t],stepIndex:t,currentStep:e[_],currentStepIndex:_}):!1,[l,_,e]);return i(c.Provider,{value:{steps:e,currentStep:_,currentSubStep:v,setCurrentStep:x,goToNextStep:S,goToPreviousStep:C,isStepAtIndexDisabled:w},children:n})};export{
|
|
1
|
+
import{createContext as e,useCallback as t,useContext as n,useState as r}from"react";import{jsx as i}from"react/jsx-runtime";import{useLocation as a,useNavigate as o,useParams as s}from"@tanstack/react-router";const c=e(void 0);function l(){let e=n(c);if(!e)throw Error(`useStepper must be used within a StepperProvider`);return e}const u=({steps:e,children:n,isStepDisabled:l,...u})=>{let{step:d}=s({strict:!1}),f=o(),p=a().pathname.split(`/`).slice(0,-1).join(`/`),m=u.syncToURLParam?Number(d):u?.initialStep??0;if(u.syncToURLParam&&d&&isNaN(Number(d)))throw Error(`Step URL param must be a valid number when using "syncToURLParam"`);if(e.length<2)throw Error(`Stepper must have at least 2 steps`);let[h,g]=r(m),_=u.syncToURLParam?Number(d):h,[v,y]=r(0);if(m>=e.length||m<0)throw Error(`initialStep must be a valid index of the steps array`);let b=t=>{if(t===_)return;if(t>_){v!==0&&y(0);return}let n=e.at(t);if(n&&`subSteps`in n&&n.subSteps&&n.subSteps.length>0){y(n.subSteps.length-1);return}v!==0&&y(0)},x=e=>{b(e),u.syncToURLParam?f({to:`${p}/${e}`}):g(e)},S=()=>{if(`subSteps`in e[_]&&e[_].subSteps&&v<e[_].subSteps.length-1){y(e=>e+1);return}_!==e.length-1&&x(_+1)},C=()=>{if(v>0&&`subSteps`in e[_]&&e[_].subSteps&&e[_].subSteps.length>0){y(e=>e-1);return}_!==0&&x(_-1)},w=t(t=>l?l({step:e[t],stepIndex:t,currentStep:e[_],currentStepIndex:_}):!1,[l,_,e]);return i(c.Provider,{value:{steps:e,currentStep:_,currentSubStep:v,setCurrentStep:x,goToNextStep:S,goToPreviousStep:C,isStepAtIndexDisabled:w},children:n})};export{u as StepperProvider,l as useStepper};
|
|
@@ -26,4 +26,4 @@ interface TableOfContentsProviderProps {
|
|
|
26
26
|
}
|
|
27
27
|
declare const TableOfContentsProvider: FC<TableOfContentsProviderProps>;
|
|
28
28
|
//#endregion
|
|
29
|
-
export { TableOfContentsItemType, TableOfContentsProvider,
|
|
29
|
+
export { TableOfContentsItemType, TableOfContentsProvider, useTableOfContents };
|
|
@@ -21,4 +21,4 @@ import{spacings as e}from"../../atoms/style/spacings.js";import{getHighlightElem
|
|
|
21
21
|
height: 100vh;
|
|
22
22
|
background: none;
|
|
23
23
|
pointer-events: none;
|
|
24
|
-
`,g=({children:e,contentRef:s})=>{let{activeTutorial:g,activeStep:_,unseenTutorialsOnThisPage:v}=f(),y=p()>0,b=n(s),[x,S]=o({width:window.innerWidth,height:window.innerHeight});a(()=>{let e=()=>{S({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let[C,w]=o([]);a(()=>{y||(async()=>{if(g&&_!==void 0){if(!g.steps[_].highlightElement)return w([]);let e=await t(g.id,_,x);return w(e?[e]:[])}
|
|
24
|
+
`,g=({children:e,contentRef:s})=>{let{activeTutorial:g,activeStep:_,unseenTutorialsOnThisPage:v}=f(),y=p()>0,b=n(s),[x,S]=o({width:window.innerWidth,height:window.innerHeight});a(()=>{let e=()=>{S({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let[C,w]=o([]);a(()=>{y||(async()=>{if(g&&_!==void 0){if(!g.steps[_].highlightElement)return w([]);let e=await t(g.id,_,x);return w(e?[e]:[])}return w((await Promise.all(v.map(e=>{if(e.steps.at(0)?.highlightElement)return t(e.id,0,x)}))).filter(e=>e!==void 0))})()},[_,g,y,v,x]);let T=g?[g]:v.filter(e=>e.steps[0].highlightElement&&C.some(e=>e.id)||!e.steps[0].highlightElement);return T.length>0?u(c,{children:[e,l(h,{children:T.map(e=>{let t=C.find(t=>t.id===e.id);return l(i,{isHighlighting:C.length>0,contentRef:s,...e,...t},e.id)})}),u(m,{children:[u(`mask`,{id:`tutorials-rectangles`,children:[l(`rect`,{width:`100%`,height:`100%`,fill:`white`}),l(d.g,{style:{translateY:b},children:C.map(e=>l(d.path,{"data-testid":`tutorial-mask-${e.id}`,initial:{opacity:0,d:`M ${e.left} ${e.top} h ${e.width} v ${e.height} h -${e.width} Z`},animate:{opacity:1,d:`M ${e.left} ${e.top} h ${e.width} v ${e.height} h -${e.width} Z`},fill:`black`},e.id))})]}),l(d.rect,{width:`100%`,height:`100%`,fill:`rgba(111, 111, 111, 0.35)`,mask:`url(#tutorials-rectangles)`,...r})]})]}):l(c,{children:e})};export{g as TutorialHighlightingProviderInner};
|