@equinor/amplify-component-lib 10.0.6 → 10.2.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.
Files changed (59) hide show
  1. package/dist/atoms/hooks/useLocalStorage.d.ts +2 -2
  2. package/dist/atoms/hooks/useSelect.d.ts +3 -3
  3. package/dist/atoms/hooks/useStatusNavigation.d.ts +19 -0
  4. package/dist/atoms/hooks/useStatusNavigation.js +1 -0
  5. package/dist/atoms/index.d.ts +1 -0
  6. package/dist/atoms/index.js +1 -1
  7. package/dist/atoms/style/colors.d.ts +3 -0
  8. package/dist/atoms/style/colors.js +1 -1
  9. package/dist/atoms/style/darkTokens.js +1 -0
  10. package/dist/atoms/style/lightTokens.js +1 -0
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.js +1 -1
  13. package/dist/molecules/Badge/Badge.styles.js +1 -1
  14. package/dist/molecules/Dialog/Dialog.d.ts +2 -2
  15. package/dist/molecules/EquinorLogo/EquinorLogo.d.ts +2 -2
  16. package/dist/molecules/IconCell/IconCell.d.ts +2 -2
  17. package/dist/molecules/ListItem/ListItem.d.ts +2 -2
  18. package/dist/molecules/OptionDrawer/OptionDrawer.d.ts +2 -2
  19. package/dist/molecules/OptionalTooltip/OptionalTooltip.d.ts +4 -4
  20. package/dist/molecules/ProfileAvatar/ProfileAvatar.d.ts +2 -2
  21. package/dist/molecules/RichTextEditor/MenuBar/MenuBar.d.ts +5 -5
  22. package/dist/molecules/Search/Search.d.ts +2 -2
  23. package/dist/molecules/Select/ComboBox/ComboBox.d.ts +2 -2
  24. package/dist/molecules/Select/Select.styles.d.ts +4 -4
  25. package/dist/molecules/Select/SingleSelect/SingleSelect.d.ts +2 -2
  26. package/dist/molecules/SelectionControls/Checkbox/Checkbox.d.ts +2 -2
  27. package/dist/molecules/SelectionControls/Radio/Radio.d.ts +2 -2
  28. package/dist/molecules/SelectionControls/Switch/Switch.d.ts +2 -2
  29. package/dist/molecules/Skeleton/SkeletonBase/SkeletonBase.d.ts +2 -2
  30. package/dist/organisms/Filter/Filter.d.ts +2 -2
  31. package/dist/organisms/Filter/QuickFilter.d.ts +2 -2
  32. package/dist/organisms/Filter/SortMenu.d.ts +2 -2
  33. package/dist/organisms/ReleaseNotesPage/ReleaseNotesPage.js +1 -1
  34. package/dist/organisms/SideBar/SideBar.d.ts +2 -2
  35. package/dist/organisms/Status/Action.d.ts +2 -2
  36. package/dist/organisms/Status/Description.d.ts +2 -2
  37. package/dist/organisms/Status/MissingAccesses.d.ts +2 -2
  38. package/dist/organisms/Status/Title.d.ts +2 -2
  39. package/dist/organisms/Status/collections/BadRequest.d.ts +13 -2
  40. package/dist/organisms/Status/collections/BadRequest.js +2 -2
  41. package/dist/organisms/Status/collections/GenericError.d.ts +15 -2
  42. package/dist/organisms/Status/collections/GenericError.js +1 -1
  43. package/dist/organisms/Status/collections/MissingPermissions.d.ts +15 -2
  44. package/dist/organisms/Status/collections/MissingPermissions.js +1 -1
  45. package/dist/organisms/Status/collections/PageNotFound.d.ts +13 -2
  46. package/dist/organisms/Status/collections/PageNotFound.js +1 -2
  47. package/dist/organisms/Status/collections/ServerError.d.ts +13 -2
  48. package/dist/organisms/Status/collections/ServerError.js +2 -2
  49. package/dist/organisms/TableOfContents/TableOfContents.constants.js +1 -1
  50. package/dist/organisms/TableOfContents/TableOfContents.d.ts +2 -3
  51. package/dist/organisms/TableOfContents/TableOfContents.js +1 -1
  52. package/dist/organisms/TableOfContents/TableOfContents.styles.js +56 -138
  53. package/dist/organisms/TableOfContents/TableOfContents.types.d.ts +2 -2
  54. package/dist/organisms/TableOfContents/TableOfContentsItem.js +1 -5
  55. package/dist/organisms/TopBar/Actions.d.ts +2 -2
  56. package/dist/organisms/TopBar/FieldMenu/FieldMenu.d.ts +2 -2
  57. package/dist/organisms/TopBar/Notifications/NotificationProvider.d.ts +2 -2
  58. package/dist/providers/AuthProvider/AuthProviderInner.js +1 -1
  59. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- import * as react125 from "react";
