@equinor/amplify-component-lib 8.18.0 → 8.18.2
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/molecules/DatePicker/DatePicker.styles.js +3 -0
- package/dist/molecules/OptionDrawer/OptionDrawer.d.ts +3 -2
- package/dist/molecules/OptionDrawer/OptionDrawer.js +1 -1
- package/dist/molecules/OptionDrawer/OptionDrawer.styles.d.ts +1 -1
- package/dist/molecules/OptionDrawer/OptionDrawer.styles.js +25 -12
- package/dist/molecules/OptionDrawer/stories/data.d.ts +1 -0
- package/dist/organisms/TableOfContents/TableOfContents.styles.js +8 -8
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ export interface ToggleEventProps<T> {
|
|
|
7
7
|
export interface OptionDrawerProps<T extends {
|
|
8
8
|
id: string;
|
|
9
9
|
label: string;
|
|
10
|
+
disabled?: boolean;
|
|
10
11
|
parentId?: string;
|
|
11
12
|
children?: T[];
|
|
12
13
|
}> {
|
|
@@ -22,14 +23,14 @@ export interface OptionDrawerProps<T extends {
|
|
|
22
23
|
openAll?: boolean;
|
|
23
24
|
showIntermediateParent?: boolean;
|
|
24
25
|
parentHasNestedItems?: boolean;
|
|
25
|
-
disabled?: boolean;
|
|
26
26
|
}
|
|
27
27
|
export declare const OptionDrawer: {
|
|
28
28
|
<T extends {
|
|
29
29
|
id: string;
|
|
30
30
|
label: string;
|
|
31
|
+
disabled?: boolean;
|
|
31
32
|
parentId?: string;
|
|
32
33
|
children?: T[];
|
|
33
|
-
}>({ item, onToggle, section, selectedItems, singleSelect, siblings, animateCheck, animateUncheck, animateParent, openAll, showIntermediateParent, parentHasNestedItems,
|
|
34
|
+
}>({ item, onToggle, section, selectedItems, singleSelect, siblings, animateCheck, animateUncheck, animateParent, openAll, showIntermediateParent, parentHasNestedItems, }: OptionDrawerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
34
35
|
displayName: string;
|
|
35
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import{Button as r,Checkbox as d}from"@equinor/eds-core-react";import{chevron_down as o,chevron_right as a}from"@equinor/eds-icons";import{StyledOptionWrapper as l,StyledOptionItem as c,StyledIcon as s,StyledOption as E}from"./OptionDrawer.styles.js";const m=e=>{if(0===e.length)return[];let t=[];return e.forEach((e=>{const i=m(e?.children??[]);t=[e,...t,...i]})),t},h=(e,t,i,n)=>{if(void 0!==t.find((t=>t.id===e.id)))return"CHECKED";if(void 0===e.children||0===e.children.length||i&&!n)return"NONE";const r=m(e?.children).map((e=>void 0!==t.find((t=>t.id===e.id))));return!i&&r.every(Boolean)?"CHECKED":r.every((e=>!e))?"NONE":"INTERMEDIATE"},p=({item:m,onToggle:g,section:C=0,selectedItems:N=[],singleSelect:f=!1,siblings:D,animateCheck:u,animateUncheck:I,animateParent:T,openAll:v,showIntermediateParent:H=!1,parentHasNestedItems:O=!1})=>{const[K,b]=i(!1),[k,y]=i(h(m,N,f,H)),[A,$]=i(!1);n((()=>{y(h(m,N,f,H))}),[m,N,f,H]),n((()=>{b(!!v)}),[v]);const w=e=>{const t=0===m.children?.length||f||void 0===m.children?[m]:[...m.children];"CHECKED"===k?(g({items:t,toggle:!1,event:e}),b(!1)):"NONE"!==k&&"INTERMEDIATE"!==k||(g({items:t,toggle:!0,event:e}),b(!0)),$(!1)},M=(e,t)=>{t&&T?(T(!0),y("CHECKED"===k?"NONE":"CHECKED"),setTimeout((()=>{w(e)}),400)):D?w(e):($(!0),y("CHECKED"===k?"NONE":"CHECKED"),setTimeout((()=>{w(e)}),400))},P=e=>{if(D&&T){const t=N.filter((e=>e.id.includes(m.parentId??""))).length;if(!e&&u&&t===D-1)return!0;if(e&&I&&1===t)return!0}return!1},R=e=>{"CHECKED"===k&&I?M(e,P(!0)):"NONE"!==k&&"INTERMEDIATE"!==k||!u?w(e):M(e,P(!1))},S=m.children&&0!==m.children.length;return e(l,{$section:C,$animationActive:A,"data-testid":A?"animated-"+m.id:m.id,children:[e(c,{$paddedLeft:O&&!S,children:[S&&t(r,{variant:"ghost_icon",onClick:()=>{b((e=>!e))},"data-testid":"chevron-toggler-option-drawer",children:t(s,{data:K?o:a})}),e(E,{$section:C,onClick:e=>{m.disabled||(m.children&&0!==m.children.length&&b((e=>!e)),R(e))},disabled:!!m.disabled,children:[t(d,{indeterminate:"INTERMEDIATE"===k,checked:"CHECKED"===k,color:"secondary",disabled:!!m.disabled}),m.label]})]}),K&&m.children?.map((e=>t(p,{section:C+1,onToggle:g,selectedItems:N,item:e,singleSelect:f,siblings:m.children?.length,animateCheck:u,animateUncheck:I,animateParent:$,openAll:v,showIntermediateParent:H,parentHasNestedItems:!0},`OptionDrawer-${e.id}`)))]},A?`animated-StyledOptionWrapper-${m.id}`:`StyledOptionWrapper-${m.id}`)};p.displayName="OptionDrawer";export{p as OptionDrawer};
|
|
@@ -3,7 +3,7 @@ interface StyledOptionProps {
|
|
|
3
3
|
$animationActive?: boolean;
|
|
4
4
|
}
|
|
5
5
|
declare const StyledOptionWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledOptionProps>> & string;
|
|
6
|
-
declare const StyledOption: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").
|
|
6
|
+
declare const StyledOption: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, StyledOptionProps>> & string;
|
|
7
7
|
declare const StyledIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<(Omit<Omit<{
|
|
8
8
|
title?: string;
|
|
9
9
|
color?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Icon as
|
|
1
|
+
import{Icon as o}from"@equinor/eds-core-react";import{colors as t}from"../../atoms/style/colors.js";import e,{keyframes as i,css as r}from"styled-components";const a=i`
|
|
2
2
|
0% {
|
|
3
3
|
opacity: 1;
|
|
4
4
|
}
|
|
@@ -9,29 +9,42 @@ import{Icon as i}from"@equinor/eds-core-react";import{colors as e}from"../../ato
|
|
|
9
9
|
opacity: 0;
|
|
10
10
|
display: none;
|
|
11
11
|
}
|
|
12
|
-
`,n=
|
|
13
|
-
margin-left: ${({$section:
|
|
12
|
+
`,n=e.div`
|
|
13
|
+
margin-left: ${({$section:o})=>o>0?"22px":""};
|
|
14
14
|
opacity: 1;
|
|
15
|
-
color: ${
|
|
16
|
-
animation: ${({$animationActive:
|
|
15
|
+
color: ${t.text.static_icons__default.rgba};
|
|
16
|
+
animation: ${({$animationActive:o})=>o?r`
|
|
17
17
|
${a} 400ms ease-in
|
|
18
18
|
`:"none"};
|
|
19
|
-
`,s=
|
|
19
|
+
`,s=e.button`
|
|
20
20
|
position: relative;
|
|
21
21
|
display: flex;
|
|
22
22
|
flex: 1;
|
|
23
23
|
align-items: center;
|
|
24
24
|
cursor: pointer;
|
|
25
25
|
transition: background-color 0.1s ease-in;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
font-family: 'Equinor', sans-serif;
|
|
27
|
+
font-size: 1rem;
|
|
28
|
+
color: ${t.text.static_icons__default.rgba};
|
|
29
|
+
&:hover:not(:disabled) {
|
|
30
|
+
background-color: ${t.interactive.primary__hover_alt.rgba};
|
|
31
|
+
}
|
|
32
|
+
&:disabled {
|
|
33
|
+
cursor: not-allowed;
|
|
34
|
+
color: ${t.interactive.disabled__text.rgba};
|
|
35
|
+
> button {
|
|
36
|
+
cursor: not-allowed;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
> span::before {
|
|
40
|
+
display: none;
|
|
28
41
|
}
|
|
29
42
|
|
|
30
43
|
svg {
|
|
31
|
-
fill: ${
|
|
44
|
+
fill: ${t.interactive.primary__resting.rgba};
|
|
32
45
|
}
|
|
33
|
-
`,
|
|
46
|
+
`,l=e(o)``,c=e.div`
|
|
34
47
|
display: flex;
|
|
35
48
|
align-items: center;
|
|
36
|
-
${({$paddedLeft:
|
|
37
|
-
`;export{
|
|
49
|
+
${({$paddedLeft:o})=>o&&"margin-left: 40px"};
|
|
50
|
+
`;export{l as StyledIcon,s as StyledOption,c as StyledOptionItem,n as StyledOptionWrapper};
|
|
@@ -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};
|