@equinor/amplify-component-lib 8.16.1 → 8.17.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.
@@ -25,9 +25,14 @@ export interface DialogProps extends Omit<EDSDialogProps, 'title'> {
25
25
  onClose: () => void;
26
26
  width?: number;
27
27
  actions?: DialogAction[];
28
- withContentPadding?: boolean;
28
+ withContentPadding?: {
29
+ vertical?: boolean;
30
+ horizontal?: boolean;
31
+ };
29
32
  withBorders?: boolean;
30
33
  contentMaxHeight?: string;
34
+ hideClose?: boolean;
35
+ additionalInfo?: string | ReactNode;
31
36
  }
32
37
  /**
33
38
  * @param title - String or up to 2 react elements in a flex-column
@@ -35,9 +40,11 @@ export interface DialogProps extends Omit<EDSDialogProps, 'title'> {
35
40
  * @param onClose - fn to set open to false
36
41
  * @param width - width in px, defaults to just fit-content
37
42
  * @param actions - Dialog actions, { position: "right" is default }
38
- * @param withContentPadding - Defaults to true
43
+ * @param withContentPadding - Defaults to true for vertical and horizontal
39
44
  * @param withBorders - Defaults to false
40
45
  * @param contentMaxHeight - Defaults to '60vh'
46
+ * @param hideClose - Defaults to true. Hides the top right close button icon
47
+ * @param additionalInfo - Defaults to empty, and won't show the additional info button
41
48
  * Also inherits props from EDS dialog
42
49
  */
43
50
  export declare const Dialog: import("react").ForwardRefExoticComponent<DialogProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- import{jsx as i,jsxs as t}from"react/jsx-runtime";import{forwardRef as e}from"react";import{Typography as o,Button as n,Icon as r}from"@equinor/eds-core-react";import{close as d}from"@equinor/eds-icons";import{DialogElement as l,DialogTitle as s,DialogContent as c,DialogActions as h}from"./Dialog.styles.js";import{DialogAction as a}from"./DialogAction.js";const p=e((({title:e,children:p,width:g,actions:m,withContentPadding:f=!0,withBorders:x=!1,contentMaxHeight:w="60vh",...y},v)=>{const $=m?.filter((i=>"left"===i.position)),u=m?.filter((i=>"center"===i.position)),C=m?.filter((i=>void 0===i.position||"right"===i.position)),j="string"==typeof e?i(o,{variant:"h6",children:e}):e,B="string"==typeof p?i(o,{variant:"body_long",children:p}):p;return t(l,{...y,ref:v,style:{width:g?`${g}px`:void 0,...y.style},children:[t(s,{$withBorders:x,style:{width:g?`${g}px`:void 0},children:[i("section",{children:j}),i(n,{variant:"ghost_icon",onClick:y.onClose,children:i(r,{data:d})})]}),i(c,{$withContentPadding:f,style:{width:g?`${g}px`:void 0,maxHeight:w},children:B}),m&&m.length>0&&t(h,{$withBorders:x,style:{width:g?`${g}px`:void 0},children:[$&&$.length>0&&i("section",{id:"dialog-actions-left",children:$.map((t=>i(a,{...t},t.text)))}),u&&u.length>0&&i("section",{id:"dialog-actions-center",children:u.map((t=>i(a,{...t},t.text)))}),C&&C.length>0&&i("section",{id:"dialog-actions-right",children:C.map((t=>i(a,{...t},t.text)))})]})]})}));p.displayName="Dialog";export{p as Dialog};