1
+ import * as react132 from "react";
2
2
 
3
3
  //#region src/organisms/Status/Action.d.ts
4
4
  interface ActionProps {
5
5
  onClick: () => void;
6
6
  buttonText?: string;
7
7
  }
8
- declare const Action: react125.ForwardRefExoticComponent<ActionProps & react125.RefAttributes<HTMLButtonElement>>;
8
+ declare const Action: react132.ForwardRefExoticComponent<ActionProps & react132.RefAttributes<HTMLButtonElement>>;
9
9
  //#endregion
10
10
  export { Action };
@@ -1,9 +1,9 @@
1
- import * as react127 from "react";
1
+ import * as react130 from "react";
2
2
 
3
3
  //#region src/organisms/Status/Description.d.ts
4
4
  interface DescriptionProps {
5
5
  text?: string;
6
6
  }
7
- declare const Description: react127.ForwardRefExoticComponent<DescriptionProps & react127.RefAttributes<HTMLHeadingElement>>;
7
+ declare const Description: react130.ForwardRefExoticComponent<DescriptionProps & react130.RefAttributes<HTMLHeadingElement>>;
8
8
  //#endregion
9
9
  export { Description };
@@ -1,4 +1,4 @@
1
- import * as react129 from "react";
1
+ import * as react134 from "react";
2
2
 
3
3
  //#region src/organisms/Status/MissingAccesses.d.ts
4
4
  interface AccessType {
@@ -9,6 +9,6 @@ interface MissingAccessesProps {
9
9
  accesses?: AccessType[];
10
10
  text?: string;
11
11
  }
12
- declare const MissingAccesses: react129.ForwardRefExoticComponent<MissingAccessesProps & react129.RefAttributes<HTMLDivElement>>;
12
+ declare const MissingAccesses: react134.ForwardRefExoticComponent<MissingAccessesProps & react134.RefAttributes<HTMLDivElement>>;
13
13
  //#endregion
14
14
  export { MissingAccesses };
@@ -1,9 +1,9 @@
1
- import * as react123 from "react";
1
+ import * as react128 from "react";
2
2
 
3
3
  //#region src/organisms/Status/Title.d.ts
4
4
  interface TitleProps {
5
5
  title?: string;
6
6
  }
7
- declare const Title: react123.ForwardRefExoticComponent<TitleProps & react123.RefAttributes<HTMLHeadingElement>>;
7
+ declare const Title: react128.ForwardRefExoticComponent<TitleProps & react128.RefAttributes<HTMLHeadingElement>>;
8
8
  //#endregion
9
9
  export { Title };
@@ -1,6 +1,17 @@
1
- import { FC } from "react";
1
+ import * as react_jsx_runtime10 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/organisms/Status/collections/BadRequest.d.ts
4
- declare const BadRequest: FC;
4
+ interface BadRequestProps {
5
+ description?: string;
6
+ redirectFallbackUrl?: string;
7
+ onBackClick?: () => void;
8
+ hideBackButton?: boolean;
9
+ }
10
+ declare const BadRequest: ({
11
+ description,
12
+ redirectFallbackUrl,
13
+ onBackClick,
14
+ hideBackButton
15
+ }: BadRequestProps) => react_jsx_runtime10.JSX.Element;
5
16
  //#endregion
6
17
  export { BadRequest };
@@ -1,3 +1,3 @@
1
- import{Status as e}from"../index.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useRouter as r}from"@tanstack/react-router";const i=()=>{let{history:i}=r();return n(e,{color:`#AB9067`,children:[t(e.Title,{title:`Bad request`}),t(e.Description,{text:`We encountered some confusion regarding your request.
1
+ import{Status as e}from"../index.js";import{useStatusNavigation as t}from"../../../atoms/hooks/useStatusNavigation.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";const i=({description:i=`We encountered some confusion regarding your request.
2
2
  Please try again later, or if the issue persists, kindly report
3
- it using the feedback form located in the top bar.`}),t(e.Action,{onClick:()=>{i.go(-1)}})]})};export{i as BadRequest};
3
+ it using the feedback form located in the top bar.`,redirectFallbackUrl:a,onBackClick:o,hideBackButton:s=!1})=>{let c=t({onBackClick:o,redirectFallbackUrl:a});return r(e,{color:`#AB9067`,children:[n(e.Title,{title:`Bad request`}),n(e.Description,{text:i}),!s&&n(e.Action,{onClick:c})]})};export{i as BadRequest};
@@ -1,6 +1,19 @@
1
- import { FC } from "react";
1
+ import * as react_jsx_runtime11 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/organisms/Status/collections/GenericError.d.ts
4
- declare const GenericError: FC;
4
+ interface GenericErrorProps {
5
+ title?: string;
6
+ description?: string;
7
+ redirectFallbackUrl?: string;
8
+ onBackClick?: () => void;
9
+ hideBackButton?: boolean;
10
+ }
11
+ declare const GenericError: ({
12
+ title,
13
+ description,
14
+ redirectFallbackUrl,
15
+ onBackClick,
16
+ hideBackButton
17
+ }: GenericErrorProps) => react_jsx_runtime11.JSX.Element;
5
18
  //#endregion
