@equinor/amplify-component-lib 8.18.1 → 8.19.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.
- package/dist/atoms/hooks/useSelect.js +1 -1
- package/dist/molecules/DatePicker/DatePicker.styles.js +3 -0
- package/dist/molecules/FileProgress/CompactFileProgress.js +1 -1
- package/dist/molecules/FileProgress/CompactFileProgress.styles.d.ts +1 -1
- package/dist/molecules/FileProgress/CompactFileProgress.styles.js +26 -20
- package/dist/molecules/FileProgress/FileProgress.utils.js +1 -1
- package/dist/molecules/RichTextEditor/RichTextEditor.styles.js +4 -4
- package/dist/molecules/Select/GroupedSelectMenu.js +1 -1
- package/dist/molecules/Select/ListSelectMenu.js +1 -1
- package/dist/molecules/Select/Select.styles.d.ts +1 -0
- package/dist/molecules/Select/Select.styles.js +14 -8
- package/dist/molecules/Select/Select.types.d.ts +1 -1
- package/dist/molecules/Select/SelectMenuItem.js +1 -1
- package/dist/organisms/Filter/Filter.styles.js +37 -37
- package/dist/organisms/TableOfContents/TableOfContents.styles.js +8 -8
- package/dist/organisms/TopBar/Settings.d.ts +2 -1
- package/dist/organisms/TopBar/Settings.js +11 -11
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as e,useRef as n,useMemo as r,useEffect as t}from"react";import{flattenOptions as l}from"../../molecules/Select/Select.utils.js";const u=u=>{const{loading:a,disabled:c,sortValues:o,onSearchChange:d,onOpenCallback:s}=u,[i
|
|
1
|
+
import{useState as e,useRef as n,useMemo as r,useEffect as t}from"react";import{flattenOptions as l}from"../../molecules/Select/Select.utils.js";const u=u=>{const{loading:a,disabled:c,sortValues:o,onSearchChange:d,onOpenCallback:s}=u,[v,i]=e(!1),[h,m]=e(""),f=n(null),g=n([]),p=n(-1),[y,S]=e(void 0),k=n(!1),I=n(0),A=r((()=>{let e,n=[];return"values"in u?n=u.values:u.value&&(n=[u.value]),o?(e="groups"in u&&u.groups?u.groups.flatMap((e=>e.items)):u.items.flatMap((e=>[{...e},...e.children||[]])),n.sort(((n,r)=>e.findIndex((e=>e.value===n.value))-e.findIndex((e=>e.value===r.value))))):n}),[u,o]);t((()=>{void 0!==s&&s(v)}),[s,v]),t((()=>{k.current&&I.current!==A.length&&(I.current=A.length,k.current=!1,f.current?.focus())}),[A.length]);const O=()=>{v||c||a||(f.current?.focus(),i(!0))},w=()=>{i(!1),m(""),p.current=0},C=e=>{!("values"in u)||a||c||u.onSelect(u.values.filter((n=>n.value!==e.value)),e)};return{handleOnAddItem:()=>{"onAddItem"in u&&u.onAddItem&&(u.onAddItem(h),m(""))},handleOnItemSelect:e=>{"value"in u?u.value?.value===e.value?u.onSelect(void 0):u.onSelect(e):u.onSelect(((e,n)=>{const r=structuredClone(e);return r.some((e=>e.value===n.value))?r.filter((e=>e.value!==n.value)):"values"in u&&void 0!==u.syncParentChildSelection&&!u.syncParentChildSelection?[n,...r]:[n,...r.filter((e=>(!(void 0===n.children||n.children.length>0)||!l([n]).some((n=>n.value===e.value)))&&(void 0===e.children||0===e.children.length||l([e]).every((e=>e.value!==n.value)))))]})(u.values,e),e),""!==h&&m(""),k.current=!0},handleOnItemKeyDown:e=>{"ArrowDown"===e.key&&p.current<g.current.length-1?(p.current+=1,g.current.at(p.current)?.focus()):"ArrowUp"===e.key&&p.current>0?(p.current-=1,g.current.at(p.current)?.focus()):"ArrowUp"===e.key&&0===p.current&&(p.current=-1,f.current?.focus())},handleOnSearchKeyDown:e=>{"Enter"===e.key&&""!==h&&"onAddItem"in u&&u.onAddItem?(e.preventDefault(),u.onAddItem(h),m("")):"Space"===e.key||"Enter"===e.key?O():"Escape"===e.key?(f.current?.blur(),w()):"ArrowDown"!==e.key&&"ArrowUp"!==e.key||!g.current.at(0)?"Backspace"===e.key&&void 0===y&&"values"in u&&""===h?(S(A?.at(-1)),setTimeout((()=>{f.current?.focus()}))):"Backspace"===e.key&&y&&(C(y),S(void 0)):(g.current[0]?.focus(),p.current=0)},handleOnClear:()=>{"value"in u?u.onSelect(void 0):u.onSelect([])},handleOnSearchChange:e=>{" "===e.target.value||a||c||(m(e.target.value),d?.(e.target.value),v||i(!0),A.length>0&&""!==e.target.value&&setTimeout((()=>{f.current?.focus()})))},handleToggleOpen:()=>{c||a||(v?w():O())},handleOnClose:w,handleOnOpen:O,handleOnRemoveItem:C,search:h,searchRef:f,itemRefs:g,selectedValues:A,open:v,tryingToRemoveItem:y}};export{u as useSelect};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as r,jsx as t}from"react/jsx-runtime";import{useState as e,useEffect as i,useMemo as o}from"react";import{Icon as s,Typography as n}from"@equinor/eds-core-react";import{error_outlined as a,clear as m}from"@equinor/eds-icons";import{Rejection as p,DoneWrapper as l,LoadingWrapper as c,CircularProgress as d,CompactFileProgressContainer as
|
|
1
|
+
import{jsxs as r,jsx as t}from"react/jsx-runtime";import{useState as e,useEffect as i,useMemo as o}from"react";import{Icon as s,Typography as n}from"@equinor/eds-core-react";import{error_outlined as a,clear as m}from"@equinor/eds-icons";import{Rejection as p,DoneWrapper as l,LoadingWrapper as c,CircularProgress as d,CompactFileProgressContainer as h,FileTooltip as j,AdditionalText as u,CloseButton as g}from"./CompactFileProgress.styles.js";import{isFileImage as v,getFileIcon as S,readUploadedFileAsText as x}from"./FileProgress.utils.js";import{colors as f}from"../../atoms/style/colors.js";import"../AnimatedCheckmark/AnimatedCheckmark.styles.js";import"../ApplicationIcon/ApplicationIcon.js";import"../Badge/Badge.styles.js";import"../Banner/Banner.styles.js";import"../Chip/Chip.js";import"../ContentMenu/ContentMenu.styles.js";import"../DatePicker/DatePicker.js";import"../Dialog/Dialog.js";import"../EquinorLogo/EquinorLogo.js";import"../RichTextEditor/custom-extensions/AmplifyKit.js";import"../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"../../organisms/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"../../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"./RegularFileProgress.styles.js";import"../FileUploadArea/FileUploadArea.js";import"../FullPageSpinner/FullPageSpinner.js";import"../InfoElement/InfoElement.js";import{OptionalTooltip as k}from"../OptionalTooltip/OptionalTooltip.js";import"../ProfileAvatar/ProfileAvatar.js";import"@tiptap/react";import"../RichTextEditor/RichTextEditor.styles.js";import"../RichTextEditor/MenuBar/MenuBar.js";import"../RichTextEditor/MenuBar/MenuBar.styles.js";import"../RichTextEditor/MenuBar/MenuButton.js";import"../Search/Search.js";import"react-router-dom";import"../Sieve/Sieve.styles.js";import"../SingleFilterMenu/SingleFilterMenu.js";import"../Skeleton/SkeletonBase/SkeletonBase.js";import"../Skeleton/Skeleton.styles.js";import"../Stepper/Stepper.js";import"../OptionDrawer/OptionDrawer.js";import"../Select/Select.styles.js";import"../ListItem/ListItem.js";import"../SelectionControls/Checkbox/Checkbox.js";import"../SelectionControls/Radio/Radio.js";import"../SelectionControls/Switch/Switch.js";const P=({file:P,progressPercent:w,isError:y,shortErrorText:E,showCompleteState:T,fullErrorText:B,handleOnClick:C,isDeleting:A})=>{const[b,R]=e("");i((()=>{y||(async r=>{const t=await x(r);R(t)})(P)}),[y,P]);const M=o((()=>y?B&&B.length>0?B:"An error has occurred with the file":""),[B,y]),_=o((()=>y?r(p,{children:[t(s,{data:a,color:f.interactive.warning__text.rgba}),t("div",{children:E&&E.length>0?E:"Invalid file type"}),t("svg",{width:"88",height:"88",viewBox:"0 0 88 88",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("rect",{x:"1",y:"1",width:"86",height:"86",rx:"7",stroke:f.interactive.warning__text.rgba,strokeWidth:"2",strokeDasharray:"4 4"})})]}):T&&!A&&v(P.name)?t(l,{children:t("img",{src:b,alt:` ${P.name}`})}):T&&!A?t(l,{children:t(s,{data:S(P.name)})}):r(c,{children:[t(d,{variant:void 0===w||A?"indeterminate":"determinate",value:w,size:24}),t(n,{variant:"meta",children:"Uploading..."}),t("svg",{width:"88",height:"88",viewBox:"0 0 88 88",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("rect",{x:"1",y:"1",width:"86",height:"86",rx:"7",stroke:f.ui.background__medium.rgba,strokeWidth:"2",strokeDasharray:"4 4"})})]})),[y,T,A,w,E,b,P.name]);return r(h,{$isError:y,children:[t(j,{title:M,children:_}),t(k,{title:P.name,children:t(u,{group:"paragraph",variant:"meta",children:P.name})}),!A&&t(g,{"data-testid":"attachment-delete-button",onClick:C,children:t(s,{color:f.text.static_icons__tertiary.rgba,data:m})})]})};export{P as default};
|
|
@@ -1,53 +1,57 @@
|
|
|
1
|
-
import{Typography as i,Tooltip as
|
|
2
|
-
border-radius: 4px;
|
|
1
|
+
import{Typography as i,Tooltip as t,CircularProgress as r}from"@equinor/eds-core-react";import{animation as e}from"../../atoms/style/animation.js";import{colors as o}from"../../atoms/style/colors.js";import{spacings as s}from"../../atoms/style/spacings.js";import a,{css as n}from"styled-components";const l="7px",d=a.div`
|
|
3
2
|
margin: 10px 0;
|
|
4
3
|
width: 88px;
|
|
5
4
|
height: 88px;
|
|
6
5
|
box-sizing: border-box;
|
|
7
6
|
position: relative;
|
|
8
7
|
transition: ${e.transitionMS};
|
|
8
|
+
border-radius: ${l};
|
|
9
9
|
${({$isError:i})=>i&&n`
|
|
10
10
|
&:hover {
|
|
11
11
|
background: ${o.ui.background__warning.rgba};
|
|
12
12
|
}
|
|
13
13
|
`}
|
|
14
|
-
`;
|
|
15
|
-
margin: ${
|
|
14
|
+
`;a(i)`
|
|
15
|
+
margin: ${s.small} ${s.small} 0 ${s.small};
|
|
16
16
|
color: ${o.text.static_icons__tertiary.rgba};
|
|
17
|
-
`;const c=
|
|
17
|
+
`;const c=a.div`
|
|
18
18
|
height: 100%;
|
|
19
19
|
width: 100%;
|
|
20
20
|
overflow: hidden;
|
|
21
|
-
border: 2px dashed ${o.ui.background__medium.rgba};
|
|
22
21
|
display: flex;
|
|
23
22
|
flex-direction: column;
|
|
24
|
-
gap: ${
|
|
23
|
+
gap: ${s.small};
|
|
25
24
|
justify-content: center;
|
|
26
25
|
align-items: center;
|
|
27
|
-
border-radius: ${
|
|
28
|
-
|
|
26
|
+
border-radius: ${l};
|
|
27
|
+
> svg:last-child {
|
|
28
|
+
position: absolute;
|
|
29
|
+
}
|
|
30
|
+
`,p=a.div`
|
|
29
31
|
height: 100%;
|
|
30
32
|
width: 100%;
|
|
31
33
|
overflow: hidden;
|
|
32
34
|
border: 2px solid ${o.ui.background__medium.rgba};
|
|
33
|
-
border-radius: ${
|
|
35
|
+
border-radius: ${l};
|
|
34
36
|
position: relative;
|
|
35
37
|
display: flex;
|
|
36
38
|
justify-content: center;
|
|
37
39
|
align-items: center;
|
|
40
|
+
|
|
38
41
|
> img {
|
|
39
42
|
object-fit: cover;
|
|
40
43
|
width: 88px;
|
|
41
44
|
height: 88px;
|
|
42
45
|
}
|
|
46
|
+
|
|
43
47
|
> svg {
|
|
44
48
|
width: 40px;
|
|
45
49
|
height: 40px;
|
|
46
50
|
}
|
|
47
|
-
`,
|
|
51
|
+
`,g=a.div`
|
|
48
52
|
display: flex;
|
|
49
53
|
flex-direction: column;
|
|
50
|
-
gap: ${
|
|
54
|
+
gap: ${s.small};
|
|
51
55
|
align-items: center;
|
|
52
56
|
justify-content: center;
|
|
53
57
|
height: 100%;
|
|
@@ -55,12 +59,14 @@ import{Typography as i,Tooltip as r,CircularProgress as t}from"@equinor/eds-core
|
|
|
55
59
|
font-size: 11px;
|
|
56
60
|
justify-items: center;
|
|
57
61
|
text-align: center;
|
|
58
|
-
border-radius: ${
|
|
59
|
-
|
|
62
|
+
border-radius: ${l};
|
|
63
|
+
> svg:last-child {
|
|
64
|
+
position: absolute;
|
|
65
|
+
}
|
|
60
66
|
> div {
|
|
61
67
|
color: ${o.interactive.warning__text.rgba};
|
|
62
68
|
}
|
|
63
|
-
`,h=
|
|
69
|
+
`,h=a.div`
|
|
64
70
|
background-color: ${o.text.static_icons__tertiary.rgba};
|
|
65
71
|
border-radius: 50%;
|
|
66
72
|
border: 2px solid ${o.ui.background__light.rgba};
|
|
@@ -75,20 +81,20 @@ import{Typography as i,Tooltip as r,CircularProgress as t}from"@equinor/eds-core
|
|
|
75
81
|
height: 14px;
|
|
76
82
|
fill: ${o.ui.background__light.rgba};
|
|
77
83
|
}
|
|
78
|
-
`,
|
|
84
|
+
`,m=a(i)`
|
|
79
85
|
font-size: 10px;
|
|
80
|
-
padding-top: ${
|
|
86
|
+
padding-top: ${s.x_small};
|
|
81
87
|
width: 100%;
|
|
82
88
|
overflow: hidden;
|
|
83
89
|
text-overflow: ellipsis;
|
|
84
90
|
text-wrap: nowrap;
|
|
85
|
-
`,
|
|
91
|
+
`,x=a(t)`
|
|
86
92
|
white-space: pre;
|
|
87
|
-
`,b=
|
|
93
|
+
`,b=a(r)`
|
|
88
94
|
circle {
|
|
89
95
|
stroke: ${o.interactive.primary__resting.rgba};
|
|
90
96
|
}
|
|
91
97
|
circle:first-child {
|
|
92
98
|
stroke: ${o.interactive.primary__hover_alt.rgba};
|
|
93
99
|
}
|
|
94
|
-
`;export{
|
|
100
|
+
`;export{m as AdditionalText,l as BORDER_RADIUS,b as CircularProgress,h as CloseButton,d as CompactFileProgressContainer,p as DoneWrapper,x as FileTooltip,c as LoadingWrapper,g as Rejection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{file_description as e,library_pdf as n}from"@equinor/eds-icons";function r(e){const n=new FileReader;return new Promise(((r,o)=>{n.onerror=()=>{n.abort(),o(new DOMException("Problem parsing input file."))},n.onload=()=>{r(n.result)},n.readAsDataURL(e)}))}function o(e){return/\.(jpe?g|png|gif|bmp)$/i.test(e)}function t(r){return"pdf"===r.split(".").pop()?n:e}export{t as getFileIcon,o as isFileImage,r as readUploadedFileAsText};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{tokens as r}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import{EditorContent as o}from"@tiptap/react";import
|
|
1
|
+
import{tokens as r}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import{EditorContent as o}from"@tiptap/react";import t from"styled-components";import"react";import"./custom-extensions/AmplifyKit.js";import"./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"../../organisms/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 e}from"../../atoms/style/colors.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";const{spacings:i,typography:a,shape:n,colors:s}=r,d=t(o)`
|
|
2
2
|
display: grid;
|
|
3
3
|
grid-template-rows: 1fr;
|
|
4
4
|
overflow-y: auto;
|
|
5
5
|
min-height: ${r=>r.$minHeight||"auto"};
|
|
6
6
|
max-height: ${r=>r.$maxHeight||"auto"};
|
|
7
|
-
`,p=
|
|
7
|
+
`,p=t.div`
|
|
8
8
|
display: grid;
|
|
9
9
|
background: ${s.ui.background__default.rgba};
|
|
10
10
|
border-radius: ${n.corners.borderRadius} ${n.corners.borderRadius} 0 0;
|
|
@@ -25,7 +25,7 @@ import{tokens as r}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/ind
|
|
|
25
25
|
background: ${r=>r.$lightBackground?`${s.ui.background__default.rgba}`:`${s.ui.background__light.rgba}`};
|
|
26
26
|
|
|
27
27
|
&[contenteditable='true'] {
|
|
28
|
-
box-shadow: ${({$highlighted:r})=>r?`inset 0 -2px ${
|
|
28
|
+
box-shadow: ${({$highlighted:r})=>r?`inset 0 -2px ${e.dataviz.darkblue.darker}`:`inset 0 -1px ${s.ui.background__medium.rgba}`};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
padding: ${r=>{switch(r.$padding){case"sm":return i.comfortable.small;case"md":return i.comfortable.medium;case"lg":return i.comfortable.large;default:return 0}}};
|
|
@@ -90,7 +90,7 @@ import{tokens as r}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/ind
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
th {
|
|
93
|
-
background-color: #f1f3f5;
|
|
93
|
+
background-color: ${({$lightBackground:r})=>r?"#f1f3f5":s.ui.background__default.rgba};
|
|
94
94
|
font-weight: bold;
|
|
95
95
|
text-align: left;
|
|
96
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useMemo as t}from"react";import{Menu as i}from"@equinor/eds-core-react";import{NoItemsFoundText as m}from"./Select.styles.js";import{getCumulativeArrayFromNumberedArray as l}from"./Select.utils.js";import{SelectMenuItem as n}from"./SelectMenuItem.js";const r=r=>{const{onItemSelect:o,onItemKeyDown:s,itemRefs:c,groups:a,search:
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useMemo as t}from"react";import{Menu as i}from"@equinor/eds-core-react";import{NoItemsFoundText as m}from"./Select.styles.js";import{getCumulativeArrayFromNumberedArray as l}from"./Select.utils.js";import{SelectMenuItem as n}from"./SelectMenuItem.js";const r=r=>{const{onItemSelect:o,onItemKeyDown:s,itemRefs:c,groups:a,search:u,onSearchFilter:f}=r,p=t((()=>{if(""===u)return a;const e=new RegExp(u,"i");return a.map((t=>({title:t.title,items:t.items.filter((t=>void 0!==f?f(u,t):t.label.match(e)))}))).filter((e=>e.items.length>0))}),[a,f,u]),d=t((()=>{const e=p.map((e=>e.items.length));return l(e)}),[p]);return 0===p.length?e(m,{children:"No items found"}):"values"in r?p.map(((t,m)=>e(i.Section,{index:m,title:t.title,children:t.items.map(((i,l)=>e(n,{index:l+d[m],childOffset:0,item:i,multiselect:!0,itemRefs:c,onItemKeyDown:s,onItemSelect:o,values:r.values},`${t.title}-${m}-item-${i.value}`)))},`${t.title}-${m}`))):p.map(((t,m)=>e(i.Section,{index:m,title:t.title,children:t.items.map(((i,l)=>e(n,{index:l+d[m],childOffset:0,item:i,itemRefs:c,onItemKeyDown:s,onItemSelect:o,value:r.value},`${t.title}-${m}-item-${i.value}`)))},`${t.title}-${m}`)))};export{r as GroupedSelectMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useMemo as m}from"react";import{Menu as i}from"@equinor/eds-core-react";import{AddTagItem as o}from"./AddTagItem.js";import{NoItemsFoundText as r,NoTagFoundText as l}from"./Select.styles.js";import{flattenOptions as s,getChildOffset as d}from"./Select.utils.js";import{SelectMenuItem as c}from"./SelectMenuItem.js";const a=a=>{const{search:u,items:f,onItemSelect:h,itemRefs:I,onItemKeyDown:p,onSearchFilter:x}=a,S=m((()=>{if(""===u)return f;const e=new RegExp(u,"i");return s(f).filter((t=>void 0!==x?x(u,t):t.label.match(e)))}),[f,x,u]);if(0===S.length&&!a.onAddItem)return e(r,{children:"No items found"});const g=S.some((e=>e.children&&e.children.length>0));if("values"in a){const m=S.map(((e,t)=>({childOffset:d(S,t),index:t,item:e,itemRefs:I,onItemKeyDown:p,onItemSelect:h,itemValue:e.value,values:a.values,parentHasNestedItems:g})));return"onAddItem"in a&&a.onAddItem&&""!==u?t(n,{children:[e(i.Section,{title:"Add tag",index:0,children:e(o,{index:0,itemRefs:I,onItemKeyDown:p,onAddItem:a.onAddItem,children:u})}),e(i.Section,{title:"Tag search results",index:1,children:m.length>0?m.map(((t,n)=>e(c,{multiselect:!0,...t,index:n+1},`menu-item-${n}-${t.itemValue}`))):t(l,{children:['No tag for "',u,'" found.']})})]}):m.map(((t,n)=>e(c,{multiselect:!0,...t},`menu-item-${n}-${t.itemValue}`)))}return S.map(((t,n)=>e(c,{childOffset:d(S,n),index:n,item:t,itemRefs:I,onItemKeyDown:p,onItemSelect:h,parentHasNestedItems:g},`menu-item-${n}-${t.value}`)))};export{a as ListSelectMenu};
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useMemo as m}from"react";import{Menu as i}from"@equinor/eds-core-react";import{AddTagItem as o}from"./AddTagItem.js";import{NoItemsFoundText as r,NoTagFoundText as l}from"./Select.styles.js";import{flattenOptions as s,getChildOffset as d}from"./Select.utils.js";import{SelectMenuItem as c}from"./SelectMenuItem.js";const a=a=>{const{search:u,items:f,onItemSelect:h,itemRefs:I,onItemKeyDown:p,onSearchFilter:x}=a,S=m((()=>{if(""===u)return f;const e=new RegExp(u,"i");return s(f).filter((t=>void 0!==x?x(u,t):t.label.match(e)))}),[f,x,u]);if(0===S.length&&!a.onAddItem)return e(r,{children:"No items found"});const g=S.some((e=>e.children&&e.children.length>0));if("values"in a){const m=S.map(((e,t)=>({childOffset:d(S,t),index:t,item:e,itemRefs:I,onItemKeyDown:p,onItemSelect:h,itemValue:e.value,values:a.values,parentHasNestedItems:g})));return"onAddItem"in a&&a.onAddItem&&""!==u?t(n,{children:[e(i.Section,{title:"Add tag",index:0,children:e(o,{index:0,itemRefs:I,onItemKeyDown:p,onAddItem:a.onAddItem,children:u})}),e(i.Section,{title:"Tag search results",index:1,children:m.length>0?m.map(((t,n)=>e(c,{multiselect:!0,...t,index:n+1},`menu-item-${n}-${t.itemValue}`))):t(l,{children:['No tag for "',u,'" found.']})})]}):m.map(((t,n)=>e(c,{multiselect:!0,...t},`menu-item-${n}-${t.itemValue}`)))}return S.map(((t,n)=>e(c,{childOffset:d(S,n),index:n,item:t,itemRefs:I,onItemKeyDown:p,onItemSelect:h,parentHasNestedItems:g,value:a.value},`menu-item-${n}-${t.value}`)))};export{a as ListSelectMenu};
|
|
@@ -50,6 +50,7 @@ declare const ComboBoxChip: import("styled-components/dist/types").IStyledCompon
|
|
|
50
50
|
}))) & import("react").RefAttributes<HTMLButtonElement | HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
|
|
51
51
|
interface CustomMenuItemProps {
|
|
52
52
|
$paddedLeft?: boolean;
|
|
53
|
+
$selected?: boolean;
|
|
53
54
|
}
|
|
54
55
|
declare const StyledMenuItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<{
|
|
55
56
|
as?: import("react").ElementType | undefined;
|
|
@@ -93,7 +93,7 @@ import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";expor
|
|
|
93
93
|
width: calc(100% - 24px);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
`,
|
|
96
|
+
`,h=d.section`
|
|
97
97
|
position: relative;
|
|
98
98
|
display: flex;
|
|
99
99
|
flex-wrap: wrap;
|
|
@@ -135,7 +135,7 @@ import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";expor
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
`,
|
|
138
|
+
`,u=d(t)`
|
|
139
139
|
position: absolute;
|
|
140
140
|
top: 50%;
|
|
141
141
|
transform: translate(0, -50%);
|
|
@@ -154,10 +154,9 @@ import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";expor
|
|
|
154
154
|
background: ${({$tryingToRemove:t,$lightBackground:e})=>t?o.interactive.primary__hover_alt.rgba:e?o.ui.background__light.rgba:o.ui.background__default.rgba} !important;
|
|
155
155
|
`,x=d(e.Item)`
|
|
156
156
|
flex-grow: 1;
|
|
157
|
-
border-radius: 2px;
|
|
158
157
|
${({$paddedLeft:t})=>t&&"margin-left: 36px"};
|
|
159
158
|
padding-left: 10px;
|
|
160
|
-
|
|
159
|
+
|
|
161
160
|
> div {
|
|
162
161
|
grid-auto-columns: auto;
|
|
163
162
|
justify-content: flex-start;
|
|
@@ -170,16 +169,24 @@ import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";expor
|
|
|
170
169
|
&:focus-visible {
|
|
171
170
|
outline: 2px dashed ${o.interactive.primary__resting.rgba};
|
|
172
171
|
}
|
|
172
|
+
|
|
173
|
+
${({$selected:t})=>t?c`
|
|
174
|
+
background: ${o.interactive.primary__selected_highlight.rgba};
|
|
175
|
+
|
|
176
|
+
&:hover {
|
|
177
|
+
background: ${o.interactive.primary__selected_hover.rgba};
|
|
178
|
+
}
|
|
179
|
+
`:""}}
|
|
173
180
|
`,_=d.hr`
|
|
174
181
|
height: calc(100% + ${s.medium} * 2);
|
|
175
182
|
justify-self: center;
|
|
176
183
|
width: ${s.x_large};
|
|
177
|
-
|
|
184
|
+
`,$=d(r)`
|
|
178
185
|
position: absolute;
|
|
179
186
|
color: ${o.text.static_icons__tertiary.rgba};
|
|
180
187
|
top: calc(50%);
|
|
181
188
|
transform: translate(0, -50%);
|
|
182
|
-
|
|
189
|
+
`,f=d($)`
|
|
183
190
|
white-space: nowrap;
|
|
184
191
|
overflow: hidden;
|
|
185
192
|
text-overflow: ellipsis;
|
|
@@ -200,8 +207,7 @@ import{Button as t,Menu as e,Typography as r}from"@equinor/eds-core-react";expor
|
|
|
200
207
|
`,k=d.div`
|
|
201
208
|
display: flex;
|
|
202
209
|
align-items: center;
|
|
203
|
-
padding: 0 ${s.small};
|
|
204
210
|
`,j=d(t)`
|
|
205
211
|
width: 36px;
|
|
206
212
|
height: 36px;
|
|
207
|
-
`;export{
|
|
213
|
+
`;export{u as ClearButton,m as ComboBoxChip,b as Container,g as HelperWrapper,_ as MenuItemSpacer,k as MenuItemWrapper,w as NoItemsFoundText,v as NoTagFoundText,$ as PlaceholderText,h as Section,j as SmallButton,y as StyledMenu,x as StyledMenuItem,f as ValueText,p as Wrapper};
|
|
@@ -54,7 +54,7 @@ export type SingleSelectMenuItemProps<T extends SelectOptionRequired> = {
|
|
|
54
54
|
multiselect?: undefined;
|
|
55
55
|
isParentSelected?: boolean;
|
|
56
56
|
parentHasNestedItems?: boolean;
|
|
57
|
-
} & Omit<SelectMenuProps<T>, 'search'> & SelectMenuItemProps<T>;
|
|
57
|
+
} & Omit<SelectMenuProps<T>, 'search'> & SelectMenuItemProps<T> & Pick<SingleSelectCommon<T>, 'value'>;
|
|
58
58
|
export type MultiSelectMenuItemProps<T extends SelectOptionRequired> = {
|
|
59
59
|
isParentSelected?: boolean;
|
|
60
60
|
parentHasNestedItems?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{useState as n,useRef as
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{useState as n,useRef as o,useMemo as c}from"react";import{Icon as i}from"@equinor/eds-core-react";import{checkbox_outline as l,chevron_down as a,chevron_right as s,checkbox as u}from"@equinor/eds-icons";import{tokens as d}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import{getChildOffset as m}from"./Select.utils.js";import{getParentIcon as p}from"./SelectMenuItem.utils.js";import{spacings as h}from"../../atoms/style/spacings.js";import{MenuItemSpacer as f,MenuItemWrapper as y,SmallButton as v,StyledMenuItem as g}from"./Select.styles.js";const{colors:w}=d,k=d=>{const{index:b,childOffset:x,depth:C=0,item:D,multiselect:$,itemRefs:A,onItemKeyDown:I,onItemSelect:_,parentHasNestedItems:j=!1}=d,[K,S]=n(!1),O=o(-1),q=o([]),L=("values"in d?d.values.map((({value:e})=>e)):[]).includes(D.value),M=c((()=>$?p(D,d.values):l),[D,$,d]),R=c((()=>new Array(C).fill(0).map(((r,t)=>e(f,{},`spacer-${r+t}`)))),[C]),H=e=>{e.preventDefault(),_(D)},N=e=>{e.stopPropagation(),S((e=>!e))},U=e=>{"ArrowDown"===e.key?O.current+=1:"ArrowUp"===e.key&&(O.current-=1),O.current<=-1?(A.current[b]?.focus(),O.current=-1):O.current+x===q.current.length?(O.current=-1,I(e),S(!1)):O.current>=0&&O.current<q.current.length-x&&q.current[O.current+x]?.focus()},P=e=>{!K&&"ArrowDown"===e.key||"ArrowUp"===e.key?I(e):"ArrowRight"===e.key||"ArrowLeft"===e.key?S((e=>!e)):K&&"ArrowDown"===e.key&&-1===O.current&&(O.current=0,q.current[O.current+x]?.focus())};return D.children&&D.children.length>0&&$?r(t,{children:[r(y,{style:{paddingLeft:0===C?h.small:0},children:[R,e(v,{variant:"ghost_icon",onClick:N,"data-testid":"toggle-button",children:e(i,{color:w.interactive.primary__resting.rgba,data:K?a:s})}),r(g,{$depth:C,ref:e=>{A.current[b]=e},index:b,closeMenuOnClick:!1,onKeyDownCapture:P,onClick:H,children:[e(i,{color:w.interactive.primary__resting.rgba,data:M}),e("span",{children:D.label})]})]}),K&&D.children.map(((r,t)=>e(k,{index:x+t,childOffset:x+m(D.children,t),depth:C+1,multiselect:!0,item:r,itemRefs:q,values:d.values,onItemKeyDown:U,onItemSelect:_,parentHasNestedItems:!0},`child-${t}-${r.value}-${D.value}`)))]}):$?r(y,{children:[R,r(g,{$depth:C,$paddedLeft:j,ref:e=>{A.current[b]=e},index:b,tabIndex:C,closeMenuOnClick:!1,onKeyDownCapture:I,onClick:H,children:[e(i,{color:w.interactive.primary__resting.rgba,data:L?u:l}),e("span",{children:D.label})]})]}):e(y,{children:e(g,{$depth:C,$selected:d.value&&D.value===d.value.value,ref:e=>{A.current[b]=e},index:b,onKeyDownCapture:I,onClick:H,children:e("span",{children:D.label})})})};export{k as SelectMenuItem};
|
|
@@ -1,61 +1,62 @@
|
|
|
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
|
|
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}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 o,{css as a}from"styled-components";import{colors as s}from"../../atoms/style/colors.js";import{spacings as n}from"../../atoms/style/spacings.js";const d=o.div`
|
|
2
2
|
width: 100%;
|
|
3
|
-
|
|
3
|
+
border: 1px solid ${s.ui.background__heavy.rgba};
|
|
4
|
+
border-radius: ${r.corners.borderRadius};
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
`,l=o.div`
|
|
4
7
|
display: flex;
|
|
5
|
-
background: ${
|
|
8
|
+
background: ${s.ui.background__default.rgba};
|
|
6
9
|
align-items: center;
|
|
7
10
|
width: 100%;
|
|
8
|
-
|
|
9
|
-
|
|
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};
|
|
13
|
-
transition: border-bottom 200ms;
|
|
11
|
+
padding-left: ${n.small};
|
|
12
|
+
outline: 1px solid ${s.ui.background__medium.rgba};
|
|
14
13
|
cursor: pointer;
|
|
15
14
|
> section {
|
|
16
|
-
|
|
15
|
+
min-height: 24px;
|
|
16
|
+
align-items: center;
|
|
17
17
|
flex-grow: 1;
|
|
18
18
|
display: flex;
|
|
19
19
|
flex-wrap: wrap;
|
|
20
|
-
gap: ${
|
|
20
|
+
gap: ${n.x_small};
|
|
21
|
+
margin: calc(${n.xx_small} + ${n.x_small}) 0
|
|
22
|
+
calc(${n.xx_small} + ${n.x_small}) ${n.small};
|
|
21
23
|
}
|
|
22
|
-
> button {
|
|
23
|
-
|
|
24
|
-
padding: 0 ${d.small} 0 ${d.medium_small};
|
|
24
|
+
> button:not([data-testid='clear-all-x']) {
|
|
25
|
+
padding: 0 ${n.small} 0 ${n.medium_small};
|
|
25
26
|
display: flex;
|
|
26
|
-
gap: ${
|
|
27
|
+
gap: ${n.x_small};
|
|
27
28
|
align-items: center;
|
|
28
29
|
justify-content: center;
|
|
29
|
-
border-left: 1px solid ${
|
|
30
|
-
color: ${
|
|
30
|
+
border-left: 1px solid ${s.ui.background__medium.rgba};
|
|
31
|
+
color: ${s.interactive.primary__resting.rgba};
|
|
31
32
|
span {
|
|
32
|
-
color: ${
|
|
33
|
+
color: ${s.interactive.primary__resting.rgba};
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
&:hover {
|
|
36
|
-
background: ${
|
|
37
|
+
background: ${s.interactive.primary__hover_alt.rgba};
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
> button[data-testid='clear-all-x'] {
|
|
40
41
|
width: 24px;
|
|
41
42
|
height: 24px;
|
|
42
43
|
border-left: none;
|
|
43
|
-
margin-right: ${
|
|
44
|
+
margin-right: ${n.xx_small};
|
|
44
45
|
&:after {
|
|
45
46
|
width: 24px;
|
|
46
47
|
height: 24px;
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
> button:last-child {
|
|
50
|
-
border-left: 1px solid ${
|
|
51
|
+
border-left: 1px solid ${s.ui.background__medium.rgba};
|
|
51
52
|
width: 36px;
|
|
52
53
|
padding: 0;
|
|
54
|
+
align-self: stretch;
|
|
53
55
|
&:hover {
|
|
54
|
-
|
|
55
|
-
background: ${n.interactive.primary__hover_alt.rgba};
|
|
56
|
+
background: ${s.interactive.primary__hover_alt.rgba};
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
`,
|
|
59
|
+
`,m=o.input`
|
|
59
60
|
background: transparent;
|
|
60
61
|
width: 0;
|
|
61
62
|
flex-grow: 1;
|
|
@@ -63,34 +64,33 @@ import"react";import"../../molecules/RichTextEditor/custom-extensions/AmplifyKit
|
|
|
63
64
|
font-family: 'Equinor', sans-serif;
|
|
64
65
|
font-size: ${t.input.text.fontSize};
|
|
65
66
|
font-weight: ${t.input.text.fontWeight};
|
|
66
|
-
color: ${
|
|
67
|
+
color: ${s.text.static_icons__default.rgba};
|
|
67
68
|
outline: none;
|
|
68
69
|
border: none;
|
|
69
70
|
&::placeholder {
|
|
70
71
|
opacity: 1;
|
|
71
|
-
color: ${
|
|
72
|
+
color: ${s.text.static_icons__tertiary.rgba};
|
|
72
73
|
}
|
|
73
74
|
&::-webkit-search-cancel-button,
|
|
74
75
|
&::-webkit-search-results-button,
|
|
75
76
|
&::-webkit-search-results-decoration {
|
|
76
77
|
display: none;
|
|
77
78
|
}
|
|
78
|
-
`,
|
|
79
|
+
`,p=o(e.div)`
|
|
79
80
|
border-bottom-left-radius: ${r.corners.borderRadius};
|
|
80
81
|
border-bottom-right-radius: ${r.corners.borderRadius};
|
|
81
|
-
background: ${
|
|
82
|
-
box-shadow: ${i.raised};
|
|
82
|
+
background: ${s.ui.background__default.rgba};
|
|
83
83
|
overflow: hidden;
|
|
84
84
|
> section {
|
|
85
|
-
padding: ${
|
|
85
|
+
padding: ${n.medium};
|
|
86
86
|
display: flex;
|
|
87
87
|
flex-direction: column;
|
|
88
|
-
gap: ${
|
|
89
|
-
${({$showClearFilterButton:r})=>{if(r)return
|
|
88
|
+
gap: ${n.medium};
|
|
89
|
+
${({$showClearFilterButton:r})=>{if(r)return a`
|
|
90
90
|
> div:last-child {
|
|
91
91
|
display: grid;
|
|
92
92
|
grid-template-columns: 1fr auto;
|
|
93
|
-
gap: ${
|
|
93
|
+
gap: ${n.medium};
|
|
94
94
|
|
|
95
95
|
> button {
|
|
96
96
|
align-self: flex-end;
|
|
@@ -98,8 +98,8 @@ import"react";import"../../molecules/RichTextEditor/custom-extensions/AmplifyKit
|
|
|
98
98
|
}
|
|
99
99
|
`}}
|
|
100
100
|
}
|
|
101
|
-
`,c=
|
|
102
|
-
${({$tryingToRemove:r})=>{if(r)return
|
|
103
|
-
background: ${
|
|
101
|
+
`,c=o(i)`
|
|
102
|
+
${({$tryingToRemove:r})=>{if(r)return a`
|
|
103
|
+
background: ${s.interactive.primary__hover_alt.rgba};
|
|
104
104
|
`}}
|
|
105
|
-
`;export{
|
|
105
|
+
`;export{l as Container,p as Content,m as SearchField,c as StyledChip,d as Wrapper};
|
|
@@ -2,10 +2,12 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
|
|
|
2
2
|
&:hover {
|
|
3
3
|
background: ${s.interactive.primary__hover_alt.rgba};
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
${({$active:t})=>t?"":n`
|
|
6
|
+
&:focus:not(:hover) {
|
|
7
|
+
outline: 2px dashed ${s.interactive.focus.rgba};
|
|
8
|
+
outline-offset: -4px;
|
|
9
|
+
}
|
|
10
|
+
`}
|
|
9
11
|
position: relative;
|
|
10
12
|
display: grid;
|
|
11
13
|
grid-template-columns: auto 1fr;
|
|
@@ -111,7 +113,6 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
|
|
|
111
113
|
`}}}
|
|
112
114
|
`,u=a.div`
|
|
113
115
|
display: flex;
|
|
114
|
-
flex-direction:;
|
|
115
116
|
position: relative;
|
|
116
117
|
&:after {
|
|
117
118
|
position: absolute;
|
|
@@ -170,8 +171,7 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
|
|
|
170
171
|
background: ${s.ui.background__medium.rgba};
|
|
171
172
|
}
|
|
172
173
|
`}}}
|
|
173
|
-
|
|
174
|
-
`,b=a(r.div)`
|
|
174
|
+
`,$=a(r.div)`
|
|
175
175
|
display: flex;
|
|
176
176
|
flex-direction: column;
|
|
177
177
|
${({$shouldShowChildren:t})=>t?null:n`
|
|
@@ -187,4 +187,4 @@ import{Link as t}from"react-router-dom";import{tokens as e}from"../../node_modul
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
${({$variant:t})=>"buttons"===t&&`gap:${i.x_small};`}
|
|
190
|
-
`;export{f as BorderItemsContainer,u as BorderItemsHorizontalContainer,d as Button
|
|
190
|
+
`;export{f as BorderItemsContainer,u as BorderItemsHorizontalContainer,d as Button,$ as ChildContainer,c as Link,g as TableOfContentsContainer,p as TableOfContentsItemContainer};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { SettingsSection } from './Settings.types';
|
|
3
3
|
export interface SettingsProps {
|
|
4
4
|
allSettings?: SettingsSection[];
|
|
5
|
+
children?: ReactNode | ReactNode[];
|
|
5
6
|
}
|
|
6
7
|
export declare const Settings: FC<SettingsProps>;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as o,jsx as r}from"react/jsx-runtime";import{useRef as t,useState as i,useContext as l,useMemo as a}from"react";import{Icon as n,Typography as
|
|
1
|
+
import{jsxs as e,Fragment as o,jsx as r}from"react/jsx-runtime";import{useRef as t,useState as i,useContext as l,useMemo as a}from"react";import{Icon as n,Typography as m,Radio as s}from"@equinor/eds-core-react";import{settings as d}from"@equinor/eds-icons";import{TopBarButton as p}from"./TopBar.styles.js";import{TopBarMenu as c}from"./TopBarMenu.js";import"../../atoms/enums/Errors.js";import"../../atoms/enums/Environment.js";import{Theme as h}from"../../atoms/enums/Theme.js";import"../../atoms/enums/SpacingsMode.js";import{elevation as u}from"../../atoms/style/index.js";import{ThemeProviderContext as f}from"../../providers/ThemeProvider/ThemeProvider.js";import g from"styled-components";import{spacings as x}from"../../atoms/style/spacings.js";const v=g.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: row;
|
|
4
4
|
align-items: center;
|
|
5
|
-
gap: ${
|
|
6
|
-
padding: 0 ${
|
|
5
|
+
gap: ${x.x_small};
|
|
6
|
+
padding: 0 ${x.large} 0 ${x.small};
|
|
7
7
|
justify-content: space-between;
|
|
8
8
|
> span {
|
|
9
|
-
padding: ${
|
|
9
|
+
padding: ${x.small} ${x.x_small};
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
`,$=g.div`
|
|
12
12
|
width: 64px;
|
|
13
13
|
height: 32px;
|
|
14
14
|
background-color: ${e=>e.$color};
|
|
15
|
-
box-shadow: ${
|
|
15
|
+
box-shadow: ${u.raised};
|
|
16
16
|
border-radius: 4px;
|
|
17
|
-
`,
|
|
17
|
+
`,b=g.div`
|
|
18
18
|
display: flex;
|
|
19
19
|
flex-direction: column;
|
|
20
|
-
gap: ${
|
|
20
|
+
gap: ${x.medium};
|
|
21
21
|
> div > p {
|
|
22
|
-
padding-top: ${
|
|
23
|
-
padding-left: ${
|
|
22
|
+
padding-top: ${x.small};
|
|
23
|
+
padding-left: ${x.medium};
|
|
24
24
|
}
|
|
25
|
-
`,
|
|
25
|
+
`,j=({allSettings:u,children:g})=>{const x=t(null),[j,T]=i(!1),y=l(f),B=a((()=>y?[{title:"Theme",value:y.theme,onChange:e=>y.setTheme(e),items:[{label:"Light Mode",name:"theme-group",value:h.LIGHT,colorBox:"#ffffff"},{label:"Dark Mode",name:"theme-group",value:h.DARK,colorBox:"#243746"}]},...u??[]]:u??[]),[u,y]);if(0===B.length)throw new Error("Empty settings in TopBar.Settings!");return e(o,{children:[r(p,{variant:"ghost_icon",onClick:()=>T(!j),ref:x,children:r(n,{data:d,size:24})}),e(c,{open:j,title:"Settings",onClose:()=>T(!1),anchorEl:x.current,children:[r(b,{children:B.map(((o,t)=>e("div",{children:[r(m,{variant:"overline",children:o.title}),o.items.map(((t,i)=>e(v,{children:[r(s,{id:t.label,disabled:t.disabled,label:t.label,name:o.title,value:`${t.label}-${i}`,checked:o.value===t.value,onChange:()=>o.onChange?.(t.value)}),t.colorBox&&r($,{$color:t.colorBox,"data-testid":`colorbox-${t.colorBox}`}),t.text&&r(m,{variant:"h6",children:t.text}),t.element&&t.element]},i)))]},t)))}),g]})]})};j.displayName="TopBar.Settings";export{j as Settings};
|