1
+ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{forwardRef as o,useState as e}from"react";import{Typography as n,Button as d,Icon as r}from"@equinor/eds-core-react";import{info_circle as l,close as a}from"@equinor/eds-icons";import{DialogElement as s,DialogTitle as c,DialogContent as h,AdditionalInfoBanner as g,InfoIconWrapper as p,DialogActions as m}from"./Dialog.styles.js";import{DialogAction as f}from"./DialogAction.js";const v=o((({title:o,children:v,width:w,actions:x,withContentPadding:y,withBorders:$=!1,contentMaxHeight:C="60vh",hideClose:u,additionalInfo:b,...j},z)=>{const{horizontal:B=!0,vertical:D=!0}=y??{},[P,_]=e(!1),k=x?.filter((i=>"left"===i.position)),q=x?.filter((i=>"center"===i.position)),H=x?.filter((i=>void 0===i.position||"right"===i.position)),A="string"==typeof o?i(n,{variant:"h6",children:o}):o,I="string"==typeof v?i(n,{variant:"body_long",children:v}):v;return t(s,{...j,ref:z,style:{width:w?`${w}px`:void 0,...j.style},children:[t(c,{$withBorders:$,style:{width:w?`${w}px`:void 0},children:[i("section",{children:A}),t("div",{children:[b&&i(d,{variant:"ghost_icon",onClick:()=>_((i=>!i)),"data-testid":"dialog-info-button",children:i(r,{data:l})}),!u&&i(d,{variant:"ghost_icon",onClick:j.onClose,"data-testid":"dialog-close-button",children:i(r,{data:a,"data-testid":"dialog-close-icon",size:24})})]})]}),t(h,{$withContentPaddingX:B,$withContentPaddingY:D,style:{width:w?`${w}px`:void 0,maxHeight:C},children:[P&&b&&t(g,{children:[i(p,{children:i(r,{data:l,size:24})}),b]}),I]}),x&&x.length>0&&t(m,{$withBorders:$,style:{width:w?`${w}px`:void 0},children:[k&&k.length>0&&i("section",{id:"dialog-actions-left",children:k.map((t=>i(f,{...t},t.text)))}),q&&q.length>0&&i("section",{id:"dialog-actions-center",children:q.map((t=>i(f,{...t},t.text)))}),H&&H.length>0&&i("section",{id:"dialog-actions-right",children:H.map((t=>i(f,{...t},t.text)))})]})]})}));v.displayName="Dialog";export{v as Dialog};
@@ -24,7 +24,8 @@ export declare const DialogTitle: import("styled-components/dist/types").IStyled
24
24
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
25
25
  }, StyledDialogProps>> & string & Omit<import("react").ForwardRefExoticComponent<import("@equinor/eds-core-react").DialogTitleProps & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
26
26
  interface DialogContentProps {
27
- $withContentPadding: boolean;
27
+ $withContentPaddingY: boolean;
28
+ $withContentPaddingX: boolean;
28
29
  }
29
30
  export declare const DialogContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<{
30
31
  scrollable?: boolean;
@@ -36,4 +37,6 @@ export declare const DialogContent: import("styled-components/dist/types").IStyl
36
37
  export declare const DialogActions: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("@equinor/eds-core-react").DialogActionsProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
37
38
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
38
39
  }, StyledDialogProps>> & string & Omit<import("react").ForwardRefExoticComponent<import("@equinor/eds-core-react").DialogActionsProps & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
40
+ export declare const AdditionalInfoBanner: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
41
+ export declare const InfoIconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
39
42
  export {};
@@ -1,37 +1,36 @@
1
- import{Dialog as o}from"@equinor/eds-core-react";import{colors as t}from"../../atoms/style/colors.js";import{spacings as i}from"../../atoms/style/spacings.js";import e,{css as n}from"styled-components";const d=e(o)`
1
+ import{Dialog as i}from"@equinor/eds-core-react";import{colors as o}from"../../atoms/style/colors.js";import{spacings as t}from"../../atoms/style/spacings.js";import e,{css as d}from"styled-components";const n=e(i)`
2
2
  grid-gap: 0;
3
- `,r=e(o.Title)`
3
+ `,r=e(i.Title)`
4
4
  display: flex;
5
5
  align-items: center;
6
6
  justify-content: space-between;
7
7
  width: 100%;
8
- padding: ${i.medium};
8
+ padding: ${t.medium};
9
9
 
10
- ${({$withBorders:o})=>o?n`
11
- border-bottom: 1px solid ${t.ui.background__medium.rgba};
10
+ ${({$withBorders:i})=>i?d`
11
+ border-bottom: 1px solid ${o.ui.background__medium.rgba};
12
12
  `:""}
13
13
  > section {
14
14
  display: flex;
15
15
  flex-direction: column;
16
16
  }
17
- `,s=e(o.CustomContent)`
17
+ `,a=e(i.CustomContent)`
18
18
  min-height: unset;
19
19
  overflow: auto;
20
- ${({$withContentPadding:o})=>o?n`
21
- padding: ${i.medium};
22
- `:n`
23
- padding: 0;
20
+ ${({$withContentPaddingX:i,$withContentPaddingY:o})=>d`
21
+ padding: ${o?t.medium:0}
22
+ ${i?t.medium:0};
24
23
  `}
25
- `,a=e(o.Actions)`
26
- border-top: 1px solid ${t.ui.background__medium.rgba};
24
+ `,s=e(i.Actions)`
25
+ border-top: 1px solid ${o.ui.background__medium.rgba};
27
26
  display: grid;
28
27
  grid-template-columns: auto auto auto;
29
- padding-top: ${i.medium};
28
+ padding-top: ${t.medium};
30
29
  width: 100%;
31
30
 
32
31
  > section {
33
32
  display: flex;
34
- gap: ${i.small};
33
+ gap: ${t.small};
35
34
  }
36
35
 
37
36
  > section#dialog-actions-left {
@@ -48,9 +47,18 @@ import{Dialog as o}from"@equinor/eds-core-react";import{colors as t}from"../../a
48
47
  justify-content: flex-end;
49
48
  }