6
19
  export { GenericError };
@@ -1 +1 @@
1
- import{Status as e}from"../index.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useRouter as r}from"@tanstack/react-router";const i=()=>{let{history:i}=r();return n(e,{children:[t(e.Title,{}),t(e.Description,{}),t(e.Action,{onClick:()=>{i.go(-1)}})]})};export{i as GenericError};
1
+ import{Status as e}from"../index.js";import{useStatusNavigation as t}from"../../../atoms/hooks/useStatusNavigation.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";const i=({title:i,description:a,redirectFallbackUrl:o,onBackClick:s,hideBackButton:c=!1})=>{let l=t({onBackClick:s,redirectFallbackUrl:o});return r(e,{children:[n(e.Title,{title:i}),n(e.Description,{text:a}),!c&&n(e.Action,{onClick:l})]})};export{i as GenericError};
@@ -1,6 +1,19 @@
1
- import { FC } from "react";
1
+ import * as react_jsx_runtime8 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/organisms/Status/collections/MissingPermissions.d.ts
4
- declare const MissingPermissions: FC;
4
+ interface MissingPermissionsProps {
5
+ title?: string;
6
+ description?: string;
7
+ redirectFallbackUrl?: string;
8
+ onBackClick?: () => void;
9
+ hideBackButton?: boolean;
10
+ }
11
+ declare const MissingPermissions: ({
12
+ title,
13
+ description,
14
+ redirectFallbackUrl,
15
+ onBackClick,
16
+ hideBackButton
17
+ }: MissingPermissionsProps) => react_jsx_runtime8.JSX.Element;
5
18
  //#endregion
6
19
  export { MissingPermissions };
@@ -1 +1 @@
1
- import{Status as e}from"../index.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useRouter as r}from"@tanstack/react-router";const i=()=>{let{history:i}=r();return n(e,{children:[t(e.Title,{title:`It looks like you don't have permission to access this page.`}),t(e.Action,{onClick:()=>{i.go(-1)}})]})};export{i as MissingPermissions};
1
+ import{Status as e}from"../index.js";import{useStatusNavigation as t}from"../../../atoms/hooks/useStatusNavigation.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";const i=({title:i=`It looks like you don't have permission to access this page.`,description:a,redirectFallbackUrl:o,onBackClick:s,hideBackButton:c=!1})=>{let l=t({onBackClick:s,redirectFallbackUrl:o});return r(e,{children:[n(e.Title,{title:i}),a&&n(e.Description,{text:a}),!c&&n(e.Action,{onClick:l})]})};export{i as MissingPermissions};
@@ -1,6 +1,17 @@
1
- import { FC } from "react";
1
+ import * as react_jsx_runtime7 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/organisms/Status/collections/PageNotFound.d.ts
4
- declare const PageNotFound: FC;
4
+ interface PageNotFoundProps {
5
+ description?: string;
6
+ redirectFallbackUrl?: string;
7
+ onBackClick?: () => void;
8
+ hideBackButton?: boolean;
9
+ }
10
+ declare const PageNotFound: ({
11
+ description,
12
+ redirectFallbackUrl,
13
+ onBackClick,
14
+ hideBackButton
15
+ }: PageNotFoundProps) => react_jsx_runtime7.JSX.Element;
5
16
  //#endregion
6
17
  export { PageNotFound };
@@ -1,2 +1 @@
1
- import{Status as e}from"../index.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useRouter as r}from"@tanstack/react-router";const i=()=>{let{history:i}=r();return n(e,{center:!1,children:[t(e.Title,{title:`Page not found`}),t(e.Description,{text:`It looks like the page you're looking for has gone missing.
2
- Please check the URL and try again.`}),t(e.Action,{onClick:()=>{i.go(-1)}})]})};export{i as PageNotFound};
1
+ import{Status as e}from"../index.js";import{useStatusNavigation as t}from"../../../atoms/hooks/useStatusNavigation.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";const i=({description:i=`It looks like the page you're looking for has gone missing. Please check the URL and try again.`,redirectFallbackUrl:a,onBackClick:o,hideBackButton:s=!1})=>{let c=t({onBackClick:o,redirectFallbackUrl:a});return r(e,{center:!1,children:[n(e.Title,{title:`Page not found`}),n(e.Description,{text:i}),!s&&n(e.Action,{onClick:c})]})};export{i as PageNotFound};
@@ -1,6 +1,17 @@
1
- import { FC } from "react";
1
+ import * as react_jsx_runtime9 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/organisms/Status/collections/ServerError.d.ts
4
- declare const ServerError: FC;
4
+ interface ServerErrorProps {
5
+ description?: string;
6
+ redirectFallbackUrl?: string;
7
+ onBackClick?: () => void;
8
+ hideBackButton?: boolean;
9
+ }
10
+ declare const ServerError: ({
11
+ description,
12
+ redirectFallbackUrl,
13
+ onBackClick,
14
+ hideBackButton
15
+ }: ServerErrorProps) => react_jsx_runtime9.JSX.Element;
5
16
  //#endregion
