@equinor/amplify-component-lib 10.0.6 → 10.1.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.
@@ -1,6 +1,6 @@
1
- import * as react134 from "react";
1
+ import * as react135 from "react";
2
2
 
3
3
  //#region src/atoms/hooks/useLocalStorage.d.ts
4
- declare const useLocalStorage: <T>(key: string, defaultState: T, keepAliveMs?: number) => readonly [T, react134.Dispatch<react134.SetStateAction<T>>, () => void];
4
+ declare const useLocalStorage: <T>(key: string, defaultState: T, keepAliveMs?: number) => readonly [T, react135.Dispatch<react135.SetStateAction<T>>, () => void];
5
5
  //#endregion
6
6
  export { useLocalStorage };
@@ -1,6 +1,6 @@
1
1
  import { SelectOption, SelectOptionRequired } from "../../molecules/Select/Select.types.js";
2
2
  import { SelectComponentProps } from "../../molecules/Select/Select.js";
3
- import * as react131 from "react";
3
+ import * as react137 from "react";
4
4
  import { ChangeEvent, KeyboardEvent } from "react";
5
5
 
6
6
  //#region src/atoms/hooks/useSelect.d.ts
@@ -16,8 +16,8 @@ declare const useSelect: <T extends SelectOptionRequired>(props: SelectComponent
16
16
  handleOnOpen: () => void;
17
17
  handleOnRemoveItem: (item: SelectOption<T>) => void;
18
18
  search: string;
19
- searchRef: react131.RefObject<HTMLInputElement | null>;
20
- itemRefs: react131.RefObject<(HTMLButtonElement | null)[]>;
19
+ searchRef: react137.RefObject<HTMLInputElement | null>;
20
+ itemRefs: react137.RefObject<(HTMLButtonElement | null)[]>;
21
21
  selectedValues: T[];
22
22
  open: boolean;
23
23
  tryingToRemoveItem: T | undefined;
@@ -1,4 +1,4 @@
1
- import{tokens as e}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import{colors as t}from"../../atoms/style/colors.js";import{spacings as n}from"../../atoms/style/spacings.js";import r from"styled-components";const{shape:i}=e,a=e=>({light:{background:`rgba(235, 235, 235, 1)`,color:t.text.static_icons__tertiary.rgba},danger:{background:t.interactive.danger__resting.rgba,color:t.text.static_icons__primary_white.rgba},empty:{background:t.interactive.disabled__fill.rgba,color:t.interactive.disabled__text.rgba},default:{background:t.text.static_icons__tertiary.rgba,color:t.text.static_icons__primary_white.rgba}})[e],o=r.div`
1
+ import{tokens as e}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import{colors as t}from"../../atoms/style/colors.js";import{spacings as n}from"../../atoms/style/spacings.js";import r from"styled-components";const{shape:i}=e,a=e=>({light:{background:t.ui.background__light_medium.rgba,color:t.text.static_icons__tertiary.rgba},danger:{background:t.interactive.danger__resting.rgba,color:t.text.static_icons__primary_white.rgba},empty:{background:t.interactive.disabled__fill.rgba,color:t.interactive.disabled__text.rgba},default:{background:t.text.static_icons__tertiary.rgba,color:t.text.static_icons__primary_white.rgba}})[e],o=r.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
@@ -1,4 +1,4 @@
1
- import * as react25 from "react";
1
+ import * as react17 from "react";
2
2
  import { TooltipProps } from "@equinor/eds-core-react";
3
3
  import * as _floating_ui_utils0 from "@floating-ui/utils";
4
4
 
@@ -6,14 +6,14 @@ import * as _floating_ui_utils0 from "@floating-ui/utils";
6
6
  type OptionalTooltipProps = {
7
7
  textTransform?: string;
8
8
  } & TooltipProps;
9
- declare const OptionalTooltip: react25.ForwardRefExoticComponent<{
9
+ declare const OptionalTooltip: react17.ForwardRefExoticComponent<{
10
10
  textTransform?: string;
11
11
  } & {
12
12
  placement?: _floating_ui_utils0.Placement;
13
- title?: react25.ReactNode;
13
+ title?: react17.ReactNode;
14
14
  children: React.ReactElement & React.RefAttributes<HTMLElement>;
15
15
  enterDelay?: number;
16
16
  portalContainer?: HTMLElement;
17
- } & Omit<react25.HTMLAttributes<HTMLDivElement>, "title"> & react25.RefAttributes<HTMLDivElement>>;
17
+ } & Omit<react17.HTMLAttributes<HTMLDivElement>, "title"> & react17.RefAttributes<HTMLDivElement>>;
18
18
  //#endregion
19
19
  export { OptionalTooltip, OptionalTooltipProps };
@@ -1,4 +1,4 @@
1
- import * as react37 from "react";
1
+ import * as react21 from "react";
2
2
 
3
3
  //#region src/molecules/ProfileAvatar/ProfileAvatar.d.ts
4
4
  interface ProfileAvatarProps {
@@ -7,6 +7,6 @@ interface ProfileAvatarProps {
7
7
  size?: 'small' | 'small-medium' | 'medium' | 'large' | 'x-large' | number;
8
8
  disabled?: boolean;
9
9
  }
10
- declare const ProfileAvatar: react37.ForwardRefExoticComponent<ProfileAvatarProps & react37.RefAttributes<HTMLDivElement>>;
10
+ declare const ProfileAvatar: react21.ForwardRefExoticComponent<ProfileAvatarProps & react21.RefAttributes<HTMLDivElement>>;
11
11
  //#endregion
12
12
  export { ProfileAvatar, ProfileAvatarProps };
@@ -1,7 +1,7 @@
1
1
  import { EditorPanel, ImageExtensionFnProps, RichTextEditorFeatures } from "../RichTextEditor.types.js";
2
2
  import { MenuButtonProps } from "./MenuButton.js";
3
3
  import { AddImageProps } from "./AddImageButton.js";
4
- import * as react29 from "react";
4
+ import * as react31 from "react";
5
5
  import { FC } from "react";
6
6
  import * as styled_components0 from "styled-components";
7
7
  import { Editor } from "@tiptap/react";
@@ -14,10 +14,10 @@ interface MenuBarProps extends Pick<ImageExtensionFnProps, 'onImageUpload'> {
14
14
  }
15
15
  declare const AmplifyBar: FC<MenuBarProps>;
16
16
  declare const EditorMenu: {
17
- Bar: styled_components_dist_types3.IStyledComponentBase<"web", styled_components0.FastOmit<react29.DetailedHTMLProps<react29.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
18
- Bars: styled_components_dist_types3.IStyledComponentBase<"web", styled_components0.FastOmit<react29.DetailedHTMLProps<react29.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
19
- Button: react29.ForwardRefExoticComponent<Omit<MenuButtonProps, "ref"> & react29.RefAttributes<HTMLButtonElement>>;
20
- Section: styled_components_dist_types3.IStyledComponentBase<"web", styled_components0.FastOmit<react29.DetailedHTMLProps<react29.HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
17
+ Bar: styled_components_dist_types3.IStyledComponentBase<"web", styled_components0.FastOmit<react31.DetailedHTMLProps<react31.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
18
+ Bars: styled_components_dist_types3.IStyledComponentBase<"web", styled_components0.FastOmit<react31.DetailedHTMLProps<react31.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
19
+ Button: react31.ForwardRefExoticComponent<Omit<MenuButtonProps, "ref"> & react31.RefAttributes<HTMLButtonElement>>;
20
+ Section: styled_components_dist_types3.IStyledComponentBase<"web", styled_components0.FastOmit<react31.DetailedHTMLProps<react31.HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
21
21
  AddImageButton: FC<AddImageProps>;
22
22
  };
23
23
  declare const EditorText: {
@@ -2,16 +2,16 @@ import { EditorStylingProps, RichTextContentProps } from "./RichTextEditor.style
2
2
  import { EditorProviderProps } from "./EditorProvider.js";
3
3
  import { MenuBarProps } from "./MenuBar/MenuBar.js";
4
4
  import { RichTextEditor } from "./RichTextEditor.js";
5
- import * as react17 from "react";
5
+ import * as react23 from "react";
6
6
  import * as _tiptap_react0 from "@tiptap/react";
7
7
  import * as styled_components_dist_types0 from "styled-components/dist/types";
8
8
 
9
9
  //#region src/molecules/RichTextEditor/index.d.ts
10
10
  declare const RichText: {
11
- Styling: styled_components_dist_types0.IStyledComponentBase<"web", styled_components_dist_types0.Substitute<react17.DetailedHTMLProps<react17.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, EditorStylingProps>> & string;
12
- Provider: react17.FC<EditorProviderProps>;
13
- Content: styled_components_dist_types0.IStyledComponentBase<"web", styled_components_dist_types0.Substitute<Omit<_tiptap_react0.EditorContentProps, "ref"> & react17.RefAttributes<HTMLDivElement>, RichTextContentProps>> & string & Omit<react17.NamedExoticComponent<Omit<_tiptap_react0.EditorContentProps, "ref"> & react17.RefAttributes<HTMLDivElement>>, keyof react17.Component<any, {}, any>>;
14
- Bar: react17.FC<MenuBarProps>;
11
+ Styling: styled_components_dist_types0.IStyledComponentBase<"web", styled_components_dist_types0.Substitute<react23.DetailedHTMLProps<react23.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, EditorStylingProps>> & string;
12
+ Provider: react23.FC<EditorProviderProps>;
13
+ Content: styled_components_dist_types0.IStyledComponentBase<"web", styled_components_dist_types0.Substitute<Omit<_tiptap_react0.EditorContentProps, "ref"> & react23.RefAttributes<HTMLDivElement>, RichTextContentProps>> & string & Omit<react23.NamedExoticComponent<Omit<_tiptap_react0.EditorContentProps, "ref"> & react23.RefAttributes<HTMLDivElement>>, keyof react23.Component<any, {}, any>>;
14
+ Bar: react23.FC<MenuBarProps>;
15
15
  };
16
16
  //#endregion
17
17
  export { RichText };
@@ -1,4 +1,4 @@
1
- import * as react96 from "react";
1
+ import * as react94 from "react";
2
2
  import { RadioProps } from "@equinor/eds-core-react";
3
3
 
4
4
  //#region src/molecules/SelectionControls/Radio/Radio.d.ts
@@ -7,6 +7,6 @@ interface RadioProps$1 extends RadioProps {
7
7
  outlined?: boolean;
8
8
  error?: boolean;
9
9
  }
10
- declare const Radio$1: react96.ForwardRefExoticComponent<RadioProps$1 & react96.RefAttributes<HTMLInputElement>>;
10
+ declare const Radio$1: react94.ForwardRefExoticComponent<RadioProps$1 & react94.RefAttributes<HTMLInputElement>>;
11
11
  //#endregion
12
12
  export { Radio$1 as Radio, RadioProps$1 as RadioProps };
@@ -1,10 +1,10 @@
1
- import * as react94 from "react";
1
+ import * as react96 from "react";
2
2
  import { SwitchProps } from "@equinor/eds-core-react";
3
3
 
4
4
  //#region src/molecules/SelectionControls/Switch/Switch.d.ts
5
5
  interface SwitchProps$1 extends SwitchProps {
6
6
  outlined?: boolean;
7
7
  }
8
- declare const Switch$1: react94.ForwardRefExoticComponent<SwitchProps$1 & react94.RefAttributes<HTMLInputElement>>;
8
+ declare const Switch$1: react96.ForwardRefExoticComponent<SwitchProps$1 & react96.RefAttributes<HTMLInputElement>>;
9
9
  //#endregion
10
10
  export { Switch$1 as Switch, SwitchProps$1 as SwitchProps };
@@ -1,5 +1,5 @@
1
1
  import { FilterProps } from "./Filter.types.js";
2
- import * as react_jsx_runtime5 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime6 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/organisms/Filter/Filter.d.ts
5
5
 
@@ -32,6 +32,6 @@ declare function Filter<T extends string>({
32
32
  id,
33
33
  openOnFocus,
34
34
  ...rest
35
- }: FilterProps<T>): react_jsx_runtime5.JSX.Element;
35
+ }: FilterProps<T>): react_jsx_runtime6.JSX.Element;
36
36
  //#endregion
37
37
  export { Filter };
@@ -1,6 +1,6 @@
1
1
  import { SelectOptionRequired } from "../../molecules/Select/Select.types.js";
2
2
  import { FilterProps } from "./Filter.types.js";
3
- import * as react_jsx_runtime4 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/organisms/Filter/QuickFilter.d.ts
6
6
  interface QuickFilterProps<T extends string> {
@@ -14,6 +14,6 @@ declare function QuickFilter<T extends string>({
14
14
  items,
15
15
  onQuickFilter,
16
16
  label
17
- }: QuickFilterProps<T>): react_jsx_runtime4.JSX.Element;
17
+ }: QuickFilterProps<T>): react_jsx_runtime5.JSX.Element;
18
18
  //#endregion
19
19
  export { QuickFilter };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime6 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/organisms/Filter/SortMenu.d.ts
4
4
  interface SortMenuProps<S> {
@@ -13,6 +13,6 @@ declare function SortMenu<S>({
13
13
  value,
14
14
  onChange,
15
15
  items
16
- }: SortMenuProps<S>): react_jsx_runtime6.JSX.Element;
16
+ }: SortMenuProps<S>): react_jsx_runtime4.JSX.Element;
17
17
  //#endregion
18
18
  export { SortMenu };
@@ -1 +1 @@
1
- import{TableOfContentsProvider as e}from"../../providers/TableOfContentsProvider.js";import{TableOfContents as t}from"../TableOfContents/TableOfContents.js";import{useFilteredReleaseNotes as n}from"./hooks/useFilteredReleaseNotes.js";import{extractYearsData as r,monthValueToString as i,yearId as a}from"./ReleaseNotesPage.utils.js";import{ReleasePosts as o}from"./ReleasePosts/ReleasePosts.js";import{ReleaseNoteFilter as s}from"./ReleaseNoteFilter.js";import{Container as c,StickyRightSide as l}from"./ReleaseNotesPage.styles.js";import{useMemo as u}from"react";import{Typography as d}from"@equinor/eds-core-react";import{jsx as f,jsxs as p}from"react/jsx-runtime";const m=()=>{let{data:m}=n();return f(e,{items:u(()=>{let e=[];for(let t of r(m))e.push({value:a(t.value),label:t.label,children:t.months.map(e=>({label:e.label,value:i(e.value)}))});return e},[m]),children:p(c,{children:[f(d,{variant:`h1`,bold:!0,children:`Release Notes`}),p(`section`,{children:[f(s,{}),f(o,{})]}),f(l,{children:f(t,{onlyShowSelectedChildren:!1,variant:`border`})})]})})};export{m as ReleaseNotesPage};
1
+ import{TableOfContentsProvider as e}from"../../providers/TableOfContentsProvider.js";import{TableOfContents as t}from"../TableOfContents/TableOfContents.js";import{useFilteredReleaseNotes as n}from"./hooks/useFilteredReleaseNotes.js";import{extractYearsData as r,monthValueToString as i,yearId as a}from"./ReleaseNotesPage.utils.js";import{ReleasePosts as o}from"./ReleasePosts/ReleasePosts.js";import{ReleaseNoteFilter as s}from"./ReleaseNoteFilter.js";import{Container as c,StickyRightSide as l}from"./ReleaseNotesPage.styles.js";import{useMemo as u}from"react";import{Typography as d}from"@equinor/eds-core-react";import{jsx as f,jsxs as p}from"react/jsx-runtime";const m=()=>{let{data:m}=n();return f(e,{items:u(()=>{let e=[];for(let t of r(m))e.push({value:a(t.value),label:t.label,children:t.months.map(e=>({label:e.label,value:i(e.value)}))});return e},[m]),children:p(c,{children:[f(d,{variant:`h1`,bold:!0,children:`Release Notes`}),p(`section`,{children:[f(s,{}),f(o,{})]}),f(l,{children:f(t,{onlyShowSelectedChildren:!1})})]})})};export{m as ReleaseNotesPage};
@@ -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
1
  import { ToggleGroup } from "./ToggleGroup.types.js";
2
- import * as react138 from "react";
2
+ import * as react133 from "react";
3
3
 
4
4
  //#region src/organisms/ToggleGroup/ToggleGroup.d.ts
5
- declare const ToggleGroup$1: react138.ForwardRefExoticComponent<ToggleGroup & react138.RefAttributes<HTMLDivElement>>;
5
+ declare const ToggleGroup$1: react133.ForwardRefExoticComponent<ToggleGroup & react133.RefAttributes<HTMLDivElement>>;
6
6
  //#endregion
7
7
  export { ToggleGroup$1 as ToggleGroup };
@@ -1,9 +1,9 @@
1
1
  import { ToggleGroupOption } from "./ToggleGroup.types.js";
2
- import * as react136 from "react";
2
+ import * as react131 from "react";
3
3
  import { HTMLAttributes } from "react";
4
4
 
5
5
  //#region src/organisms/ToggleGroup/ToggleGroupOption.d.ts
6
6
  type ToggleGroupOptionProps = ToggleGroupOption & Omit<HTMLAttributes<HTMLButtonElement>, 'onToggle' | 'disabled'>;
7
- declare const ToggleGroupOption$1: react136.ForwardRefExoticComponent<ToggleGroupOptionProps & react136.RefAttributes<HTMLButtonElement>>;
7
+ declare const ToggleGroupOption$1: react131.ForwardRefExoticComponent<ToggleGroupOptionProps & react131.RefAttributes<HTMLButtonElement>>;
8
8
  //#endregion
9
9
  export { ToggleGroupOption$1 as ToggleGroupOption };
@@ -1,4 +1,4 @@
1
- import * as react133 from "react";
1
+ import * as react139 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: react139.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.1.0",
4
4
  "description": "Frontend Typescript components for the Amplify team",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",