50
49
 
51
- ${({$withBorders:o})=>o?n`
52
- border-top: 1px solid ${t.ui.background__medium.rgba};
53
- `:n`
50
+ ${({$withBorders:i})=>i?d`
51
+ border-top: 1px solid ${o.ui.background__medium.rgba};
52
+ `:d`
54
53
  border-top: none;
55
54
  `}
56
- `;export{a as DialogActions,s as DialogContent,d as DialogElement,r as DialogTitle};
55
+ `,m=e.div`
56
+ display: flex;
57
+ flex-direction: row;
58
+ gap: ${t.medium};
59
+ padding: ${t.medium};
60
+ background-color: ${o.ui.background__info.rgba};
61
+ `,l=e.div`
62
+ display: flex;
63
+ align-items: center;
64
+ `;export{m as AdditionalInfoBanner,s as DialogActions,a as DialogContent,n as DialogElement,r as DialogTitle,l as InfoIconWrapper};
@@ -7,5 +7,4 @@ export declare const RichText: {
7
7
  }, import("./RichTextEditor.styles").RichTextContentProps>> & string & Omit<import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<import("@tiptap/react").EditorContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>>, keyof import("react").Component<any, {}, any>>;
8
8
  Display: import("react").FC<import("../RichTextDisplay/RichTextDisplay").RichTextDisplayProps & import("react").HTMLAttributes<HTMLDivElement>>;
9
9
  Bar: import("react").FC<import("./MenuBar/MenuBar").MenuBarProps>;
10
- Kit: import("@tiptap/core").Extension<import("./custom-extensions/AmplifyKit").AmplifyKitOptions, any>;
11
10
  };
@@ -1 +1 @@
1
- import{AmplifyKit as t}from"./custom-extensions/AmplifyKit.js";import{AmplifyBar as i}from"./MenuBar/MenuBar.js";import{EditorProvider as r}from"./EditorProvider.js";import{EditorStyling as o,EditorContent as s}from"./RichTextEditor.styles.js";import{RichTextDisplay as e}from"../RichTextDisplay/RichTextDisplay.js";import"react/jsx-runtime";import"./RichTextEditor.types.js";const m={Styling:o,Provider:r,Content:s,Display:e,Bar:i,Kit:t};export{m as RichText};
1
+ import{AmplifyBar as r}from"./MenuBar/MenuBar.js";import{EditorProvider as t}from"./EditorProvider.js";import{EditorStyling as i,EditorContent as o}from"./RichTextEditor.styles.js";import{RichTextDisplay as e}from"../RichTextDisplay/RichTextDisplay.js";import"react/jsx-runtime";import"./RichTextEditor.types.js";const s={Styling:i,Provider:t,Content:o,Display:e,Bar:r};export{s as RichText};
@@ -0,0 +1,8 @@
1
+ import { FC, ReactNode } from 'react';
2
+ interface ButtonWithMenuProps {
3
+ onOpenChange?: (value: boolean) => void;
4
+ menuItems: ReactNode[];
5
+ children: ReactNode[];
6
+ }
7
+ export declare const ButtonWithMenu: FC<ButtonWithMenuProps>;
8
+ export {};
@@ -0,0 +1 @@
1
+ import{jsxs as r,Fragment as e,jsx as n}from"react/jsx-runtime";import{useState as o,useRef as t}from"react";import{Menu as c}from"@equinor/eds-core-react";const i=({onOpenChange:i,menuItems:l,children:m})=>{const[u,h]=o(!1),p=t(null);return r(e,{children:[n("button",{ref:p,onClick:()=>{h(!u),i?.(!u)},children:m}),u&&n(c,{open:!0,anchorEl:p.current,onClose:()=>{h(!1),i?.(!1)},children:l})]})};export{i as ButtonWithMenu};
@@ -1,22 +1,4 @@
1
- import { ChangeEvent, ReactNode } from 'react';
2
- import { IconData } from '@equinor/eds-icons';
3
- export interface FilterProps<T> {
4
- values: {
5
- key: T;
6
- label: string;
7
- icon?: IconData;
8
- }[];
9
- onClearFilter: (key: T) => void;
10
- onClearAllFilters: () => void;
11
- search: string;
12
- onSearchChange: (event: ChangeEvent<HTMLInputElement>) => void;
13
- onSearchEnter: (value: string) => void;
14
- children: ReactNode | ReactNode[];
15
- initialOpen?: boolean;
16
- placeholder?: string;
17
- id?: string;
18
- showClearFiltersButton?: boolean;
19
- }
1
+ import { FilterProps } from './Filter.types';
20
2
  /**
21
3
  * @param values - Array of values to display as chips ({ value: string, label: string, icon?: IconData }[])
22
4
  * @param search - The current search value
@@ -29,5 +11,12 @@ export interface FilterProps<T> {
29
11
  * @param placeholder - Placeholder text for the search input, defaults to 'Search...'
30
12
  * @param id - ID for the search field
31
13
  * @param showClearFiltersButton - Whether to show the clear filters button, defaults to true
14
+ * - Sorting props
15
+ * @param sortValue - The current sort value
16
+ * @param onSortChange - Callback when a sorting is selected in the menu
17
+ * @param sortItems - Array of sort items ({ value: S, label: string }[])
18
+ * - Quick filter props
19
+ * @param onQuickFilter - Callback when a quick filter is selected in the menu
20
+ * @param quickFilterItems - Array of quick filter items ({ value: Q, label: string }[])
32
21
  */
33
- export declare function Filter<T>({ values, search, onSearchChange, onSearchEnter, onClearFilter, onClearAllFilters, children, initialOpen, placeholder, id, showClearFiltersButton, }: FilterProps<T>): import("react/jsx-runtime").JSX.Element;
22
+ export declare function Filter<T, S, Q>({ values, search, onSearchChange, onSearchEnter, onClearFilter, onClearAllFilters, children, initialOpen, placeholder, id, showClearFiltersButton, ...rest }: FilterProps<T, S, Q>): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as t,useRef as i}from"react";import{Icon as n,Button as o}from"@equinor/eds-core-react";import{filter_list as a,clear as l,arrow_drop_up as c,arrow_drop_down as h}from"@equinor/eds-icons";import{Wrapper as s,Container as d,StyledChip as m,SearchField as g,Content as u}from"./Filter.styles.js";import{colors as p}from"../../atoms/style/colors.js";import{AnimatePresence as C}from"framer-motion";function y({values:y,search:f,onSearchChange:k,onSearchEnter:v,onClearFilter:_,onClearAllFilters:b,children:F,initialOpen:x=!1,placeholder:$="Search...",id:j="filter-search",showClearFiltersButton:w=!0}){const[A,B]=t(x),[D,S]=t(-1),q=i(x?"auto":0),E=()=>{B((e=>!e)),"auto"===q.current&&(q.current=0)},z=()=>{b()};return e(s,{children:[e(d,{$open:A,children:[r(n,{onClick:E,data:a,color:p.interactive.primary__resting.rgba}),e("section",{children:[y.map((({key:e,label:t,icon:i},n)=>r(m,{onDelete:()=>_(e),leadingIconData:i,$tryingToRemove:D===n,children:t},`${t}-${n}`))),r(g,{id:j,type:"search",value:f,placeholder:$,onChange:k,onKeyDownCapture:e=>{"Enter"===e.key&&""!==f?v(f):"Backspace"===e.key&&""===f&&(y.length>0&&-1===D?S(y.length-1):-1!==D&&(_(y[D].key),S(-1)))},onFocus:()=>{A||B(!0)}})]}),y.length>0&&r(o,{variant:"ghost_icon",onClick:z,"data-testid":"clear-all-x",children:r(n,{data:l,size:16,color:p.text.static_icons__tertiary.rgba})}),r(o,{variant:"ghost_icon",onClick:E,"data-testid":"toggle-open-button",children:r(n,{data:A?c:h})})]}),r(C,{children:A&&r(u,{$showClearFilterButton:w,animate:{height:"auto"},initial:{height:q.current},exit:{height:0},children:r("section",{children:Array.isArray(F)?F.map(((t,i)=>e("div",{children:[t,i===F.length-1&&w&&r(o,{variant:"outlined",onClick:z,disabled:0===y.length,children:"Clear filters"})]},i))):e("div",{children:[F,w&&r(o,{variant:"outlined",onClick:z,disabled:0===y.length,children:"Clear filters"})]})})})})]})}export{y as Filter};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as r,useRef as i}from"react";import{Icon as o,Button as n}from"@equinor/eds-core-react";import{filter_list as a,clear as l,arrow_drop_up as c,arrow_drop_down as s}from"@equinor/eds-icons";import{Wrapper as h,Container as d,StyledChip as m,SearchField as u,Content as g}from"./Filter.styles.js";import{colors as p}from"../../atoms/style/colors.js";import{QuickFilter as f}from"./QuickFilter.js";import{Sorting as y}from"./Sorting.js";import{AnimatePresence as C}from"framer-motion";function k({values:k,search:_,onSearchChange:b,onSearchEnter:v,onClearFilter:F,onClearAllFilters:x,children:j,initialOpen:S=!1,placeholder:$="Search...",id:q="filter-search",showClearFiltersButton:w=!0,...A}){const[B,D]=r(S),[E,I]=r(-1),z=i(S?"auto":0),K=()=>{D((e=>!e)),"auto"===z.current&&(z.current=0)},O=()=>{x()};return e(h,{children:[e(d,{children:[t(o,{onClick:K,data:a,color:p.text.static_icons__tertiary.rgba}),e("section",{children:[k.map((({key:e,label:r,icon:i},o)=>t(m,{onDelete:()=>F(e),leadingIconData:i,$tryingToRemove:E===o,children:r},`${r}-${o}`))),t(u,{id:q,type:"search",value:_,placeholder:$,onChange:b,onKeyDownCapture:e=>{"Enter"===e.key&&""!==_?v(_):"Backspace"===e.key&&""===_&&(k.length>0&&-1===E?I(k.length-1):-1!==E&&(F(k[E].key),I(-1)))},onFocus:()=>{B||D(!0)}})]}),k.length>0&&t(n,{variant:"ghost_icon",onClick:O,"data-testid":"clear-all-x",children:t(o,{data:l,size:16,color:p.text.static_icons__tertiary.rgba})}),"quickFilterItems"in A&&t(f,{...A}),"sortValue"in A&&t(y,{...A}),t("button",{onClick:K,"data-testid":"toggle-open-button",children:t(o,{data:B?c:s,color:p.text.static_icons__tertiary.rgba})})]}),t(C,{children:B&&t(g,{$showClearFilterButton:w,animate:{height:"auto"},initial:{height:z.current},exit:{height:0},children:t("section",{children:Array.isArray(j)?j.map(((r,i)=>e("div",{children:[r,i===j.length-1&&w&&t(n,{variant:"outlined",onClick:O,disabled:0===k.length,children:"Clear filters"})]},i))):e("div",{children:[j,w&&t(n,{variant:"outlined",onClick:O,disabled:0===k.length,children:"Clear filters"})]})})})})]})}export{k as Filter};
@@ -1,8 +1,5 @@
1
1
  export declare const Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- interface ContainerProps {
3
- $open: boolean;
4
- }
5
- export declare const Container: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ContainerProps>> & string;
2
+ export declare const Container: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
6
3
  export declare const SearchField: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
7
4
  interface ContentProps {
8
5
  $showClearFilterButton: boolean;
@@ -1,44 +1,68 @@
1
- import"react";import"../../molecules/RichTextEditor/custom-extensions/AmplifyKit.js";import"../../molecules/RichTextEditor/RichTextEditor.types.js";import"../../_virtual/lodash.js";import"@equinor/subsurface-app-management";import"@microsoft/signalr";import"@tanstack/react-query";import"../../atoms/enums/Environment.js";import"../../atoms/utils/auth_environment.js";import"../TopBar/Notifications/NotificationProvider.js";import"../../providers/AuthProvider/AuthProvider.js";import"../../providers/ReleaseNotesProvider.js";import"../../providers/SideBarProvider.js";import"../../providers/SnackbarProvider/SnackbarProvider.js";import"../../providers/StepperProvider.js";import"../../providers/TableOfContentsProvider.js";import"../../providers/ThemeProvider/ThemeProvider.js";import"../../providers/TutorialStepsProvider.js";import{elevation as r,shape as t,typography as o}from"../../atoms/style/index.js";import"../../atoms/enums/Errors.js";import"../../atoms/enums/Theme.js";import"../../atoms/enums/SpacingsMode.js";import"react/jsx-runtime";import"../../deprecated/ErrorPage/illustrations/GlitchAnimation.js";import"../../deprecated/ErrorPage/illustrations/QuestioningAnimation.js";import"proj4";import"html2canvas";import{Chip as i}from"../../molecules/Chip/Chip.js";import{motion as e}from"framer-motion";import s,{css as a}from"styled-components";import{colors as n}from"../../atoms/style/colors.js";import{spacings as m}from"../../atoms/style/spacings.js";const p=s.div`
1
+ import"react";import"../../molecules/RichTextEditor/custom-extensions/AmplifyKit.js";import"../../molecules/RichTextEditor/RichTextEditor.types.js";import"../../_virtual/lodash.js";import"@equinor/subsurface-app-management";import"@microsoft/signalr";import"@tanstack/react-query";import"../../atoms/enums/Environment.js";import"../../atoms/utils/auth_environment.js";import"../TopBar/Notifications/NotificationProvider.js";import"../../providers/AuthProvider/AuthProvider.js";import"../../providers/ReleaseNotesProvider.js";import"../../providers/SideBarProvider.js";import"../../providers/SnackbarProvider/SnackbarProvider.js";import"../../providers/StepperProvider.js";import"../../providers/TableOfContentsProvider.js";import"../../providers/ThemeProvider/ThemeProvider.js";import"../../providers/TutorialStepsProvider.js";import{shape as r,typography as t,elevation as i}from"../../atoms/style/index.js";import"../../atoms/enums/Errors.js";import"../../atoms/enums/Theme.js";import"../../atoms/enums/SpacingsMode.js";import"react/jsx-runtime";import"../../deprecated/ErrorPage/illustrations/GlitchAnimation.js";import"../../deprecated/ErrorPage/illustrations/QuestioningAnimation.js";import"proj4";import"html2canvas";import{Chip as o}from"../../molecules/Chip/Chip.js";import{motion as e}from"framer-motion";import a,{css as s}from"styled-components";import{colors as n}from"../../atoms/style/colors.js";import{spacings as d}from"../../atoms/style/spacings.js";const m=a.div`
2
2
  width: 100%;
3
- box-shadow: ${r.raised};
3
+ `,p=a.div`
4
+ display: flex;
4
5
  background: ${n.ui.background__default.rgba};
5
- border-radius: ${t.corners.borderRadius};
6
- overflow: hidden;
7
- `,d=s.div`
8
- display: grid;
9
- grid-template-columns: auto 1fr auto auto;
10
6
  align-items: center;
11
7
  width: 100%;
12
- gap: ${m.small};
13
- padding: ${m.medium_small} ${m.small};
14
- border-bottom: 1px solid
15
- ${({$open:r})=>r?n.ui.background__medium.rgba:"transparent"};
8
+ height: 36px;
9
+ padding-left: ${d.small};
10
+ border-bottom: 1px solid ${n.ui.background__medium.rgba};
11
+ border-top-left-radius: ${r.corners.borderRadius};
12
+ border-top-right-radius: ${r.corners.borderRadius};
16
13
  transition: border-bottom 200ms;
17
14
  cursor: pointer;
18
15
  > section {
16
+ margin-left: ${d.small};
17
+ flex-grow: 1;
19
18
  display: flex;
20
19
  flex-wrap: wrap;
21
- gap: ${m.x_small};
20
+ gap: ${d.x_small};
22
21
  }
23
22
  > button {
23
+ height: 35px;
24
+ padding: 0 ${d.small} 0 ${d.medium_small};
25
+ display: flex;
26
+ gap: ${d.x_small};
27
+ align-items: center;
28
+ justify-content: center;
29
+ border-left: 1px solid ${n.ui.background__medium.rgba};
30
+ color: ${n.interactive.primary__resting.rgba};
31
+ span {
32
+ color: ${n.interactive.primary__resting.rgba};
33
+ }
34
+
35
+ &:hover {
36
+ background: ${n.interactive.primary__hover_alt.rgba};
37
+ }
38
+ }
39
+ > button[data-testid='clear-all-x'] {
24
40
  width: 24px;
25
41
  height: 24px;
42
+ border-left: none;
43
+ margin-right: ${d.small};
26
44
  &:after {
27
45
  width: 24px;
28
46
  height: 24px;
29
47
  }
30
48
  }
31
- > svg:last-child {
32
- grid-column: 4;
49
+ > button:last-child {
50
+ border-left: 1px solid ${n.ui.background__medium.rgba};
51
+ width: 36px;
52
+ padding: 0;
53
+ &:hover {
54
+ border-top-right-radius: ${r.corners.borderRadius};
55
+ background: ${n.interactive.primary__hover_alt.rgba};
56
+ }
33
57
  }
34
- `,l=s.input`
58
+ `,l=a.input`
35
59
  background: transparent;
36
60
  width: 0;
37
61
  flex-grow: 1;
38
62
  padding: 0;
39
63
  font-family: 'Equinor', sans-serif;
40
- font-size: ${o.input.text.fontSize};
41
- font-weight: ${o.input.text.fontWeight};
64
+ font-size: ${t.input.text.fontSize};
65
+ font-weight: ${t.input.text.fontWeight};
42
66
  color: ${n.text.static_icons__default.rgba};
43
67
  outline: none;
44
68
  border: none;
@@ -51,17 +75,22 @@ import"react";import"../../molecules/RichTextEditor/custom-extensions/AmplifyKit
51
75
  &::-webkit-search-results-decoration {
52
76
  display: none;
53
77
  }
54
- `,u=s(e.div)`
78
+ `,u=a(e.div)`
79
+ border-bottom-left-radius: ${r.corners.borderRadius};
80
+ border-bottom-right-radius: ${r.corners.borderRadius};
81
+ background: ${n.ui.background__default.rgba};
82
+ box-shadow: ${i.raised};
83
+ overflow: hidden;
55
84
  > section {
56
- padding: ${m.medium};
85
+ padding: ${d.medium};
57
86
  display: flex;
58
87
  flex-direction: column;
59
- gap: ${m.medium};
60
- ${({$showClearFilterButton:r})=>{if(r)return a`
88
+ gap: ${d.medium};
89
+ ${({$showClearFilterButton:r})=>{if(r)return s`
61
90
  > div:last-child {
62
91
  display: grid;
63
92
  grid-template-columns: 1fr auto;
64
- gap: ${m.medium};
93
+ gap: ${d.medium};
65
94
 
66
95
  > button {
67
96
  align-self: flex-end;
@@ -69,8 +98,8 @@ import"react";import"../../molecules/RichTextEditor/custom-extensions/AmplifyKit
69
98
  }
70
99
  `}}
71
100
  }