6
17
  export { ServerError };
@@ -1,3 +1,3 @@
1
- import{Status as e}from"../index.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useRouter as r}from"@tanstack/react-router";const i=()=>{let{history:i}=r();return n(e,{color:`#C47E84`,children:[t(e.Title,{title:`Something is wrong on our servers`}),t(e.Description,{text:`Our server encountered an unexpected issue. Please try
1
+ import{Status as e}from"../index.js";import{useStatusNavigation as t}from"../../../atoms/hooks/useStatusNavigation.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";const i=({description:i=`Our server encountered an unexpected issue. Please try
2
2
  again shortly, or reach out via the feedback form if the problem
3
- continues.`}),t(e.Action,{onClick:()=>{i.go(-1)}})]})};export{i as ServerError};
3
+ continues.`,redirectFallbackUrl:a,onBackClick:o,hideBackButton:s=!1})=>{let c=t({onBackClick:o,redirectFallbackUrl:a});return r(e,{color:`#C47E84`,children:[n(e.Title,{title:`Something is wrong on our servers`}),n(e.Description,{text:i}),!s&&n(e.Action,{onClick:c})]})};export{i as ServerError};
@@ -1 +1 @@
1
- import{spacings as e}from"../../atoms/style/spacings.js";const t={buttons:`39px`,border:`34px`,borderHorizontal:`34px`},n={buttons:e.x_small,border:`0`,borderHorizontal:`0`};export{n as GAP,t as HEIGHT};
1
+ const e=`34px`;export{e as VERTICAL_ITEM_HEIGHT};
@@ -1,11 +1,10 @@
1
- import { TableOfContentsVariants } from "./TableOfContents.types.js";
1
+ import { TableOfContentsMode } from "./TableOfContents.types.js";
2
2
  import { FC } from "react";
3
3
 
4
4
  //#region src/organisms/TableOfContents/TableOfContents.d.ts
5
5
  interface TableOfContentsProps {
6
- variant?: TableOfContentsVariants;
6
+ mode?: TableOfContentsMode;
7
7
  onlyShowSelectedChildren?: boolean;
8
- isLink?: boolean;
9
8
  }
10
9
  declare const TableOfContents: FC<TableOfContentsProps>;
11
10
  //#endregion
@@ -1 +1 @@
1
- import{getValues as e}from"../../providers/TableOfContentsProvider.utils.js";import{useTableOfContents as t}from"../../providers/TableOfContentsProvider.js";import{BorderItemsContainer as n,BorderItemsHorizontalContainer as r,TableOfContentsContainer as i}from"./TableOfContents.styles.js";import{TableOfContentsItem as a}from"./TableOfContentsItem.js";import{useMemo as o}from"react";import{jsx as s}from"react/jsx-runtime";const c=({variant:c=`buttons`,onlyShowSelectedChildren:l=!0,isLink:u=!1})=>{let{items:d,selected:f}=t(),p=o(()=>{for(let[t,n]of d.entries()){let r=e([],n);if(n.value===f||f&&r.includes(f))return t}return-1},[d,f]);return c===`border`?s(i,{className:`page-menu`,$variant:c,layoutRoot:!0,"data-testid":`table-of-contents-container`,children:d.map((e,t)=>s(n,{"data-testid":`border-items-container-${e.value}`,$index:t,$activeIndex:p,"aria-selected":p===t,children:s(a,{variant:c,onlyShowSelectedChildren:l,isLink:u,...e})},e.value))}):c===`borderHorizontal`?s(i,{className:`page-menu`,$variant:c,layoutRoot:!0,"data-testid":`table-of-contents-container`,children:d.map((e,t)=>s(r,{$index:t,$activeIndex:p,"aria-selected":p===t,children:s(a,{variant:c,...e,onlyShowSelectedChildren:l,isLink:u})},e.value))}):s(i,{className:`page-menu`,$variant:c,layoutRoot:!0,children:d.map(e=>s(a,{variant:c,...e,onlyShowSelectedChildren:l,isLink:u},e.value))})};export{c as TableOfContents};
1
+ import{getValues as e}from"../../providers/TableOfContentsProvider.utils.js";import{useTableOfContents as t}from"../../providers/TableOfContentsProvider.js";import{Tabs as n}from"../../molecules/Tabs/Tabs.js";import{HorizontalItemsContainer as r,TableOfContentsContainer as i,VerticalItemsContainer as a}from"./TableOfContents.styles.js";import{TableOfContentsItem as o}from"./TableOfContentsItem.js";import{useMemo as s}from"react";import{jsx as c}from"react/jsx-runtime";const l=({mode:l=`vertical`,onlyShowSelectedChildren:u=!0})=>{let{items:d,selected:f,setSelected:p}=t(),m=s(()=>{for(let[t,n]of d.entries()){let r=e([],n);if(n.value===f||f&&r.includes(f))return t}return-1},[d,f]);return l===`horizontal`?c(r,{children:c(n,{selected:f,onChange:e=>{e&&p(e)},options:d})}):c(i,{className:`page-menu`,layoutRoot:!0,"data-testid":`table-of-contents-container`,children:d.map((e,t)=>c(a,{"data-testid":`border-items-container-${e.value}`,$index:t,$activeIndex:m,"aria-selected":m===t,children:c(o,{onlyShowSelectedChildren:u,...e})},e.value))})};export{l as TableOfContents};
@@ -1,10 +1,10 @@
1
- import{tokens as e}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import{animation as t}from"../../atoms/style/animation.js";import{spacings as n}from"../../atoms/style/spacings.js";import{HEIGHT as r}from"./TableOfContents.constants.js";import i,{css as a}from"styled-components";import{motion as o}from"framer-motion";import{Link as s}from"@tanstack/react-router";const{colors:c,shape:l}=e,u=i.button`
1
+ import{animation as e}from"../../atoms/style/animation.js";import{colors as t}from"../../atoms/style/colors.js";import{spacings as n}from"../../atoms/style/spacings.js";import{VERTICAL_ITEM_HEIGHT as r}from"./TableOfContents.constants.js";import i,{css as a}from"styled-components";import{motion as o}from"framer-motion";const s=i.button`
2
2
  &:hover {
3
- background: ${c.interactive.primary__hover_alt.rgba};
3
+ background: ${t.interactive.primary__hover_alt.rgba};
4
4
  }
5
5
  ${({$active:e})=>e?``:a`
6
6
  &:focus:not(:hover) {
7
- outline: 2px dashed ${c.interactive.focus.rgba};
7
+ outline: 2px dashed ${t.interactive.focus.rgba};
8
8
  outline-offset: -4px;
9
9
  }
10
10
  `}
@@ -13,10 +13,10 @@ import{tokens as e}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/ind
13
13
  grid-template-columns: auto 1fr;
14
14
  align-items: center;
15
15
  gap: ${n.small};
16
- color: ${c.text.static_icons__default.rgba};
16
+ color: ${t.text.static_icons__default.rgba};
17
17
  cursor: pointer;
18
18
  padding: 0 ${n.medium};
19
- height: ${({$variant:e})=>r[e]};
19
+ min-height: ${r};
20
20
  transition: background 200ms;
21
21
  > span {
22
22
  display: flex;
@@ -27,104 +27,46 @@ import{tokens as e}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/ind
27
27
  font-weight: 700;
28
28
  font-size: 14px;
29
29
  }
30
- ${({$variant:e,$active:t})=>{switch(e){case`buttons`:return a`
31
- border-radius: ${l.corners.borderRadius};
32
- background: ${t?c.interactive.primary__hover_alt.rgba:`none`};
33
- `;case`border`:return a`
34
- > span {
35
- font-weight: ${t?700:500};
36
- &:after {
37
- height: 0;
38
- display: block;
39
- content: attr(title);
40
- font-weight: 700;
41
- font-size: 14px;
42
- overflow: hidden;
43
- visibility: hidden;
44
- }
45
- }
46
- `}}}
30
+ ${({$active:e})=>a`
31
+ > span {
32
+ font-weight: ${e?700:500};
33
+ &:after {
34
+ height: 0;
35
+ display: block;
36
+ content: attr(title);
37
+ font-weight: 700;
38
+ font-size: 14px;
39
+ overflow: hidden;
40
+ visibility: hidden;
41
+ }
42
+ }
43
+ `}
47
44
  ${({$active:e})=>!e&&a`
48
45
  &:disabled {
49
- color: ${c.interactive.disabled__text.rgba};
46
+ color: ${t.interactive.disabled__text.rgba};
50
47
  cursor: not-allowed;
51
48
  }
52
49
  `}