72
- `,c=s(i)`
73
- ${({$tryingToRemove:r})=>{if(r)return a`
101
+ `,c=a(o)`
102
+ ${({$tryingToRemove:r})=>{if(r)return s`
74
103
  background: ${n.interactive.primary__hover_alt.rgba};
75
104
  `}}
76
- `;export{d as Container,u as Content,l as SearchField,c as StyledChip,p as Wrapper};
105
+ `;export{p as Container,u as Content,l as SearchField,c as StyledChip,m as Wrapper};
@@ -0,0 +1,38 @@
1
+ import { ChangeEvent, ReactNode } from 'react';
2
+ import { IconData } from '@equinor/eds-icons';
3
+ export interface CommonFilterProps<T> {
4
+ values: {
5
+ key: T;
6
+ label: string;
7
+ icon?: IconData;
8
+ }[];
9
+ onClearFilter: (key: T) => void;
10
+ onClearAllFilters: () => void;
11
+ search: string;
12
+ onSearchChange: (event: ChangeEvent<HTMLInputElement>) => void;
13
+ onSearchEnter: (value: string) => void;
14
+ children: ReactNode | ReactNode[];
15
+ initialOpen?: boolean;
16
+ placeholder?: string;
17
+ id?: string;
18
+ showClearFiltersButton?: boolean;
19
+ }
20
+ export interface SortingProps<S> {
21
+ sortValue: S;
22
+ onSortChange: (value: S) => void;
23
+ sortItems: {
24
+ value: S;
25
+ label: string;
26
+ }[];
27
+ }
28
+ type FilterWithSortingProps<T, S> = CommonFilterProps<T> & SortingProps<S>;
29
+ export interface QuickFilterProps<Q> {
30
+ onQuickFilter: (value: Q) => void;
31
+ quickFilterItems: {
32
+ value: Q;
33
+ label: string;
34
+ }[];
35
+ }
36
+ type FilterWithQuickFilterProps<T, Q> = CommonFilterProps<T> & QuickFilterProps<Q>;
37
+ export type FilterProps<T, S, Q> = CommonFilterProps<T> | FilterWithSortingProps<T, S> | FilterWithQuickFilterProps<T, Q> | (FilterWithSortingProps<T, S> & FilterWithQuickFilterProps<T, Q>);
38
+ export {};
@@ -0,0 +1,2 @@
1
+ import { QuickFilterProps } from './Filter.types';
2
+ export declare function QuickFilter<Q>({ quickFilterItems, onQuickFilter, }: QuickFilterProps<Q>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ import{jsxs as r,jsx as e}from"react/jsx-runtime";import{useState as t}from"react";import{Menu as i,Typography as n,Icon as o}from"@equinor/eds-core-react";import{arrow_drop_up as a,arrow_drop_down as m}from"@equinor/eds-icons";import{ButtonWithMenu as c}from"./ButtonWithMenu.js";function u({quickFilterItems:u,onQuickFilter:l}){const[p,s]=t(!1);return r(c,{onOpenChange:s,menuItems:u.map((r=>e(i.Item,{onClick:()=>l(r.value),children:r.label},r.label))),children:[e(n,{as:"span",variant:"button",group:"navigation",children:"Quick filter"}),e(o,{data:p?a:m})]})}export{u as QuickFilter};
@@ -0,0 +1,2 @@
1
+ import { SortingProps } from './Filter.types';
2
+ export declare function Sorting<S>({ sortValue, onSortChange, sortItems, }: SortingProps<S>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import{jsxs as r,jsx as t}from"react/jsx-runtime";import{Menu as o,Icon as i,Typography as e}from"@equinor/eds-core-react";import{radio_button_selected as s,radio_button_unselected as a,sort as n}from"@equinor/eds-icons";import{ButtonWithMenu as m}from"./ButtonWithMenu.js";import"react";import"../../molecules/RichTextEditor/custom-extensions/AmplifyKit.js";import"../../molecules/RichTextEditor/RichTextEditor.types.js";import"../../_virtual/lodash.js";import"@equinor/subsurface-app-management";import"@microsoft/signalr";import"@tanstack/react-query";import"../../atoms/enums/Environment.js";import"../../atoms/utils/auth_environment.js";import"../TopBar/Notifications/NotificationProvider.js";import"../../providers/AuthProvider/AuthProvider.js";import"../../providers/ReleaseNotesProvider.js";import"../../providers/SideBarProvider.js";import"../../providers/SnackbarProvider/SnackbarProvider.js";import"../../providers/StepperProvider.js";import"../../providers/TableOfContentsProvider.js";import"../../providers/ThemeProvider/ThemeProvider.js";import"../../providers/TutorialStepsProvider.js";import{colors as p}from"../../atoms/style/colors.js";import"../../atoms/enums/Errors.js";import"../../atoms/enums/Theme.js";import"../../atoms/enums/SpacingsMode.js";import"../../deprecated/ErrorPage/illustrations/GlitchAnimation.js";import"../../deprecated/ErrorPage/illustrations/QuestioningAnimation.js";import"proj4";import"html2canvas";import l from"styled-components";const d=l(o.Item)`
2
+ > div {
3
+ grid-template-columns: 1fr auto;
4
+ }
5
+ `,c=l.div`
6
+ position: relative;
7
+ > span:first-child {
8
+ visibility: hidden;
9
+ }
10
+ > span:last-child {
11
+ position: absolute;
12
+ white-space: nowrap;
13
+ left: 0;
14
+ }
15
+ `;function u({sortValue:o,onSortChange:l,sortItems:u}){const v=u.find((r=>r.value===o)),h=u.sort(((r,t)=>t.label.length-r.label.length)).at(0)?.label;return r(m,{menuItems:u.map((e=>r(d,{onClick:()=>{var r;r=e.value,l(r)},children:[e.label,t(i,{color:e.value===o?p.interactive.primary__resting.rgba:p.text.static_icons__tertiary.rgba,data:e.value===o?s:a})]},e.label))),children:[r(c,{children:[r(e,{as:"span",variant:"button",group:"navigation",children:["Sort by ",h?.toLowerCase()]}),r(e,{as:"span",variant:"button",group:"navigation",children:["Sort by ",v?.label.toLowerCase()]})]}),t(i,{data:n})]})}export{u as Sorting};
@@ -3,7 +3,7 @@ export type { EdsDataGridProps as DataGridProps } from '@equinor/eds-data-grid-r
3
3
  export { FieldSelector } from './FieldSelector/FieldSelector';
4
4
  export type { FieldSelectorProps } from './FieldSelector/FieldSelector';
5
5
  export { Filter } from './Filter/Filter';
6
- export type { FilterProps } from './Filter/Filter';
6
+ export type * from './Filter/Filter.types';
7
7
  export { SideBar } from './SideBar';
8
8
  export type { ItemType } from './SideBar';
9
9
  export { TopBar } from './TopBar';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/amplify-component-lib",
3
- "version": "8.16.1",
3
+ "version": "8.17.0",
4
4
  "description": "Frontend Typescript components for the Amplify team",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",