53
- `,d=i(s)`
54
- text-decoration: none;
55
- &:focus,
56
- &:hover,
57
- &:active {
58
- text-decoration: none;
59
- color: ${c.text.static_icons__default.rgba};
60
- }
61
- &:hover {
62
- background: ${c.interactive.primary__hover_alt.rgba};
63
- }
64
- &:focus-visible {
65
- color: ${c.text.static_icons__default.rgba};
66
- outline: 2px dashed ${c.interactive.focus.rgba};
67
- outline-offset: -4px;
68
- }
69
-
70
- ${({$disabled:e,$active:t})=>e&&!t&&a`
71
- color: ${c.interactive.disabled__text.rgba} !important;
72
- &:hover {
73
- cursor: not-allowed;
50
+ `,c=i.div`
51
+ button[role='tab'] {
52
+ .count {
53
+ background: ${t.ui.background__light_medium.rgba};
54
+ padding: 0 ${n.x_small};
55
+ > span {
56
+ color: ${t.text.static_icons__tertiary.rgba};
74
57
  }
75
- `};
58
+ }
76
59
 
77
- position: relative;
78
- display: grid;
79
- grid-template-columns: auto 1fr;
80
- align-items: center;
81
- gap: ${n.small};
82
- color: ${c.text.static_icons__default.rgba};
83
- cursor: pointer;
84
- padding: 0 ${n.medium};
85
- height: ${({$variant:e})=>r[e]};
86
- transition: background 200ms;
87
-
88
- > span {
89
- display: flex;
90
- flex-direction: column;
91
- position: relative;
92
- text-align: left;
93
- font-family: 'Equinor', sans-serif;
94
- font-weight: 700;
95
- font-size: 14px;
96
- }
97
- ${({$variant:e,$active:t})=>{switch(e){case`buttons`:return a`
98
- border-radius: ${l.corners.borderRadius};
99
- background: ${t?c.interactive.primary__hover_alt.rgba:`none`};
100
- `;case`border`:return a`
101
- > span {
102
- font-weight: ${t?700:500};
103
- &:after {
104
- height: 0;
105
- display: block;
106
- content: attr(title);
107
- font-weight: 700;
108
- font-size: 14px;
109
- overflow: hidden;
110
- visibility: hidden;
111
- }
112
- }
113
- `}}}
114
- `,f=i.div`
115
- display: flex;
116
- position: relative;
117
- &:after {
118
- position: absolute;
119
- left: 0;
120
- bottom: ${({$activeIndex:e,$index:t})=>`${(e-t)*100}%`};
121
- content: '';
122
- width: 100%;
123
- height: 2px;
124
- background: ${c.interactive.primary__resting.rgba};
125
- z-index: 100;
60
+ &:disabled {
61
+ .count {
62
+ background: ${t.interactive.disabled__fill.rgba};
63
+ > span {
64
+ color: ${t.interactive.disabled__text.rgba};
65
+ }
66
+ }
67
+ }
126
68
  }
127
- `,p=i.div`
69
+ `,l=i.div`
128
70
  display: flex;
129
71
  flex-direction: column;
130
72
  position: relative;
@@ -136,57 +78,33 @@ import{tokens as e}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/ind
136
78
  content: '';
137
79
  width: 2px;
138
80
  height: 100%;
139
- background: ${c.interactive.primary__resting.rgba};
81
+ background: ${t.interactive.primary__resting.rgba};
140
82
  z-index: 100;
141
- transition: top ${t.transitionMS};
83
+ transition: top ${e.transitionMS};
142
84
  }
143
- `,m=i(o.div)`
85
+ `,u=i(o.div)`
144
86
  display: flex;
145
87
  flex-direction: column;
146
88
  position: relative;
147
- ${({$variant:e})=>a`
148
- min-height: ${r[e]};
149
- ${e===`buttons`&&`gap: ${n.x_small};`}
150
- `}
151
- `,h=i(o.div)`
89
+ min-height: ${r};
90
+ `,d=i(o.div)`
152
91
  display: flex;
153
- flex-direction: ${({$variant:e})=>e===`borderHorizontal`?`row`:`column`};
92
+ flex-direction: column;
154
93
  height: fit-content;
155
94
  overflow: hidden;
156
- ${({$variant:e})=>{switch(e){case`buttons`:return`gap: ${n.small};`;case`border`:return a`
157
- &:after {
158
- position: absolute;
159
- left: 0;
160
- content: '';
161
- width: 2px;
162
- height: 100%;
163
- background: ${c.ui.background__medium.rgba};
164
- }
165
- `;case`borderHorizontal`:return a`
166
- &:after {
167
- position: absolute;
168
- left: 0;
169
- bottom: 0;
170
- content: '';
171
- width: 100%;
172
- height: 2px;
173
- background: ${c.ui.background__medium.rgba};
174
- }
175
- `}}}
176
- `,g=i(o.div)`
95
+ &:after {
96
+ position: absolute;
97
+ left: 0;
98
+ content: '';
99
+ width: 2px;
100
+ height: 100%;
101
+ background: ${t.ui.background__medium.rgba};
102
+ }
103
+ `,f=i(o.div)`
177
104
  display: flex;
178
105
  flex-direction: column;
179
- ${({$shouldShowChildren:e})=>e?null:a`
180
- visibility: hidden;
181
- height: 0 !important;
182
- `}
183
- > div > button, a {
184
- ${({$variant:e})=>{switch(e){case`buttons`:return a`
185
- margin-left: ${n.medium};
186
- `;case`border`:return a`
187
- padding-left: ${n.x_large};
188
- `}}}
106
+ > div > button,
107
+ a {
108
+ padding-left: ${n.x_large};
189
109
  }
190
-
191
- ${({$variant:e})=>e===`buttons`&&`gap:${n.x_small};`}
192
- `;export{p as BorderItemsContainer,f as BorderItemsHorizontalContainer,u as Button,g as ChildContainer,d as Link,h as TableOfContentsContainer,m as TableOfContentsItemContainer};
110
+ `;export{s as Button,f as ChildContainer,c as HorizontalItemsContainer,d as TableOfContentsContainer,u as TableOfContentsItemContainer,l as VerticalItemsContainer};
@@ -1,4 +1,4 @@
1
1
  //#region src/organisms/TableOfContents/TableOfContents.types.d.ts
2
- type TableOfContentsVariants = 'buttons' | 'border' | 'borderHorizontal';
2
+ type TableOfContentsMode = 'vertical' | 'horizontal';
3
3
  //#endregion
4
- export { TableOfContentsVariants };
4
+ export { TableOfContentsMode };
@@ -1,5 +1 @@
1
- import{useTableOfContents as e}from"../../providers/TableOfContentsProvider.js";import{Badge as t}from"../../molecules/Badge/Badge.js";import{GAP as n,HEIGHT as r}from"./TableOfContents.constants.js";import{Button as i,ChildContainer as a,Link as o,TableOfContentsItemContainer as s}from"./TableOfContents.styles.js";import{useEffect as c,useMemo as l,useRef as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";const p=({label:m,value:h,count:g,disabled:_=!1,children:v,variant:y,onlyShowSelectedChildren:b,isLink:x=!1})=>{let{isActive:S,selected:C,setSelected:w}=e(),T=u(void 0);c(()=>{T.current===void 0&&(T.current=0)},[]);let E=l(()=>S({label:m,value:h,children:v})&&!_,[v,_,S,m,h]),D=e=>{_&&e&&e.preventDefault(),!_&&C!==h&&w(h)},O=b&&E||!b;return f(s,{$variant:y,layoutScroll:!0,layoutRoot:!0,children:[x?f(o,{$active:C===h,$variant:y,onClick:e=>D(e),to:_?``:`#${h}`,$disabled:_,tabIndex:_?-1:0,children:[d(`span`,{title:m,children:m}),g!==void 0&&d(t,{variant:g===0?`empty`:`light`,value:g})]}):f(i,{$active:C===h,$variant:y,onClick:()=>D(),disabled:_,children:[d(`span`,{title:m,children:m}),g!==void 0&&d(t,{variant:g===0?`empty`:`light`,value:g})]}),v&&d(a,{$shouldShowChildren:O,$variant:y,initial:{height:T.current},animate:{height:`
2
- calc(
3
- (${O?r[y]:`0`} * ${v.length})
4
- ${y===`buttons`?`+ (${n.buttons} * ${v.length-1})`:``}
5
- )`},transition:{duration:.4},children:v.map(e=>d(p,{onlyShowSelectedChildren:b,variant:y,...e,isLink:x},e.value))})]})};export{p as TableOfContentsItem};
1
+ import{useTableOfContents as e}from"../../providers/TableOfContentsProvider.js";import{Badge as t}from"../../molecules/Badge/Badge.js";import{Button as n,ChildContainer as r,TableOfContentsItemContainer as i}from"./TableOfContents.styles.js";import{useMemo as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{AnimatePresence as c}from"framer-motion";const l=({label:u,value:d,count:f,disabled:p=!1,children:m,onlyShowSelectedChildren:h})=>{let{isActive:g,selected:_,setSelected:v}=e(),y=a(()=>g({label:u,value:d,children:m})&&!p,[m,p,g,u,d]);return s(i,{layoutScroll:!0,layoutRoot:!0,children:[s(n,{$active:_===d,onClick:()=>{!p&&_!==d&&v(d)},disabled:p,children:[o(`span`,{title:u,children:u}),f!==void 0&&o(t,{variant:p?`empty`:`light`,value:f})]}),o(c,{children:m&&(h&&y||!h)&&o(r,{initial:{height:0},animate:{height:`auto`},exit:{height:0},transition:{duration:.4},children:m.map(e=>o(l,{onlyShowSelectedChildren:h,...e},e.value))})})]})};export{l as TableOfContentsItem};
@@ -1,7 +1,7 @@
1
- import * as react121 from "react";
1
+ import * as react119 from "react";
2
2
  import { HTMLAttributes } from "react";
3
3
 
4
4
  //#region src/organisms/TopBar/Actions.d.ts
5
- declare const Actions: react121.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react121.RefAttributes<HTMLDivElement>>;
5
+ declare const Actions: react119.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react119.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 react119 from "react";
2
+ import * as react117 from "react";
3
3
 
4
4
  //#region src/organisms/TopBar/FieldMenu/FieldMenu.d.ts
5
5
  interface FieldMenuProps {
@@ -9,6 +9,6 @@ interface FieldMenuProps {
9
9
  itemNameSingular?: string;
10
10
  showAccessITLink?: boolean;
11
11
  }
12
- declare const FieldMenu: react119.ForwardRefExoticComponent<FieldMenuProps & react119.RefAttributes<HTMLDivElement>>;
12
+ declare const FieldMenu: react117.ForwardRefExoticComponent<FieldMenuProps & react117.RefAttributes<HTMLDivElement>>;
13
13
  //#endregion
14
14
  export { FieldMenu };
@@ -1,4 +1,4 @@
1
- import * as react133 from "react";
1
+ import * as react127 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: react133.Context<NotificationContext | undefined>;
9
+ declare const NotificationContext: react127.Context<NotificationContext | undefined>;
10
10
  declare const useNotification: () => NotificationContext;
11
11
  //#endregion
12
12
  export { useNotification };
@@ -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{InteractionRequiredAuthError as l,InteractionType as u}from"@azure/msal-browser";import{jsx as d}from"react/jsx-runtime";import{jwtDecode as f}from"jwt-decode";const{GRAPH_ENDPOINTS:p,GRAPH_REQUESTS_LOGIN:m,GRAPH_REQUESTS_PHOTO:h,GRAPH_REQUESTS_BACKEND:g,fetchMsGraph:_,isInIframe:v}=e,{getApiScope:y}=t,b=({children:e,account:t,setAccount:b,setPhoto:x,setRoles:S,authState:C,setAuthState:w,withoutLoader:T,loadingComponent:E,unauthorizedComponent:D,withoutBackend:O})=>{let{instance:k,accounts:A,inProgress:j}=s(),{login:M,result:N,error:P,acquireToken:F}=c(u.Silent,m),[I,L]=o(!1),R=a(!1);return i(()=>{I||(async()=>{console.log(`[AuthProvider] Initializing`),await k.initialize(),console.log(`[AuthProvider] Finished initializing`),L(!0)})().catch(e=>{console.error(`[AuthProvider] Error during initialization`,e)})},[k,I]),i(()=>{I&&(P instanceof l&&!v()&&C!==`unauthorized`?(console.error(P),console.log(`[AuthProvider] No account found, need to login via. redirect`),M(u.Redirect,m).catch(e=>{console.error(`[AuthProvider] Error during login`,e)})):N?.account&&!t?(console.log(`[AuthProvider] Found account in useMsalAuth result, setting that one as active`),k.setActiveAccount(N.account),b(N.account)):A.length>0&&!t?(console.log(`[AuthProvider] Found account in accounts array, setting that one as active`),k.setActiveAccount(A[0]),b(A[0])):P&&console.error(`[AuthProvider] Unexpected error:`,P))},[t,A,P,k,I,M,N,b,C]),i(()=>{if(!t||!I||R.current||j!==`none`)return;R.current=!0;let e=async()=>{try{let e=await F(u.Silent,h);if(e){let t=await _(p.PHOTO,e.accessToken);if(t.status===404)return null;let n=await t.blob();x((window.URL??window.webkitURL).createObjectURL(n))}}catch(e){console.error(e)}},n=async()=>{try{let e=await F(u.Silent,g(y(import.meta.env.VITE_API_SCOPE)));if(console.log(`[AuthProvider] Successfully acquired token`),e&&e.accessToken){console.log(`[AuthProvider] Decoding token`);let t=f(e.accessToken);if(console.log(`[AuthProvider] Token was valid`),t.roles)console.log(`[AuthProvider] Found roles`),S(t.roles);else throw Error(`Could not find roles in token`);w(`authorized`)}}catch(e){console.error(`[AuthProvider] Token error when trying to get roles!`,e),w(`unauthorized`)}};(async()=>{await e(),O?w(`authorized`):await n()})()},[t,F,P,I,j,w,x,S,O]),C===`unauthorized`?D??d(r,{}):T?e:C===`loading`||t===void 0?E??d(n,{variant:`application`}):e};export{b as AuthProviderInner};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/amplify-component-lib",
3
- "version": "10.0.6",
3
+ "version": "10.2.0",
4
4
  "description": "Frontend Typescript components for the Amplify team",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",